PHP Класс Prewk\XmlStringStreamer\Parser\UniqueNode

Наследование: implements Prewk\XmlStringStreamer\ParserInterface
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$containerXml string If extractContainer is true, this will grow with the XML captured before and after the specified capture depth
$preCapture boolean Whether we're found our first capture target or not

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

Метод Описание
__construct ( array $options = [] ) Parser constructor
getExtractedContainer ( ) : string Get the extracted container XML, if called before the whole stream is parsed, the XML returned can be invalid due to missing closing tags
getNodeFrom ( Prewk\XmlStringStreamer\StreamInterface $stream ) : string | boolean Tries to retrieve the next node or returns false

Защищенные методы

Метод Описание
flush ( integer $endPositionInBlob ) Cut everything from the start position to the end position in the workingBlob (+ tag length) and flush it out for later return in getNodeFrom
getClosingTagPos ( ) : boolean | integer Search the blob for our unique node's closing tag
getOpeningTagPos ( ) : boolean | integer Search the blob for our unique node's opening tag
prepareChunk ( Prewk\XmlStringStreamer\StreamInterface $stream ) : boolean Decides whether we're to fetch more chunks from the stream or keep working with what we have.
startSalvaging ( integer $startPositionInBlob ) Set the start position in the workingBlob from where we should start reading when the closing tag is found

Приватные методы

Метод Описание
checkShortClosingTag ( string $workingBlob, integer $len ) : boolean | integer Search short closing tag in $workingBlob before

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

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

Parser constructor
public __construct ( array $options = [] )
$options array An options array

flush() защищенный Метод

Cut everything from the start position to the end position in the workingBlob (+ tag length) and flush it out for later return in getNodeFrom
protected flush ( integer $endPositionInBlob )
$endPositionInBlob integer Position of the closing tag

getClosingTagPos() защищенный Метод

Search the blob for our unique node's closing tag
protected getClosingTagPos ( ) : boolean | integer
Результат boolean | integer Either returns the char position of the closing tag or false

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

Get the extracted container XML, if called before the whole stream is parsed, the XML returned can be invalid due to missing closing tags
public getExtractedContainer ( ) : string
Результат string XML string

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

Tries to retrieve the next node or returns false
public getNodeFrom ( Prewk\XmlStringStreamer\StreamInterface $stream ) : string | boolean
$stream Prewk\XmlStringStreamer\StreamInterface The stream to use
Результат string | boolean The next xml node or false if one could not be retrieved

getOpeningTagPos() защищенный Метод

Search the blob for our unique node's opening tag
protected getOpeningTagPos ( ) : boolean | integer
Результат boolean | integer Either returns the char position of the opening tag or false

prepareChunk() защищенный Метод

Decides whether we're to fetch more chunks from the stream or keep working with what we have.
protected prepareChunk ( Prewk\XmlStringStreamer\StreamInterface $stream ) : boolean
$stream Prewk\XmlStringStreamer\StreamInterface The stream provider
Результат boolean Keep working?

startSalvaging() защищенный Метод

Set the start position in the workingBlob from where we should start reading when the closing tag is found
protected startSalvaging ( integer $startPositionInBlob )
$startPositionInBlob integer Position of starting tag

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

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

If extractContainer is true, this will grow with the XML captured before and after the specified capture depth
protected string $containerXml
Результат string

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

Whether we're found our first capture target or not
protected bool $preCapture
Результат boolean