API - XOOPS 2.5.11 Beta 2
By monxoops.fr
Parser Class Reference

Public Member Functions

 __construct ($offset=0, $totalNumberOfLines=null, array $skippedLineNumbers=array())
 
 parse ($value, $exceptionOnInvalidType=false, $objectSupport=false, $objectForMap=false)
 

Static Public Member Functions

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

Data Fields

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

Detailed Description

Parser parses YAML strings to convert them to PHP arrays.

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

Constructor & Destructor Documentation

◆ __construct()

__construct (   $offset = 0,
  $totalNumberOfLines = null,
array  $skippedLineNumbers = array() 
)
Parameters
int$offsetThe offset of YAML document (used for line numbers in error messages)
int | null$totalNumberOfLinesThe overall number of lines being parsed
int[]$skippedLineNumbersNumber of comment lines that have been skipped by the parser

Member Function Documentation

◆ parse()

parse (   $value,
  $exceptionOnInvalidType = false,
  $objectSupport = false,
  $objectForMap = false 
)

Parses a YAML string to a PHP value.

Parameters
string$valueA YAML string
bool$exceptionOnInvalidTypeTrue if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
bool$objectSupportTrue if object support is enabled, false otherwise
bool$objectForMapTrue if maps should return a stdClass instead of array()
Returns
mixed A PHP value
Exceptions
ParseExceptionIf the YAML is not valid
Here is the call graph for this function:

◆ preg_match()

static preg_match (   $pattern,
  $subject,
$matches = null,
  $flags = 0,
  $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
See also
preg_last_error()
Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ BLOCK_SCALAR_HEADER_PATTERN

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

◆ FOLDED_SCALAR_PATTERN

const FOLDED_SCALAR_PATTERN = self::BLOCK_SCALAR_HEADER_PATTERN

The documentation for this class was generated from the following file: