Update PicoFeed

This commit is contained in:
Frédéric Guillot 2017-06-20 19:41:55 -04:00 committed by GitHub
parent bad2c0e4ab
commit 32a60fd614
22 changed files with 147 additions and 183 deletions

View File

@ -17,7 +17,7 @@
"fguillot/simple-validator": "v1.0.0", "fguillot/simple-validator": "v1.0.0",
"fguillot/json-rpc": "v1.2.3", "fguillot/json-rpc": "v1.2.3",
"fguillot/picodb": "v1.0.14 ", "fguillot/picodb": "v1.0.14 ",
"miniflux/picofeed": "v0.1.34", "miniflux/picofeed": "v0.1.35",
"pda/pheanstalk": "v3.1.0", "pda/pheanstalk": "v3.1.0",
"ircmaxell/password-compat": "^1.0.4" "ircmaxell/password-compat": "^1.0.4"
}, },

14
composer.lock generated
View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "90873f716813f79b0812e922cf08abb4", "hash": "3cc07606516c51a4d77e4fee5f6470b7",
"content-hash": "757aaae3177772d2e5e6ba64b0cdd28f", "content-hash": "7a0eee4a959247fb9833c66ed8d1b775",
"packages": [ "packages": [
{ {
"name": "fguillot/json-rpc", "name": "fguillot/json-rpc",
@ -166,16 +166,16 @@
}, },
{ {
"name": "miniflux/picofeed", "name": "miniflux/picofeed",
"version": "v0.1.34", "version": "v0.1.35",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/miniflux/picoFeed.git", "url": "https://github.com/miniflux/picoFeed.git",
"reference": "5c8a731d4e7a3589e562e4fdaa98bcb57fa8a2ea" "reference": "3a27b47de31eedec075c719f961783c5db7a7b08"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/miniflux/picoFeed/zipball/5c8a731d4e7a3589e562e4fdaa98bcb57fa8a2ea", "url": "https://api.github.com/repos/miniflux/picoFeed/zipball/3a27b47de31eedec075c719f961783c5db7a7b08",
"reference": "5c8a731d4e7a3589e562e4fdaa98bcb57fa8a2ea", "reference": "3a27b47de31eedec075c719f961783c5db7a7b08",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -215,7 +215,7 @@
], ],
"description": "Modern library to handle RSS/Atom feeds", "description": "Modern library to handle RSS/Atom feeds",
"homepage": "https://github.com/miniflux/picoFeed", "homepage": "https://github.com/miniflux/picoFeed",
"time": "2017-06-12 00:22:06" "time": "2017-06-20 22:54:47"
}, },
{ {
"name": "pda/pheanstalk", "name": "pda/pheanstalk",

View File

@ -167,61 +167,6 @@
"zf2" "zf2"
] ]
}, },
{
"name": "miniflux/picofeed",
"version": "v0.1.34",
"version_normalized": "0.1.34.0",
"source": {
"type": "git",
"url": "https://github.com/miniflux/picoFeed.git",
"reference": "5c8a731d4e7a3589e562e4fdaa98bcb57fa8a2ea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/miniflux/picoFeed/zipball/5c8a731d4e7a3589e562e4fdaa98bcb57fa8a2ea",
"reference": "5c8a731d4e7a3589e562e4fdaa98bcb57fa8a2ea",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-iconv": "*",
"ext-libxml": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"php": ">=5.3.0",
"zendframework/zendxml": "^1.0"
},
"require-dev": {
"phpdocumentor/reflection-docblock": "2.0.4",
"phpunit/phpunit": "4.8.26",
"symfony/yaml": "2.8.7"
},
"suggest": {
"ext-curl": "PicoFeed will use cURL if present"
},
"time": "2017-06-12 00:22:06",
"bin": [
"picofeed"
],
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"PicoFeed": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Frédéric Guillot"
}
],
"description": "Modern library to handle RSS/Atom feeds",
"homepage": "https://github.com/miniflux/picoFeed"
},
{ {
"name": "pda/pheanstalk", "name": "pda/pheanstalk",
"version": "v3.1.0", "version": "v3.1.0",
@ -317,5 +262,60 @@
"hashing", "hashing",
"password" "password"
] ]
},
{
"name": "miniflux/picofeed",
"version": "v0.1.35",
"version_normalized": "0.1.35.0",
"source": {
"type": "git",
"url": "https://github.com/miniflux/picoFeed.git",
"reference": "3a27b47de31eedec075c719f961783c5db7a7b08"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/miniflux/picoFeed/zipball/3a27b47de31eedec075c719f961783c5db7a7b08",
"reference": "3a27b47de31eedec075c719f961783c5db7a7b08",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-iconv": "*",
"ext-libxml": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"php": ">=5.3.0",
"zendframework/zendxml": "^1.0"
},
"require-dev": {
"phpdocumentor/reflection-docblock": "2.0.4",
"phpunit/phpunit": "4.8.26",
"symfony/yaml": "2.8.7"
},
"suggest": {
"ext-curl": "PicoFeed will use cURL if present"
},
"time": "2017-06-20 22:54:47",
"bin": [
"picofeed"
],
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"PicoFeed": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Frédéric Guillot"
}
],
"description": "Modern library to handle RSS/Atom feeds",
"homepage": "https://github.com/miniflux/picoFeed"
} }
] ]

View File

@ -106,6 +106,13 @@ abstract class Client
*/ */
protected $password = ''; protected $password = '';
/**
* CURL options.
*
* @var array
*/
protected $additional_curl_options = array();
/** /**
* Client connection timeout. * Client connection timeout.
* *
@ -323,7 +330,6 @@ abstract class Client
* Find content type from response headers. * Find content type from response headers.
* *
* @param array $response Client response * @param array $response Client response
*
* @return string * @return string
*/ */
public function findContentType(array $response) public function findContentType(array $response)
@ -339,7 +345,6 @@ abstract class Client
public function findCharset() public function findCharset()
{ {
$result = explode('charset=', $this->content_type); $result = explode('charset=', $this->content_type);
return isset($result[1]) ? $result[1] : ''; return isset($result[1]) ? $result[1] : '';
} }
@ -348,7 +353,6 @@ abstract class Client
* *
* @param array $response Client response * @param array $response Client response
* @param string $header Header name * @param string $header Header name
*
* @return string * @return string
*/ */
public function getHeader(array $response, $header) public function getHeader(array $response, $header)
@ -360,13 +364,11 @@ abstract class Client
* Set the Last-Modified HTTP header. * Set the Last-Modified HTTP header.
* *
* @param string $last_modified Header value * @param string $last_modified Header value
* * @return $this
* @return \PicoFeed\Client\Client
*/ */
public function setLastModified($last_modified) public function setLastModified($last_modified)
{ {
$this->last_modified = $last_modified; $this->last_modified = $last_modified;
return $this; return $this;
} }
@ -384,13 +386,11 @@ abstract class Client
* Set the value of the Etag HTTP header. * Set the value of the Etag HTTP header.
* *
* @param string $etag Etag HTTP header value * @param string $etag Etag HTTP header value
* * @return $this
* @return \PicoFeed\Client\Client
*/ */
public function setEtag($etag) public function setEtag($etag)
{ {
$this->etag = $etag; $this->etag = $etag;
return $this; return $this;
} }
@ -490,13 +490,11 @@ abstract class Client
* Set connection timeout. * Set connection timeout.
* *
* @param int $timeout Connection timeout * @param int $timeout Connection timeout
* * @return $this
* @return \PicoFeed\Client\Client
*/ */
public function setTimeout($timeout) public function setTimeout($timeout)
{ {
$this->timeout = $timeout ?: $this->timeout; $this->timeout = $timeout ?: $this->timeout;
return $this; return $this;
} }
@ -504,13 +502,11 @@ abstract class Client
* Set a custom user agent. * Set a custom user agent.
* *
* @param string $user_agent User Agent * @param string $user_agent User Agent
* * @return $this
* @return \PicoFeed\Client\Client
*/ */
public function setUserAgent($user_agent) public function setUserAgent($user_agent)
{ {
$this->user_agent = $user_agent ?: $this->user_agent; $this->user_agent = $user_agent ?: $this->user_agent;
return $this; return $this;
} }
@ -518,13 +514,11 @@ abstract class Client
* Set the maximum number of HTTP redirections. * Set the maximum number of HTTP redirections.
* *
* @param int $max Maximum * @param int $max Maximum
* * @return $this
* @return \PicoFeed\Client\Client
*/ */
public function setMaxRedirections($max) public function setMaxRedirections($max)
{ {
$this->max_redirects = $max ?: $this->max_redirects; $this->max_redirects = $max ?: $this->max_redirects;
return $this; return $this;
} }
@ -532,13 +526,11 @@ abstract class Client
* Set the maximum size of the HTTP body. * Set the maximum size of the HTTP body.
* *
* @param int $max Maximum * @param int $max Maximum
* * @return $this
* @return \PicoFeed\Client\Client
*/ */
public function setMaxBodySize($max) public function setMaxBodySize($max)
{ {
$this->max_body_size = $max ?: $this->max_body_size; $this->max_body_size = $max ?: $this->max_body_size;
return $this; return $this;
} }
@ -546,13 +538,11 @@ abstract class Client
* Set the proxy hostname. * Set the proxy hostname.
* *
* @param string $hostname Proxy hostname * @param string $hostname Proxy hostname
* * @return $this
* @return \PicoFeed\Client\Client
*/ */
public function setProxyHostname($hostname) public function setProxyHostname($hostname)
{ {
$this->proxy_hostname = $hostname ?: $this->proxy_hostname; $this->proxy_hostname = $hostname ?: $this->proxy_hostname;
return $this; return $this;
} }
@ -560,13 +550,11 @@ abstract class Client
* Set the proxy port. * Set the proxy port.
* *
* @param int $port Proxy port * @param int $port Proxy port
* * @return $this
* @return \PicoFeed\Client\Client
*/ */
public function setProxyPort($port) public function setProxyPort($port)
{ {
$this->proxy_port = $port ?: $this->proxy_port; $this->proxy_port = $port ?: $this->proxy_port;
return $this; return $this;
} }
@ -574,13 +562,11 @@ abstract class Client
* Set the proxy username. * Set the proxy username.
* *
* @param string $username Proxy username * @param string $username Proxy username
* * @return $this
* @return \PicoFeed\Client\Client
*/ */
public function setProxyUsername($username) public function setProxyUsername($username)
{ {
$this->proxy_username = $username ?: $this->proxy_username; $this->proxy_username = $username ?: $this->proxy_username;
return $this; return $this;
} }
@ -588,13 +574,11 @@ abstract class Client
* Set the proxy password. * Set the proxy password.
* *
* @param string $password Password * @param string $password Password
* * @return $this
* @return \PicoFeed\Client\Client
*/ */
public function setProxyPassword($password) public function setProxyPassword($password)
{ {
$this->proxy_password = $password ?: $this->proxy_password; $this->proxy_password = $password ?: $this->proxy_password;
return $this; return $this;
} }
@ -603,12 +587,11 @@ abstract class Client
* *
* @param string $username Basic Auth username * @param string $username Basic Auth username
* *
* @return \PicoFeed\Client\Client * @return $this
*/ */
public function setUsername($username) public function setUsername($username)
{ {
$this->username = $username ?: $this->username; $this->username = $username ?: $this->username;
return $this; return $this;
} }
@ -617,36 +600,46 @@ abstract class Client
* *
* @param string $password Basic Auth Password * @param string $password Basic Auth Password
* *
* @return \PicoFeed\Client\Client * @return $this
*/ */
public function setPassword($password) public function setPassword($password)
{ {
$this->password = $password ?: $this->password; $this->password = $password ?: $this->password;
return $this; return $this;
} }
/**
* Set the CURL options.
*
* @param array $options
* @return $this
*/
public function setAdditionalCurlOptions(array $options)
{
$this->additional_curl_options = $options ?: $this->additional_curl_options;
return $this;
}
/** /**
* Enable the passthrough mode. * Enable the passthrough mode.
* *
* @return \PicoFeed\Client\Client * @return $this
*/ */
public function enablePassthroughMode() public function enablePassthroughMode()
{ {
$this->passthrough = true; $this->passthrough = true;
return $this; return $this;
} }
/** /**
* Disable the passthrough mode. * Disable the passthrough mode.
* *
* @return \PicoFeed\Client\Client * @return $this
*/ */
public function disablePassthroughMode() public function disablePassthroughMode()
{ {
$this->passthrough = false; $this->passthrough = false;
return $this; return $this;
} }
@ -654,8 +647,7 @@ abstract class Client
* Set config object. * Set config object.
* *
* @param \PicoFeed\Config\Config $config Config instance * @param \PicoFeed\Config\Config $config Config instance
* * @return $this
* @return \PicoFeed\Client\Client
*/ */
public function setConfig(Config $config) public function setConfig(Config $config)
{ {
@ -668,6 +660,7 @@ abstract class Client
$this->setProxyPort($config->getProxyPort()); $this->setProxyPort($config->getProxyPort());
$this->setProxyUsername($config->getProxyUsername()); $this->setProxyUsername($config->getProxyUsername());
$this->setProxyPassword($config->getProxyPassword()); $this->setProxyPassword($config->getProxyPassword());
$this->setAdditionalCurlOptions($config->getAdditionalCurlOptions() ?: array());
} }
return $this; return $this;

View File

@ -110,11 +110,6 @@ class Curl extends Client
return $this->handleRedirection($headers['Location']); return $this->handleRedirection($headers['Location']);
} }
// Do not work with PHP-FPM
if (strpos(PHP_SAPI, 'cgi') !== false) {
header(':', true, $status);
}
if (isset($headers['Content-Type'])) { if (isset($headers['Content-Type'])) {
header('Content-Type:' .$headers['Content-Type']); header('Content-Type:' .$headers['Content-Type']);
} }
@ -221,6 +216,20 @@ class Curl extends Client
return $ch; return $ch;
} }
/**
* Set additional CURL options.
*
* @param resource $ch
*
* @return resource $ch
*/
private function prepareAdditionalCurlOptions($ch){
foreach( $this->additional_curl_options as $c_op => $c_val ){
curl_setopt($ch, $c_op, $c_val);
}
return $ch;
}
/** /**
* Prepare curl context. * Prepare curl context.
* *
@ -254,6 +263,7 @@ class Curl extends Client
$ch = $this->prepareDownloadMode($ch); $ch = $this->prepareDownloadMode($ch);
$ch = $this->prepareProxyContext($ch); $ch = $this->prepareProxyContext($ch);
$ch = $this->prepareAuthContext($ch); $ch = $this->prepareAuthContext($ch);
$ch = $this->prepareAdditionalCurlOptions($ch);
return $ch; return $ch;
} }

View File

@ -50,10 +50,8 @@ class Url
* Shortcut method to get an absolute url from relative url. * Shortcut method to get an absolute url from relative url.
* *
* @static * @static
*
* @param mixed $item_url Unknown url (can be relative or not) * @param mixed $item_url Unknown url (can be relative or not)
* @param mixed $website_url Website url * @param mixed $website_url Website url
*
* @return string * @return string
*/ */
public static function resolve($item_url, $website_url) public static function resolve($item_url, $website_url)
@ -78,9 +76,7 @@ class Url
* Shortcut method to get a base url. * Shortcut method to get a base url.
* *
* @static * @static
*
* @param string $url * @param string $url
*
* @return string * @return string
*/ */
public static function base($url) public static function base($url)
@ -94,7 +90,6 @@ class Url
* Get the base URL. * Get the base URL.
* *
* @param string $suffix Add a suffix to the url * @param string $suffix Add a suffix to the url
*
* @return string * @return string
*/ */
public function getBaseUrl($suffix = '') public function getBaseUrl($suffix = '')
@ -106,7 +101,6 @@ class Url
* Get the absolute URL. * Get the absolute URL.
* *
* @param string $base_url Use this url as base url * @param string $base_url Use this url as base url
*
* @return string * @return string
*/ */
public function getAbsoluteUrl($base_url = '') public function getAbsoluteUrl($base_url = '')
@ -150,7 +144,8 @@ class Url
* Imported from Guzzle library: https://github.com/guzzle/psr7/blob/master/src/Uri.php#L568-L582 * Imported from Guzzle library: https://github.com/guzzle/psr7/blob/master/src/Uri.php#L568-L582
* *
* @param $path * @param $path
* * @param string $charUnreserved
* @param string $charSubDelims
* @return string * @return string
*/ */
public function filterPath($path, $charUnreserved = 'a-zA-Z0-9_\-\.~', $charSubDelims = '!\$&\'\(\)\*\+,;=') public function filterPath($path, $charUnreserved = 'a-zA-Z0-9_\-\.~', $charSubDelims = '!\$&\'\(\)\*\+,;=')
@ -226,7 +221,6 @@ class Url
* Get the scheme. * Get the scheme.
* *
* @param string $suffix Suffix to add when there is a scheme * @param string $suffix Suffix to add when there is a scheme
*
* @return string * @return string
*/ */
public function getScheme($suffix = '') public function getScheme($suffix = '')
@ -238,12 +232,12 @@ class Url
* Set the scheme. * Set the scheme.
* *
* @param string $scheme Set a scheme * @param string $scheme Set a scheme
* * @return $this
* @return string
*/ */
public function setScheme($scheme) public function setScheme($scheme)
{ {
$this->components['scheme'] = $scheme; $this->components['scheme'] = $scheme;
return $this;
} }
/** /**
@ -260,7 +254,6 @@ class Url
* Get the port. * Get the port.
* *
* @param string $prefix Prefix to add when there is a port * @param string $prefix Prefix to add when there is a port
*
* @return string * @return string
*/ */
public function getPort($prefix = '') public function getPort($prefix = '')

