PHP Class Neos\Fusion\Core\Parser

Inheritance: implements Neos\Fusion\Core\ParserInterface
Afficher le fichier Open project: neos/neos-development-collection Class Usage Examples

Méthodes publiques

Свойство Type Description
$reservedParseTreeKeys array Reserved parse tree keys for internal usage.

Protected Properties

Свойство Type Description
$contextPathAndFilename string An optional context path which is used as a prefix for inclusion of further TypoScript files
$currentBlockCommentState boolean Determines if a block comment is currently active or not.
$currentLineNumber integer The line number which is currently processed
$currentObjectPathStack array The current object path context as defined by confinements.
$currentSourceCodeLines array An array of strings of the source code which has
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
$objectTree array The TypoScript object tree, created by this parser.
$objectTypeNamespaces array By convention, the namespace should be a package key, but other strings would be possible, too. Note that, in order to resolve an object type, a prototype with that namespace and name must be defined elsewhere. These namespaces are _not_ used for resolution of processor class names.

Méthodes publiques

Méthode Description
parse ( string $sourceCode, string $contextPathAndFilename = null, array $objectTreeUntilNow = [], boolean $buildPrototypeHierarchy = true ) : array Parses the given TypoScript source code and returns an object tree as the result.
setObjectTypeNamespace ( string $alias, string $namespace ) : void Sets the given alias to the specified namespace.

Méthodes protégées

Méthode Description
buildPrototypeHierarchy ( ) : void Precalculate merged configuration for inherited prototypes.
getCurrentObjectPathPrefix ( ) : string Returns the first part of an object path from the current object path stack which can be used to prefix a relative object path.
getNextTypoScriptLine ( ) : string Get the next, unparsed line of TypoScript from this->currentSourceCodeLines and increase the pointer
getParsedObjectPath ( string $objectPath ) : array Parse an object path specified as a string and returns an array.
getProcessedValue ( string $unparsedValue ) : mixed Parses the given value (which may be a literal, variable or object type) and returns the evaluated result, including variables replaced by their actual value.
getValueFromObjectTree ( array $objectPathArray, array &$objectTree = null ) : mixed Retrieves a value from a node in the object tree, specified by the object path array.
initialize ( ) : void Initializes the TypoScript parser
parseComment ( string $typoScriptLine ) : void Parses a line with comments or a line while parsing is in block comment mode.
parseConfinementBlock ( string $typoScriptLine, boolean $isOpeningConfinement ) : void Parses a line which opens or closes a confinement
parseDeclaration ( string $typoScriptLine ) : void Parses a parser declaration of the form "declarationtype: declaration".
parseInclude ( string $include ) : void Parse an include file. Currently, we start a new parser object; but we could as well re-use the given one.
parseNamespaceDeclaration ( string $namespaceDeclaration ) : void Parses a namespace declaration and stores the result in the namespace registry.
parseObjectDefinition ( string $typoScriptLine ) : void Parses an object definition.
parseTypoScriptLine ( string $typoScriptLine ) : void Parses one line of TypoScript
parseValueAssignment ( string $objectPath, string $value ) : void Parses a value operation of the type "assignment".
parseValueCopy ( string $sourceObjectPath, string $targetObjectPath ) : void Copies the object or value specified by sourcObjectPath and assigns it to targetObjectPath.
parseValueUnAssignment ( string $objectPath ) : void Unsets the object, property or variable specified by the object path.
setValueInObjectTree ( array $objectPathArray, mixed $value, array &$objectTree = null ) : array Assigns a value to a node or a property in the object tree, specified by the object path array.
unquoteString ( string $quotedValue ) : string Removes escapings from a given argument string and trims the outermost quotes.

Method Details

buildPrototypeHierarchy() protected méthode

Precalculate merged configuration for inherited prototypes.
protected buildPrototypeHierarchy ( ) : void
Résultat void

getCurrentObjectPathPrefix() protected méthode

Returns the first part of an object path from the current object path stack which can be used to prefix a relative object path.
protected getCurrentObjectPathPrefix ( ) : string
Résultat string A part of an object path, ready to use as a prefix

getNextTypoScriptLine() protected méthode

Get the next, unparsed line of TypoScript from this->currentSourceCodeLines and increase the pointer
protected getNextTypoScriptLine ( ) : string
Résultat string next line of typoscript to parse

getParsedObjectPath() protected méthode

Parse an object path specified as a string and returns an array.
protected getParsedObjectPath ( string $objectPath ) : array
$objectPath string The object path to parse
Résultat array An object path array

getProcessedValue() protected méthode

Parses the given value (which may be a literal, variable or object type) and returns the evaluated result, including variables replaced by their actual value.
protected getProcessedValue ( string $unparsedValue ) : mixed
$unparsedValue string The unparsed value
Résultat mixed The processed value

getValueFromObjectTree() protected méthode

Retrieves a value from a node in the object tree, specified by the object path array.
protected getValueFromObjectTree ( array $objectPathArray, array &$objectTree = null ) : mixed
$objectPathArray array The object path, specifying the node to retrieve the value of
$objectTree array The current (sub-) tree, used internally - don't specify!
Résultat mixed The value

initialize() protected méthode

Initializes the TypoScript parser
protected initialize ( ) : void
Résultat void

parse() public méthode

