PHP Класс PicoFeed\Parser\Parser

Автор: Frederic Guillot
Наследование: implements PicoFeed\Parser\ParserInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$content string Feed content (XML data).
$fallback_url string Fallback url.
$namespaces array XML namespaces supported by parser.
$used_namespaces array XML namespaces used in document.

Открытые методы

Метод Описание
__construct ( string $content, string $http_encoding = '', string $fallback_url = '' ) Constructor.
checkFeedUrl ( PicoFeed\Parser\Feed $feed ) Check if the feed url is correct.
checkItemUrl ( PicoFeed\Parser\Feed $feed, PicoFeed\Parser\Item $item ) Check if the item url is correct.
checkSiteUrl ( PicoFeed\Parser\Feed $feed ) Check if the site url is correct.
disableContentFiltering ( ) : Parser Enable the content grabber.
enableContentGrabber ( boolean $needsRuleFile = false, null | Closure $scraperCallback = null ) : Parser Enable the content grabber.
execute ( ) : PicoFeed\Parser\Feed Parse the document.
findItemDate ( SimpleXMLElement $entry, PicoFeed\Parser\Item $item, PicoFeed\Parser\Feed $feed ) Find the item date.
generateId ( ) : string Generate a unique id for an entry (hash all arguments).
getDateParser ( ) : PicoFeed\Parser\DateParser Get DateParser instance
getItemPostProcessor ( ) : PicoFeed\Processor\ItemPostProcessor Get Item Post Processor instance
isLanguageRTL ( string $language ) : boolean Return true if the given language is "Right to Left".
registerSupportedNamespaces ( SimpleXMLElement $xml ) : SimpleXMLElement Register all supported namespaces to be used within an xpath query.
setConfig ( PicoFeed\Config\Config $config ) : Parser Set config object.
setGrabberIgnoreUrls ( array $urls ) : Parser Set ignored URLs for the content grabber.
setHashAlgo ( string $algo ) : Parser Set Hash algorithm used for id generation.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( string $content, string $http_encoding = '', string $fallback_url = '' )
$content string Feed content
$http_encoding string HTTP encoding (headers)
$fallback_url string Fallback url when the feed provide relative or broken url

checkFeedUrl() публичный Метод

Check if the feed url is correct.
public checkFeedUrl ( PicoFeed\Parser\Feed $feed )
$feed PicoFeed\Parser\Feed Feed object

checkItemUrl() публичный Метод

Check if the item url is correct.
public checkItemUrl ( PicoFeed\Parser\Feed $feed, PicoFeed\Parser\Item $item )
$feed PicoFeed\Parser\Feed Feed object
$item PicoFeed\Parser\Item Item object

checkSiteUrl() публичный Метод

Check if the site url is correct.
public checkSiteUrl ( PicoFeed\Parser\Feed $feed )
$feed PicoFeed\Parser\Feed Feed object

disableContentFiltering() публичный Метод

Enable the content grabber.
public disableContentFiltering ( ) : Parser
Результат Parser

enableContentGrabber() публичный Метод

Enable the content grabber.
public enableContentGrabber ( boolean $needsRuleFile = false, null | Closure $scraperCallback = null ) : Parser
$needsRuleFile boolean true if only pages with rule files should be scraped
$scraperCallback null | Closure Callback function that gets called for each scraper execution
Результат Parser

execute() публичный Метод

Parse the document.
public execute ( ) : PicoFeed\Parser\Feed
Результат PicoFeed\Parser\Feed

findItemDate() публичный Метод

Find the item date.
public findItemDate ( SimpleXMLElement $entry, PicoFeed\Parser\Item $item, PicoFeed\Parser\Feed $feed )
$entry SimpleXMLElement Feed item
$item PicoFeed\Parser\Item Item object
$feed PicoFeed\Parser\Feed Feed object

generateId() публичный Метод

Generate a unique id for an entry (hash all arguments).
public generateId ( ) : string
Результат string

getDateParser() публичный Метод

Get DateParser instance
public getDateParser ( ) : PicoFeed\Parser\DateParser
Результат PicoFeed\Parser\DateParser

getItemPostProcessor() публичный Метод

Get Item Post Processor instance
public getItemPostProcessor ( ) : PicoFeed\Processor\ItemPostProcessor
Результат PicoFeed\Processor\ItemPostProcessor

isLanguageRTL() публичный статический Метод

Return true if the given language is "Right to Left".
public static isLanguageRTL ( string $language ) : boolean
$language string Language: fr-FR, en-US
Результат boolean

registerSupportedNamespaces() публичный Метод

Register all supported namespaces to be used within an xpath query.
public registerSupportedNamespaces ( SimpleXMLElement $xml ) : SimpleXMLElement
$xml SimpleXMLElement Feed xml
Результат SimpleXMLElement

setConfig() публичный Метод

Set config object.
public setConfig ( PicoFeed\Config\Config $config ) : Parser
$config PicoFeed\Config\Config Config instance
Результат Parser

setGrabberIgnoreUrls() публичный Метод

Set ignored URLs for the content grabber.
public setGrabberIgnoreUrls ( array $urls ) : Parser
$urls array URLs
Результат Parser

setHashAlgo() публичный Метод

Set Hash algorithm used for id generation.
public setHashAlgo ( string $algo ) : Parser
$algo string Algorithm name
Результат Parser

Описание свойств

$content защищенное свойство

Feed content (XML data).
protected string $content
Результат string

$fallback_url защищенное свойство

Fallback url.
protected string $fallback_url
Результат string

$namespaces защищенное свойство

XML namespaces supported by parser.
protected array $namespaces
Результат array

$used_namespaces защищенное свойство

XML namespaces used in document.
protected array $used_namespaces
Результат array