View File

@ -7,9 +7,11 @@ namespace PicoFeed\Config;
* *
* @author Frederic Guillot * @author Frederic Guillot
* *
* @method \PicoFeed\Config\Config setAdditionalCurlOptions(array $options)
* @method \PicoFeed\Config\Config setClientTimeout(integer $value) * @method \PicoFeed\Config\Config setClientTimeout(integer $value)
* @method \PicoFeed\Config\Config setClientUserAgent(string $value) * @method \PicoFeed\Config\Config setClientUserAgent(string $value)
* @method \PicoFeed\Config\Config setMaxRedirections(integer $value) * @method \PicoFeed\Config\Config setMaxRedirections(integer $value)
* @method \PicoFeed\Config\Config setMaxRecursions(integer $value)
* @method \PicoFeed\Config\Config setMaxBodySize(integer $value) * @method \PicoFeed\Config\Config setMaxBodySize(integer $value)
* @method \PicoFeed\Config\Config setProxyHostname(string $value) * @method \PicoFeed\Config\Config setProxyHostname(string $value)
* @method \PicoFeed\Config\Config setProxyPort(integer $value) * @method \PicoFeed\Config\Config setProxyPort(integer $value)
@ -36,6 +38,7 @@ namespace PicoFeed\Config;
* @method integer getClientTimeout() * @method integer getClientTimeout()
* @method string getClientUserAgent() * @method string getClientUserAgent()
* @method integer getMaxRedirections() * @method integer getMaxRedirections()
* @method integer getMaxRecursions()
* @method integer getMaxBodySize() * @method integer getMaxBodySize()
* @method string getProxyHostname() * @method string getProxyHostname()
* @method integer getProxyPort() * @method integer getProxyPort()
@ -59,6 +62,7 @@ namespace PicoFeed\Config;
* @method string getFilterImageProxyUrl() * @method string getFilterImageProxyUrl()
* @method \Closure getFilterImageProxyCallback() * @method \Closure getFilterImageProxyCallback()
* @method string getFilterImageProxyProtocol() * @method string getFilterImageProxyProtocol()
* @method array getAdditionalCurlOptions()
*/ */
class Config class Config
{ {
@ -92,5 +96,7 @@ class Config
return isset($this->container[$parameter]) ? $this->container[$parameter] : $default_value; return isset($this->container[$parameter]) ? $this->container[$parameter] : $default_value;
} }
return null;
} }
} }

