PHP Class Prewk\XmlStringStreamer\Parser\UniqueNode

Inheritance: implements Prewk\XmlStringStreamer\ParserInterface
Afficher le fichier Open project: prewk/xml-string-streamer Class Usage Examples

Protected Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
__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

Méthodes protégées

Méthode Description
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

Private Methods

Méthode Description
checkShortClosingTag ( string $workingBlob, integer $len ) : boolean | integer Search short closing tag in $workingBlob before

Method Details

__construct() public méthode

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

flush() protected méthode

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() protected méthode

Search the blob for our unique node's closing tag
protected getClosingTagPos ( ) : boolean | integer
Résultat boolean | integer Either returns the char position of the closing tag or false

getExtractedContainer() public méthode

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
Résultat string XML string

getNodeFrom() public méthode

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
Résultat string | boolean The next xml node or false if one could not be retrieved

getOpeningTagPos() protected méthode

Search the blob for our unique node's opening tag
protected getOpeningTagPos ( ) : boolean | integer
Résultat boolean | integer Either returns the char position of the opening tag or false

prepareChunk() protected méthode

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
Résultat boolean Keep working?

startSalvaging() protected méthode

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

Property Details

$containerXml protected_oe property

If extractContainer is true, this will grow with the XML captured before and after the specified capture depth
protected string $containerXml
Résultat string

$preCapture protected_oe property

Whether we're found our first capture target or not
protected bool $preCapture
Résultat boolean