Skip to content

Commit 0f45b0a

Browse files
committed
Fixed Call to an undefined method
1 parent 12134ac commit 0f45b0a

File tree

4 files changed

+36
-39
lines changed

4 files changed

+36
-39
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ vendor/
44
.phpunit.result.cache
55
.php-cs-fixer.cache
66
phpunit.xml
7-
.vscode/
7+
.vscode/
8+
phpstan.neon

phpstan-baseline.neon

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,11 @@
11
parameters:
22
ignoreErrors:
3-
-
4-
message: '#^Call to an undefined method FeedIo\\Feed\\ItemInterface\:\:setHostInContent\(\)\.$#'
5-
identifier: method.notFound
6-
count: 1
7-
path: src/FeedIo/Feed.php
8-
9-
-
10-
message: '#^Call to an undefined method FeedIo\\Feed\\ItemInterface\:\:setLinkForAnalysis\(\)\.$#'
11-
identifier: method.notFound
12-
count: 1
13-
path: src/FeedIo/Parser/XmlParser.php
14-
15-
-
16-
message: '#^Deprecated in PHP 8\.0\: Required parameter \$url follows optional parameter \$modifiedSince\.$#'
17-
identifier: parameter.requiredAfterOptional
18-
count: 1
19-
path: src/FeedIo/Reader/Result.php
20-
21-
-
22-
message: '#^Deprecated in PHP 8\.1\: Required parameter \$response follows optional parameter \$modifiedSince\.$#'
23-
identifier: parameter.requiredAfterOptional
24-
count: 1
25-
path: src/FeedIo/Reader/Result.php
26-
273
-
284
message: '#^Offset float on list in isset\(\) does not exist\.$#'
295
identifier: isset.offset
306
count: 1
317
path: src/FeedIo/Reader/Result/UpdateStats.php
328

33-
-
34-
message: '#^Call to an undefined method FeedIo\\Feed\\NodeInterface\:\:getHostFromLink\(\)\.$#'
35-
identifier: method.notFound
36-
count: 1
37-
path: src/FeedIo/Rule/Atom/Link.php
38-
39-
-
40-
message: '#^Call to an undefined method FeedIo\\Feed\\NodeInterface\:\:getHostFromLink\(\)\.$#'
41-
identifier: method.notFound
42-
count: 1
43-
path: src/FeedIo/Rule/Link.php
44-
459
-
4610
message: '#^PHPDoc tag @var with type FeedIo\\Reader\\FixerAbstract is not subtype of native type FeedIo\\Reader\\Fixer\\HttpLastModified\|FeedIo\\Reader\\Fixer\\PublicId\.$#'
4711
identifier: varTag.nativeType

src/FeedIo/Feed/Node.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ protected function setHost(?string $link = null): void
165165
}
166166
}
167167

168-
protected function setHostInContent(?string $host = null): void
168+
public function setHostInContent(?string $host = null): NodeInterface
169169
{
170170
if (is_null($host)) {
171-
return;
171+
return $this;
172172
}
173173
// Replaced links like href="/aaa/bbb.xxx"
174174
$pattern = '(<\s*[^>]*)(href=|src=)(.?)(\/[^\/])(?!(.(?!<code))*<\/code>)';
@@ -187,6 +187,8 @@ protected function setHostInContent(?string $host = null): void
187187
$pattern = '(<\s*[^>]*)(href=|src=)(.?)(\w+\b)(?![:])(?!(.(?!<code))*<\/code>)';
188188
$this->pregReplaceInProperty('content', $pattern, '\1\2\3'.$itemLink.'\4');
189189
$this->pregReplaceInProperty('description', $pattern, '\1\2\3'.$itemLink.'\4');
190+
191+
return $this;
190192
}
191193

192194
public function pregReplaceInProperty(string $property, string $pattern, string $replacement): void

src/FeedIo/Feed/NodeInterface.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,34 @@ public function getValue(string $name): ?string;
141141
* @return NodeInterface
142142
*/
143143
public function set(string $name, ?string $value = null): NodeInterface;
144+
145+
/**
146+
* Sets the host in content
147+
*
148+
* @param string|null $host
149+
* @return NodeInterface
150+
*/
151+
public function setHostInContent(?string $host = null): NodeInterface;
152+
153+
/**
154+
* Gets the host from link
155+
*
156+
* @return string|null
157+
*/
158+
public function getHostFromLink(): ?string;
159+
160+
/**
161+
* Sets the link for analysis
162+
*
163+
* @param string|null $link
164+
* @return NodeInterface
165+
*/
166+
public function setLinkForAnalysis(?string $link = null): NodeInterface;
167+
168+
/**
169+
* Gets the link for analysis
170+
*
171+
* @return string|null
172+
*/
173+
public function getLinkForAnalysis(): ?string;
144174
}

0 commit comments

Comments
 (0)