View File

@ -13,10 +13,8 @@ class Filter
* Get the Html filter instance. * Get the Html filter instance.
* *
* @static * @static
*
* @param string $html HTML content * @param string $html HTML content
* @param string $website Site URL (used to build absolute URL) * @param string $website Site URL (used to build absolute URL)
*
* @return Html * @return Html
*/ */
public static function html($html, $website) public static function html($html, $website)
@ -30,7 +28,7 @@ class Filter
* Escape HTML content. * Escape HTML content.
* *
* @static * @static
* * @param string $content
* @return string * @return string
*/ */
public static function escape($content) public static function escape($content)
@ -42,7 +40,6 @@ class Filter
* Remove HTML tags. * Remove HTML tags.
* *
* @param string $data Input data * @param string $data Input data
*
* @return string * @return string
*/ */
public function removeHTMLTags($data) public function removeHTMLTags($data)
@ -54,9 +51,7 @@ class Filter
* Remove the XML tag from a document. * Remove the XML tag from a document.
* *
* @static * @static
*
* @param string $data Input data * @param string $data Input data
*
* @return string * @return string
*/ */
public static function stripXmlTag($data) public static function stripXmlTag($data)
@ -80,9 +75,7 @@ class Filter
* Strip head tag from the HTML content. * Strip head tag from the HTML content.
* *
* @static * @static
*
* @param string $data Input data * @param string $data Input data
*
* @return string * @return string
*/ */
public static function stripHeadTags($data) public static function stripHeadTags($data)
@ -94,9 +87,7 @@ class Filter
* Trim whitespace from the begining, the end and inside a string and don't break utf-8 string. * Trim whitespace from the begining, the end and inside a string and don't break utf-8 string.
* *
* @static * @static
*
* @param string $value Raw data * @param string $value Raw data
*
* @return string Normalized data * @return string Normalized data
*/ */
public static function stripWhiteSpace($value) public static function stripWhiteSpace($value)
@ -112,9 +103,7 @@ class Filter
* Fixes before XML parsing. * Fixes before XML parsing.
* *
* @static * @static
*
* @param string $data Raw data * @param string $data Raw data
*
* @return string Normalized data * @return string Normalized data
*/ */
public static function normalizeData($data) public static function normalizeData($data)

View File

@ -90,7 +90,6 @@ class Html
* Set config object. * Set config object.
* *
* @param \PicoFeed\Config\Config $config Config instance * @param \PicoFeed\Config\Config $config Config instance
*
* @return \PicoFeed\Filter\Html * @return \PicoFeed\Filter\Html
*/ */
public function setConfig($config) public function setConfig($config)
@ -160,7 +159,8 @@ class Html
/** /**
* Called after XML parsing. * Called after XML parsing.
* *
* @param string $content the content that should be filtered * @param string $content
* @return string
*/ */
public function filterRules($content) public function filterRules($content)
{ {

View File

@ -77,7 +77,6 @@ class Tag extends Base
* *
* @param string $tag Tag name * @param string $tag Tag name
* @param array $attributes Attributes dictionary * @param array $attributes Attributes dictionary
*
* @return bool * @return bool
*/ */
public function isAllowed($tag, array $attributes) public function isAllowed($tag, array $attributes)
@ -90,7 +89,6 @@ class Tag extends Base
* *
* @param string $tag Tag name * @param string $tag Tag name
* @param string $attributes Attributes converted in html * @param string $attributes Attributes converted in html
*
* @return string * @return string
*/ */
public function openHtmlTag($tag, $attributes = '') public function openHtmlTag($tag, $attributes = '')
@ -102,7 +100,6 @@ class Tag extends Base
* Return the HTML closing tag. * Return the HTML closing tag.
* *
* @param string $tag Tag name * @param string $tag Tag name
*
* @return string * @return string
*/ */
public function closeHtmlTag($tag) public function closeHtmlTag($tag)
@ -114,7 +111,6 @@ class Tag extends Base
* Return true is the tag is self-closing. * Return true is the tag is self-closing.
* *
* @param string $tag Tag name * @param string $tag Tag name
*
* @return bool * @return bool
*/ */
public function isSelfClosingTag($tag) public function isSelfClosingTag($tag)
@ -126,7 +122,6 @@ class Tag extends Base
* Check if a tag is on the whitelist. * Check if a tag is on the whitelist.
* *
* @param string $tag Tag name * @param string $tag Tag name
*
* @return bool * @return bool
*/ */
public function isAllowedTag($tag) public function isAllowedTag($tag)
@ -142,7 +137,6 @@ class Tag extends Base
* *
* @param string $tag Tag name * @param string $tag Tag name
* @param array $attributes Tag attributes * @param array $attributes Tag attributes
*
* @return bool * @return bool
*/ */
public function isPixelTracker($tag, array $attributes) public function isPixelTracker($tag, array $attributes)
@ -156,7 +150,6 @@ class Tag extends Base
* Remove script tags. * Remove script tags.
* *
* @param string $data Input data * @param string $data Input data
*
* @return string * @return string
*/ */
public function removeBlacklistedTags($data) public function removeBlacklistedTags($data)
@ -182,7 +175,6 @@ class Tag extends Base
* Remove empty tags. * Remove empty tags.
* *
* @param string $data Input data * @param string $data Input data
*
* @return string * @return string
*/ */
public function removeEmptyTags($data) public function removeEmptyTags($data)
@ -194,7 +186,6 @@ class Tag extends Base
* Replace <br/><br/> by only one. * Replace <br/><br/> by only one.
* *
* @param string $data Input data * @param string $data Input data
*
* @return string * @return string
*/ */
public function removeMultipleBreakTags($data) public function removeMultipleBreakTags($data)
@ -206,7 +197,6 @@ class Tag extends Base
* Set whitelisted tags adn attributes for each tag. * Set whitelisted tags adn attributes for each tag.
* *
* @param array $values List of tags: ['video' => ['src', 'cover'], 'img' => ['src']] * @param array $values List of tags: ['video' => ['src', 'cover'], 'img' => ['src']]
*
* @return Tag * @return Tag
*/ */
public function setWhitelistedTags(array $values) public function setWhitelistedTags(array $values)

View File

@ -25,8 +25,7 @@ class Atom extends Parser
* Get the path to the items XML tree. * Get the path to the items XML tree.
* *
* @param SimpleXMLElement $xml Feed xml * @param SimpleXMLElement $xml Feed xml
* * @return SimpleXMLElement[]
* @return SimpleXMLElement
*/ */
public function getItemsTree(SimpleXMLElement $xml) public function getItemsTree(SimpleXMLElement $xml)
{ {
@ -307,7 +306,6 @@ class Atom extends Parser
* *
* @param SimpleXMLElement $xml XML tag * @param SimpleXMLElement $xml XML tag
* @param string $rel Link relationship: alternate, enclosure, related, self, via * @param string $rel Link relationship: alternate, enclosure, related, self, via
*
* @return string * @return string
*/ */
private function getUrl(SimpleXMLElement $xml, $rel, $fallback = false) private function getUrl(SimpleXMLElement $xml, $rel, $fallback = false)
@ -331,7 +329,6 @@ class Atom extends Parser
* *
* @param SimpleXMLElement $xml XML tag * @param SimpleXMLElement $xml XML tag
* @param string $rel Link relationship: alternate, enclosure, related, self, via * @param string $rel Link relationship: alternate, enclosure, related, self, via
*
* @return SimpleXMLElement|null * @return SimpleXMLElement|null
*/ */
private function findLink(SimpleXMLElement $xml, $rel) private function findLink(SimpleXMLElement $xml, $rel)
@ -352,7 +349,6 @@ class Atom extends Parser
* Get the entry content. * Get the entry content.
* *
* @param SimpleXMLElement $entry XML Entry * @param SimpleXMLElement $entry XML Entry
*
* @return string * @return string
*/ */
private function getContent(SimpleXMLElement $entry) private function getContent(SimpleXMLElement $entry)

View File

@ -318,7 +318,7 @@ class Item
/** /**
* Get categories. * Get categories.
* *
* @return string * @return array
*/ */
public function getCategories() public function getCategories()
{ {
@ -468,7 +468,7 @@ class Item
/** /**
* Set item categories from xml. * Set item categories from xml.
* *
* @param SimpleXMLElement[] $categories * @param |SimpleXMLElement[] $categories
* @return Item * @return Item
*/ */
public function setCategoriesFromXml($categories) public function setCategoriesFromXml($categories)
@ -482,9 +482,8 @@ class Item
$categories $categories
) )
); );
} else {
$categories = array();
} }
return $this; return $this;
} }

