Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Tout Structures de données Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe Parser

Fonctions membres publiques

 parseFile (string $filename, int $flags=0)
 
 parse (string $value, int $flags=0)
 
 getRealCurrentLineNb ()
 

Fonctions membres publiques statiques

static preg_match (string $pattern, string $subject, array &$matches=null, int $flags=0, int $offset=0)
 

Champs de données

const TAG_PATTERN = '(?P<tag>![\w!.\/:-]+)'
 
const BLOCK_SCALAR_HEADER_PATTERN = '(?P<separator>\||>)(?P<modifiers>\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P<comments> +#.*)?'
 
const REFERENCE_PATTERN = '#^&(?P<ref>[^ ]++) *+(?P<value>.*)#u'
 

Fonctions membres privées

 doParse (string $value, int $flags)
 
 parseBlock (int $offset, string $yaml, int $flags)
 
 getCurrentLineIndentation ()
 
 getNextEmbedBlock (int $indentation=null, bool $inSequence=false)
 
 hasMoreLines ()
 
 moveToNextLine ()
 
 moveToPreviousLine ()
 
 parseValue (string $value, int $flags, string $context)
 
 parseBlockScalar (string $style, string $chomping='', int $indentation=0)
 
 isNextLineIndented ()
 
 isCurrentLineEmpty ()
 
 isCurrentLineBlank ()
 
 isCurrentLineComment ()
 
 isCurrentLineLastLineInDocument ()
 
 cleanup (string $value)
 
 isNextLineUnIndentedCollection ()
 
 isStringUnIndentedCollectionItem ()
 
 trimTag (string $value)
 
 getLineTag (string $value, int $flags, bool $nextLineCheck=true)
 
 lexInlineQuotedString (int &$cursor=0)
 
 lexUnquotedString (int &$cursor)
 
 lexInlineMapping (int &$cursor=0)
 
 lexInlineSequence (int &$cursor=0)
 
 lexInlineStructure (int &$cursor, string $closingTag)
 
 consumeWhitespaces (int &$cursor)
 

Attributs privés

 $filename
 
 $offset = 0
 
 $numberOfParsedLines = 0
 
 $totalNumberOfLines
 
 $lines = []
 
 $currentLineNb = -1
 
 $currentLine = ''
 
 $refs = []
 
 $skippedLineNumbers = []
 
 $locallySkippedLineNumbers = []
 
 $refsBeingParsed = []
 

Description détaillée

Parser parses YAML strings to convert them to PHP arrays.

Auteur
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Documentation des fonctions membres

◆ cleanup()

cleanup ( string  $value)
private

Cleanups a YAML string to be parsed.

Paramètres
string$valueThe input YAML string

Références $count, $value, et Joomla\Database\Query\offset().

Référencé par Parser\doParse().

◆ consumeWhitespaces()

consumeWhitespaces ( int &  $cursor)
private

◆ doParse()

◆ getCurrentLineIndentation()

getCurrentLineIndentation ( )
private

◆ getLineTag()

getLineTag ( string  $value,
int  $flags,
bool  $nextLineCheck = true 
)
private

◆ getNextEmbedBlock()

getNextEmbedBlock ( int  $indentation = null,
bool  $inSequence = false 
)
private

Returns the next embed block of YAML.

Paramètres
int | null$indentationThe indent level at which the block is to be read, or null for default
bool$inSequenceTrue if the enclosing data structure is a sequence
Exceptions
ParseExceptionWhen indentation problem are detected

Références Parser\$currentLine, $data, $i, elseif, Parser\getCurrentLineIndentation(), Parser\getRealCurrentLineNb(), Parser\isCurrentLineBlank(), Parser\isCurrentLineComment(), Parser\isCurrentLineEmpty(), Parser\isStringUnIndentedCollectionItem(), Parser\moveToNextLine(), Parser\moveToPreviousLine(), et null.

Référencé par Parser\doParse().

◆ getRealCurrentLineNb()

getRealCurrentLineNb ( )

Returns the current line number (takes the offset into account).

Références Parser\$offset.

Référencé par Parser\doParse(), Parser\getLineTag(), Parser\getNextEmbedBlock(), et Parser\parseValue().

◆ hasMoreLines()

◆ isCurrentLineBlank()

isCurrentLineBlank ( )
private

Returns true if the current line is blank.

Référencé par Parser\getNextEmbedBlock(), Parser\isCurrentLineEmpty(), Parser\lexInlineQuotedString(), et Parser\parseBlockScalar().

◆ isCurrentLineComment()

isCurrentLineComment ( )
private

Returns true if the current line is a comment line.

Références Parser\$currentLine.

Référencé par Parser\getNextEmbedBlock(), Parser\isCurrentLineEmpty(), Parser\isNextLineIndented(), et Parser\isNextLineUnIndentedCollection().

◆ isCurrentLineEmpty()

isCurrentLineEmpty ( )
private

Returns true if the current line is blank or if it is a comment line.

Références Parser\isCurrentLineBlank(), et Parser\isCurrentLineComment().

Référencé par Parser\doParse(), Parser\getNextEmbedBlock(), Parser\isNextLineIndented(), et Parser\isNextLineUnIndentedCollection().

◆ isCurrentLineLastLineInDocument()

isCurrentLineLastLineInDocument ( )
private

◆ isNextLineIndented()

isNextLineIndented ( )
private

◆ isNextLineUnIndentedCollection()

isNextLineUnIndentedCollection ( )
private

◆ isStringUnIndentedCollectionItem()

isStringUnIndentedCollectionItem ( )
private

Returns true if the string is un-indented collection item.