Parses the given TypoScript source code and returns an object tree as the result.
public parse ( string $sourceCode, string $contextPathAndFilename = null, array $objectTreeUntilNow = [], boolean $buildPrototypeHierarchy = true ) : array
$sourceCode string The TypoScript source code to parse
$contextPathAndFilename string An optional path and filename to use as a prefix for inclusion of further TypoScript files
$objectTreeUntilNow array Used internally for keeping track of the built object tree
$buildPrototypeHierarchy boolean Merge prototype configurations or not. Will be FALSE for includes to only do that once at the end.
Résultat array A TypoScript object tree, generated from the source code

parseComment() protected méthode

Parses a line with comments or a line while parsing is in block comment mode.
protected parseComment ( string $typoScriptLine ) : void
$typoScriptLine string One line of TypoScript code
Résultat void

parseConfinementBlock() protected méthode

Parses a line which opens or closes a confinement
protected parseConfinementBlock ( string $typoScriptLine, boolean $isOpeningConfinement ) : void
$typoScriptLine string One line of TypoScript code
$isOpeningConfinement boolean Set to TRUE, if an opening confinement is to be parsed and FALSE if it's a closing confinement.
Résultat void

parseDeclaration() protected méthode

Parses a parser declaration of the form "declarationtype: declaration".
protected parseDeclaration ( string $typoScriptLine ) : void
$typoScriptLine string One line of TypoScript code
Résultat void

parseInclude() protected méthode

Parse an include file. Currently, we start a new parser object; but we could as well re-use the given one.
protected parseInclude ( string $include ) : void
$include string The include value, for example " FooBar" or " resource://....". Can also include wildcard mask for TypoScript globbing.
Résultat void

parseNamespaceDeclaration() protected méthode

Parses a namespace declaration and stores the result in the namespace registry.
protected parseNamespaceDeclaration ( string $namespaceDeclaration ) : void
$namespaceDeclaration string The namespace declaration, for example "neos = Neos.Neos"
Résultat void

parseObjectDefinition() protected méthode

Parses an object definition.
protected parseObjectDefinition ( string $typoScriptLine ) : void
$typoScriptLine string One line of TypoScript code
Résultat void

parseTypoScriptLine() protected méthode

Parses one line of TypoScript
protected parseTypoScriptLine ( string $typoScriptLine ) : void
$typoScriptLine string One line of TypoScript code
Résultat void

parseValueAssignment() protected méthode

Parses a value operation of the type "assignment".
protected parseValueAssignment ( string $objectPath, string $value ) : void
$objectPath string The object path as a string
$value string The unparsed value as a string
Résultat void

parseValueCopy() protected méthode

Copies the object or value specified by sourcObjectPath and assigns it to targetObjectPath.
protected parseValueCopy ( string $sourceObjectPath, string $targetObjectPath ) : void
$sourceObjectPath string Specifies the location in the object tree from where the object or value will be taken
$targetObjectPath string Specifies the location in the object tree where the copy will be stored
Résultat void

parseValueUnAssignment() protected méthode

Unsets the object, property or variable specified by the object path.
protected parseValueUnAssignment ( string $objectPath ) : void
$objectPath string The object path as a string
Résultat void

setObjectTypeNamespace() public méthode

The namespaces defined through this setter or through a "namespace" declaration in one of the TypoScripts are used to resolve a fully qualified TypoScript object name while parsing TypoScript code. The alias is the handle by wich the namespace can be referred to. The namespace is, by convention, a package key which must correspond to a namespace used in the prototype definitions for TypoScript object types. The special alias "default" is used as a fallback for resolution of unqualified TypoScript object types.
public setObjectTypeNamespace ( string $alias, string $namespace ) : void
$alias string An alias for the given namespace, for example "neos"
$namespace string The namespace, for example "Neos.Neos"
Résultat void

setValueInObjectTree() protected méthode

Assigns a value to a node or a property in the object tree, specified by the object path array.
protected setValueInObjectTree ( array $objectPathArray, mixed $value, array &$objectTree = null ) : array
$objectPathArray array The object path, specifying the node / property to set
$value mixed The value to assign, is a non-array type or an array with __eelExpression etc.
$objectTree array The current (sub-) tree, used internally - don't specify!
Résultat array The modified object tree

unquoteString() protected méthode

This method is meant as a helper for regular expression results.
protected unquoteString ( string $quotedValue ) : string
$quotedValue string Value to unquote
Résultat string Unquoted value

Property Details

$contextPathAndFilename protected_oe property

An optional context path which is used as a prefix for inclusion of further TypoScript files
protected string $contextPathAndFilename
Résultat string

$currentBlockCommentState protected_oe property

Determines if a block comment is currently active or not.
protected bool $currentBlockCommentState
Résultat boolean

$currentLineNumber protected_oe property

The line number which is currently processed
protected int $currentLineNumber
Résultat integer

$currentObjectPathStack protected_oe property

The current object path context as defined by confinements.
protected array $currentObjectPathStack
Résultat array

$currentSourceCodeLines protected_oe property

An array of strings of the source code which has
protected array $currentSourceCodeLines
Résultat array

$objectManager protected_oe property

protected ObjectManagerInterface,Neos\Flow\ObjectManagement $objectManager
Résultat Neos\Flow\ObjectManagement\ObjectManagerInterface

$objectTree protected_oe property

The TypoScript object tree, created by this parser.
protected array $objectTree
Résultat array

$objectTypeNamespaces protected_oe property

By convention, the namespace should be a package key, but other strings would be possible, too. Note that, in order to resolve an object type, a prototype with that namespace and name must be defined elsewhere. These namespaces are _not_ used for resolution of processor class names.
protected array $objectTypeNamespaces
Résultat array

$reservedParseTreeKeys public_oe static_oe property

Reserved parse tree keys for internal usage.
public static array $reservedParseTreeKeys
Résultat array