View File

@ -103,8 +103,8 @@ abstract class Parser implements ParserInterface
/** /**
* Parse the document. * Parse the document.
* * @return Feed
* @return \PicoFeed\Parser\Feed * @throws MalformedXmlException
*/ */
public function execute() public function execute()
{ {
@ -279,9 +279,7 @@ abstract class Parser implements ParserInterface
* Return true if the given language is "Right to Left". * Return true if the given language is "Right to Left".
* *
* @static * @static
*
* @param string $language Language: fr-FR, en-US * @param string $language Language: fr-FR, en-US
*
* @return bool * @return bool
*/ */
public static function isLanguageRTL($language) public static function isLanguageRTL($language)
@ -324,7 +322,6 @@ abstract class Parser implements ParserInterface
* Set config object. * Set config object.
* *
* @param \PicoFeed\Config\Config $config Config instance * @param \PicoFeed\Config\Config $config Config instance
*
* @return \PicoFeed\Parser\Parser * @return \PicoFeed\Parser\Parser
*/ */
public function setConfig($config) public function setConfig($config)
@ -352,7 +349,6 @@ abstract class Parser implements ParserInterface
* scraped * scraped
* @param null|\Closure $scraperCallback Callback function that gets called for each * @param null|\Closure $scraperCallback Callback function that gets called for each
* scraper execution * scraper execution
*
* @return \PicoFeed\Parser\Parser * @return \PicoFeed\Parser\Parser
*/ */
public function enableContentGrabber($needsRuleFile = false, $scraperCallback = null) public function enableContentGrabber($needsRuleFile = false, $scraperCallback = null)
@ -375,7 +371,6 @@ abstract class Parser implements ParserInterface
* Set ignored URLs for the content grabber. * Set ignored URLs for the content grabber.
* *
* @param array $urls URLs * @param array $urls URLs
*
* @return \PicoFeed\Parser\Parser * @return \PicoFeed\Parser\Parser
*/ */
public function setGrabberIgnoreUrls(array $urls) public function setGrabberIgnoreUrls(array $urls)
@ -388,7 +383,6 @@ abstract class Parser implements ParserInterface
* Register all supported namespaces to be used within an xpath query. * Register all supported namespaces to be used within an xpath query.
* *
* @param SimpleXMLElement $xml Feed xml * @param SimpleXMLElement $xml Feed xml
*
* @return SimpleXMLElement * @return SimpleXMLElement
*/ */
public function registerSupportedNamespaces(SimpleXMLElement $xml) public function registerSupportedNamespaces(SimpleXMLElement $xml)
@ -399,6 +393,4 @@ abstract class Parser implements ParserInterface
return $xml; return $xml;
} }
} }

View File

