eZPublishCommunityProject  2013.9
eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler Class Reference

Compiles the AST of parsed transformation rules into a set of PCRE replace regular expressions. More...

Public Member Functions

 __construct (Utf8Converter $converter)
 Construct from UTF8Converter. More...
 
 compile (array $ast)
 Compile AST into a set of regular expressions. More...
 

Protected Member Functions

 compileCharacter ($char)
 Compile a single source character definition into a plain UTF-8 character. More...
 
 compileMap (array $rule)
 Compile map rule. More...
 
 compileReplace (array $rule)
 Compile replace rule. More...
 
 compileRule (array $rule)
 Compiles a single rule. More...
 
 compileTargetCharacter ($char)
 Compile target into a closure, which can be used by preg_replace_callback. More...
 
 compileTranspose (array $rule)
 Compile transpose rule. More...
 
 compileTransposeModulo (array $rule)
 Compile transpose modulo rule. More...
 
 getModuloCharRange ($start, $end, $modulo)
 Get string with all characters defined by parameters. More...
 
 getTransposeClosure ($operator, $value)
 Returns a closure which modifies the provided character by the given value. More...
 

Protected Attributes

 $converter
 

Detailed Description

Compiles the AST of parsed transformation rules into a set of PCRE replace regular expressions.

Constructor & Destructor Documentation

eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler::__construct ( Utf8Converter  $converter)

Construct from UTF8Converter.

Parameters
\eZ\Publish\Core\Persistence\Utf8Converter$converter

Member Function Documentation

eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler::compile ( array  $ast)

Compile AST into a set of regular expressions.

The returned array contains a set of regular expressions and their replacement callbacks. The regular expressions can then be applied to strings to executed the transformations.

Parameters
array$ast
Returns
array
eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler::compileCharacter (   $char)
protected
eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler::compileMap ( array  $rule)
protected

Compile map rule.

Parameters
array$rule
Returns
array

Referenced by eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler\compileRule().

eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler::compileReplace ( array  $rule)
protected

Compile replace rule.

Parameters
array$rule
Returns
array

Referenced by eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler\compileRule().

eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler::compileRule ( array  $rule)
protected

Compiles a single rule.

Parameters
array$rule
Returns
array

Referenced by eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler\compile().

eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler::compileTargetCharacter (   $char)
protected

Compile target into a closure, which can be used by preg_replace_callback.

Parameters
string$char
Returns
callback

Referenced by eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler\compileMap(), and eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler\compileReplace().

eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler::compileTranspose ( array  $rule)
protected

Compile transpose rule.

Parameters
array$rule
Returns
array

Referenced by eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler\compileRule().

eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler::compileTransposeModulo ( array  $rule)
protected

Compile transpose modulo rule.

Parameters
array$rule
Returns
array

Referenced by eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler\compileRule().

eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler::getModuloCharRange (   $start,
  $end,
  $modulo 
)
protected

Get string with all characters defined by parameters.

Returns a string containing all UTF-8 characters starting with the specified $start character up to the $end character with the step size defined in $modulo.

Parameters
string$start
string$end
string$modulo
Returns
string

Referenced by eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler\compileTransposeModulo().

eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler::getTransposeClosure (   $operator,
  $value 
)
protected

Returns a closure which modifies the provided character by the given value.

Parameters
string$operator
string$value
Returns
callback

Referenced by eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler\compileTranspose(), and eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler\compileTransposeModulo().

Member Data Documentation

eZ\Publish\Core\Persistence\TransformationProcessor\PcreCompiler::$converter
protected

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