PEEL Shopping
Open source ecommerce : PEEL Shopping
Public Member Functions | Static Public Member Functions | Data Fields | Protected Attributes
Twig_Token Class Reference

Represents a Token. More...

Public Member Functions

 __construct ($type, $value, $lineno)
 Constructor. More...
 
 __toString ()
 Returns a string representation of the token. More...
 
 test ($type, $values=null)
 Tests the current token for a type and/or a value. More...
 
 getLine ()
 Gets the line. More...
 
 getType ()
 Gets the token type. More...
 
 getValue ()
 Gets the token value. More...
 

Static Public Member Functions

static typeToString ($type, $short=false, $line=-1)
 Returns the constant representation (internal) of a given type. More...
 
static typeToEnglish ($type, $line=-1)
 Returns the english representation of a given type. More...
 

Data Fields

const EOF_TYPE = -1
 
const TEXT_TYPE = 0
 
const BLOCK_START_TYPE = 1
 
const VAR_START_TYPE = 2
 
const BLOCK_END_TYPE = 3
 
const VAR_END_TYPE = 4
 
const NAME_TYPE = 5
 
const NUMBER_TYPE = 6
 
const STRING_TYPE = 7
 
const OPERATOR_TYPE = 8
 
const PUNCTUATION_TYPE = 9
 
const INTERPOLATION_START_TYPE = 10
 
const INTERPOLATION_END_TYPE = 11
 

Protected Attributes

 $value
 
 $type
 
 $lineno
 

Detailed Description

Represents a Token.

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

Definition at line 18 of file Token.php.

Constructor & Destructor Documentation

__construct (   $type,
  $value,
  $lineno 
)

Constructor.

Parameters
integer$typeThe type of the token
string$valueThe token value
integer$linenoThe line position in the source

Definition at line 45 of file Token.php.

Member Function Documentation

__toString ( )

Returns a string representation of the token.

Returns
string A string representation of the token

Definition at line 57 of file Token.php.

getLine ( )

Gets the line.

Returns
integer The source line

Definition at line 94 of file Token.php.

getType ( )

Gets the token type.

Returns
integer The token type

Definition at line 104 of file Token.php.

getValue ( )

Gets the token value.

Returns
string The token value

Definition at line 114 of file Token.php.

test (   $type,
  $values = null 
)

Tests the current token for a type and/or a value.

Parameters may be:

  • just type
  • type and value (or array of possible values)
  • just value (or array of possible values) (NAME_TYPE is used as type)
Parameters
array | integer$typeThe type to test
array | string | null$valuesThe token value
Returns
Boolean

Definition at line 75 of file Token.php.

static typeToEnglish (   $type,
  $line = -1 
)
static

Returns the english representation of a given type.

Parameters
integer$typeThe type as an integer
integer$lineThe code line
Returns
string The string representation

Definition at line 185 of file Token.php.

static typeToString (   $type,
  $short = false,
  $line = -1 
)
static

Returns the constant representation (internal) of a given type.

Parameters
integer$typeThe type as an integer
Boolean$shortWhether to return a short representation or not
integer$lineThe code line
Returns
string The string representation

Definition at line 128 of file Token.php.

Field Documentation

$lineno
protected

Definition at line 22 of file Token.php.

$type
protected

Definition at line 21 of file Token.php.

$value
protected

Definition at line 20 of file Token.php.

const BLOCK_END_TYPE = 3

Definition at line 28 of file Token.php.

const BLOCK_START_TYPE = 1

Definition at line 26 of file Token.php.

const EOF_TYPE = -1

Definition at line 24 of file Token.php.

const INTERPOLATION_END_TYPE = 11

Definition at line 36 of file Token.php.

const INTERPOLATION_START_TYPE = 10

Definition at line 35 of file Token.php.

const NAME_TYPE = 5

Definition at line 30 of file Token.php.

const NUMBER_TYPE = 6

Definition at line 31 of file Token.php.

const OPERATOR_TYPE = 8

Definition at line 33 of file Token.php.

const PUNCTUATION_TYPE = 9

Definition at line 34 of file Token.php.

const STRING_TYPE = 7

Definition at line 32 of file Token.php.

const TEXT_TYPE = 0

Definition at line 25 of file Token.php.

const VAR_END_TYPE = 4

Definition at line 29 of file Token.php.

const VAR_START_TYPE = 2

Definition at line 27 of file Token.php.


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

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:45 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.