Référencé par Parser\getNextEmbedBlock(), et Parser\isNextLineUnIndentedCollection().

◆ lexInlineMapping()

lexInlineMapping ( int &  $cursor = 0)
private

◆ lexInlineQuotedString()

lexInlineQuotedString ( int &  $cursor = 0)
private

◆ lexInlineSequence()

lexInlineSequence ( int &  $cursor = 0)
private

◆ lexInlineStructure()

◆ lexUnquotedString()

lexUnquotedString ( int &  $cursor)
private

Références Parser\$offset.

Référencé par Parser\lexInlineStructure().

◆ moveToNextLine()

◆ moveToPreviousLine()

moveToPreviousLine ( )
private

◆ parse()

parse ( string  $value,
int  $flags = 0 
)

Parses a YAML string to a PHP value.

Paramètres
string$valueA YAML string
int$flagsA bit field of PARSE_* constants to customize the YAML parser behavior
Renvoie
mixed
Exceptions
ParseExceptionIf the YAML is not valid

Références $data, $value, Parser\doParse(), null, Joomla\Database\Query\offset(), et Parser\preg_match().

Référencé par Parser\parseFile().

◆ parseBlock()

parseBlock ( int  $offset,
string  $yaml,
int  $flags 
)
private

◆ parseBlockScalar()

parseBlockScalar ( string  $style,
string  $chomping = '',
int  $indentation = 0 
)
private

Parses a block scalar.

Paramètres
string$styleThe style indicator that was used to begin this block scalar (| or >)
string$chompingThe chomping indicator that was used to begin this block scalar (+ or -)
int$indentationThe indentation indicator that was used to begin this block scalar

Références $i, $style, $text, elseif, Parser\isCurrentLineBlank(), Parser\isCurrentLineLastLineInDocument(), Parser\moveToNextLine(), et Parser\moveToPreviousLine().

Référencé par Parser\parseValue().

◆ parseFile()

parseFile ( string  $filename,
int  $flags = 0 
)

Parses a YAML file into a PHP value.

Paramètres
string$filenameThe path to the YAML file to be parsed
int$flagsA bit field of PARSE_* constants to customize the YAML parser behavior
Renvoie
mixed
Exceptions
ParseExceptionIf the file could not be read or the YAML is not valid

Références Parser\$filename, null, et Parser\parse().

◆ parseValue()

parseValue ( string  $value,
int  $flags,
string  $context 
)
private

Parses a YAML value.

Paramètres
string$valueA YAML value
int$flagsA bit field of PARSE_* constants to customize the YAML parser behavior
string$contextThe parser context (either sequence or mapping)
Renvoie
mixed
Exceptions
ParseExceptionWhen reference does not exist

Références $context, $data, $i, Parser\$lines, Inline\$parsedLineNumber, $value, elseif, Inline\evaluateBinaryScalar(), Parser\getCurrentLineIndentation(), Parser\getRealCurrentLineNb(), Parser\lexInlineMapping(), Parser\lexInlineQuotedString(), Parser\lexInlineSequence(), Parser\moveToNextLine(), Parser\moveToPreviousLine(), Inline\parse(), Parser\parseBlockScalar(), ParseException\setParsedLine(), et ParseException\setSnippet().

Référencé par Parser\doParse().

◆ preg_match()

static preg_match ( string  $pattern,
string  $subject,
array &  $matches = null,
int  $flags = 0,
int  $offset = 0 
)
static

A local wrapper for "preg_match" which will throw a ParseException if there is an internal error in the PCRE engine.

This avoids us needing to check for "false" every time PCRE is used in the YAML engine

Exceptions
ParseExceptionon a PCRE internal error
Voir également
preg_last_error()

Références Parser\$offset, et $subject.

Référencé par Inline\dump(), Inline\evaluateBinaryScalar(), Inline\evaluateScalar(), Parser\parse(), Inline\parseMapping(), Inline\parseQuotedScalar(), Inline\parseScalar(), et Inline\parseSequence().

◆ trimTag()

trimTag ( string  $value)
private

Trim the tag on top of the value.

Prevent values such as "!foo {quz: bar}" to be considered as a mapping block.

Références $value.

Référencé par Parser\doParse().

Documentation des champs

◆ $currentLine

$currentLine = ''
private

◆ $currentLineNb

$currentLineNb = -1
private

◆ $filename

$filename
private

Référencé par Parser\parseFile().

◆ $lines

$lines = []
private

Référencé par Parser\parseValue().

◆ $locallySkippedLineNumbers

$locallySkippedLineNumbers = []
private

◆ $numberOfParsedLines

$numberOfParsedLines = 0
private

Référencé par Parser\doParse().

◆ $offset

◆ $refs

$refs = []
private

Référencé par Parser\parseBlock().

◆ $refsBeingParsed

$refsBeingParsed = []
private

Référencé par Parser\parseBlock().

◆ $skippedLineNumbers

$skippedLineNumbers = []
private

Référencé par Parser\parseBlock().

◆ $totalNumberOfLines

$totalNumberOfLines
private

Référencé par Parser\parseBlock().

◆ BLOCK_SCALAR_HEADER_PATTERN

const BLOCK_SCALAR_HEADER_PATTERN = '(?P<separator>\||>)(?P<modifiers>\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P<comments> +#.*)?'

◆ REFERENCE_PATTERN

const REFERENCE_PATTERN = '#^&(?P<ref>[^ ]++) *+(?P<value>.*)#u'

◆ TAG_PATTERN

const TAG_PATTERN = '(?P<tag>![\w!.\/:-]+)'

La documentation de cette classe a été générée à partir du fichier suivant :