@ -27,8 +27,7 @@ class Rss10 extends Parser
* Get the path to the items XML tree. * Get the path to the items XML tree.
* *
* @param SimpleXMLElement $xml Feed xml * @param SimpleXMLElement $xml Feed xml
* * @return SimpleXMLElement[]
* @return SimpleXMLElement
*/ */
public function getItemsTree(SimpleXMLElement $xml) public function getItemsTree(SimpleXMLElement $xml)
{ {

View File

@ -28,8 +28,7 @@ class Rss20 extends Parser
* Get the path to the items XML tree. * Get the path to the items XML tree.
* *
* @param SimpleXMLElement $xml Feed xml * @param SimpleXMLElement $xml Feed xml
* * @return SimpleXMLElement[]
* @return SimpleXMLElement
*/ */
public function getItemsTree(SimpleXMLElement $xml) public function getItemsTree(SimpleXMLElement $xml)
{ {
@ -315,5 +314,4 @@ class Rss20 extends Parser
$categories = XmlParser::getXPathResult($entry, 'category'); $categories = XmlParser::getXPathResult($entry, 'category');
$item->setCategoriesFromXml($categories); $item->setCategoriesFromXml($categories);
} }
} }

View File

@ -34,7 +34,7 @@ class XmlParser
* *
* @static * @static
* @param string $input XML content * @param string $input XML content
* @return DOMDocument * @return DOMDocument|bool
*/ */
public static function getDomDocument($input) public static function getDomDocument($input)
{ {

View File

@ -33,5 +33,7 @@ class ContentFilterProcessor extends Base implements ItemProcessorInterface
} else { } else {
Logger::setMessage(get_called_class().': Content filtering disabled'); Logger::setMessage(get_called_class().': Content filtering disabled');
} }
return false;
} }
} }

View File

@ -72,7 +72,7 @@ class ItemPostProcessor extends Base
} }
/** /**
* Checks wheather a specific processor is registered or not * Checks whether a specific processor is registered or not
* *
* @access public * @access public
* @param string $class * @param string $class

View File

@ -127,11 +127,11 @@ class Reader extends Base
/** /**
* Get a parser instance. * Get a parser instance.
* *
* @param string $url Site url * @param string $url Site url
* @param string $content Feed content * @param string $content Feed content
* @param string $encoding HTTP encoding * @param string $encoding HTTP encoding
*
* @return \PicoFeed\Parser\Parser * @return \PicoFeed\Parser\Parser
* @throws UnsupportedFeedFormatException
*/ */
public function getParser($url, $content, $encoding) public function getParser($url, $content, $encoding)
{ {
@ -154,7 +154,6 @@ class Reader extends Base
* Detect the feed format. * Detect the feed format.
* *
* @param string $content Feed content * @param string $content Feed content
*
* @return string * @return string
*/ */
public function detectFormat($content) public function detectFormat($content)
@ -177,7 +176,7 @@ class Reader extends Base
* Add the prefix "http://" if the end-user just enter a domain name. * Add the prefix "http://" if the end-user just enter a domain name.
* *
* @param string $url Url * @param string $url Url
* @retunr string * @return string
*/ */
public function prependScheme($url) public function prependScheme($url)
{ {

View File

@ -181,7 +181,6 @@ class CandidateParser implements ParserInterface
* Strip useless tags. * Strip useless tags.
* *
* @param string $content * @param string $content
*
* @return string * @return string
*/ */
public function stripGarbage($content) public function stripGarbage($content)
@ -257,8 +256,7 @@ class CandidateParser implements ParserInterface
* Return false if the node should not be removed. * Return false if the node should not be removed.
* *
* @param DomDocument $dom * @param DomDocument $dom
* @param DomNode $node * @param \DomNode $node
*
* @return bool * @return bool
*/ */
public function shouldRemove(DomDocument $dom, $node) public function shouldRemove(DomDocument $dom, $node)

View File

@ -17,7 +17,6 @@ class RuleLoader extends Base
* Get the rules for an URL. * Get the rules for an URL.
* *
* @param string $url the URL that should be looked up * @param string $url the URL that should be looked up
*
* @return array the array containing the rules * @return array the array containing the rules
*/ */
public function getRules($url) public function getRules($url)
@ -43,7 +42,6 @@ class RuleLoader extends Base
* Get the list of possible rules file names for a given hostname. * Get the list of possible rules file names for a given hostname.
* *
* @param string $hostname Hostname * @param string $hostname Hostname
*
* @return array * @return array
*/ */
public function getRulesFileList($hostname) public function getRulesFileList($hostname)
@ -70,7 +68,6 @@ class RuleLoader extends Base
* *
* @param string $folder Rule directory * @param string $folder Rule directory
* @param array $files List of possible file names * @param array $files List of possible file names
*
* @return array * @return array
*/ */
public function loadRuleFile($folder, array $files) public function loadRuleFile($folder, array $files)

View File

@ -205,6 +205,9 @@ class Scraper extends Base
/** /**
* Execute the scraper. * Execute the scraper.
*
* @param string $pageContent
* @param int $recursionDepth
*/ */
public function execute($pageContent = '', $recursionDepth = 0) public function execute($pageContent = '', $recursionDepth = 0)
{ {