Hoa central
Public Member Functions | Public Attributes | Protected Attributes | List of all members
Hoa\Ruler\Model\Bag\Context Class Reference
Inheritance diagram for Hoa\Ruler\Model\Bag\Context:

Public Member Functions

 __construct ($id)
 
 index ($index)
 
 attribute ($attribute)
 
 call (Ruler\Model\Operator $method)
 
 getDimensions ()
 
 getId ()
 
- Public Member Functions inherited from Hoa\Ruler\Model\Bag\Bag
 accept (Visitor\Visit $visitor, &$handle=null, $eldnah=null)
 
- Public Member Functions inherited from Hoa\Visitor\Element
 accept (Visit $visitor, &$handle=null, $eldnah=null)
 

Public Attributes

const ACCESS_TYPE = 0
 
const ACCESS_VALUE = 1
 
const ARRAY_ACCESS = 0
 
const ATTRIBUTE_ACCESS = 1
 
const METHOD_ACCESS = 2
 

Protected Attributes

 $_id = null
 
 $_dimensions = []
 

Detailed Description

Class .

Bag for context, i.e. a variable.

Definition at line 49 of file Context.php.

Constructor & Destructor Documentation

Hoa\Ruler\Model\Bag\Context::__construct (   $id)

Constructor.

Parameters
string$idID.
Returns
void

Definition at line 108 of file Context.php.

109  {
110  $this->_id = $id;
111 
112  return;
113  }

Member Function Documentation

Hoa\Ruler\Model\Bag\Context::attribute (   $attribute)

Call an attribute (variable.attrA.attrB).

Parameters
string$attributeAttribute name.
Returns

Definition at line 143 of file Context.php.

144  {
145  $this->_dimensions[] = [
146  static::ACCESS_TYPE => static::ATTRIBUTE_ACCESS,
147  static::ACCESS_VALUE => $attribute
148  ];
149 
150  return $this;
151  }
Hoa\Ruler\Model\Bag\Context::call ( Ruler\Model\Operator  $method)

Call a method (variable.foo().bar().baz()).

Parameters
\Hoa\Ruler\Model\Operator$methodMethod to call.
Returns

Definition at line 159 of file Context.php.

160  {
161  $this->_dimensions[] = [
162  static::ACCESS_TYPE => static::METHOD_ACCESS,
163  static::ACCESS_VALUE => $method
164  ];
165 
166  return $this;
167  }
Hoa\Ruler\Model\Bag\Context::getDimensions ( )

Get all dimensions.

Returns
array

Definition at line 174 of file Context.php.

175  {
176  return $this->_dimensions;
177  }
Hoa\Ruler\Model\Bag\Context::getId ( )

Get ID.

Returns
string

Definition at line 184 of file Context.php.

185  {
186  return $this->_id;
187  }
Hoa\Ruler\Model\Bag\Context::index (   $index)

Call an index (variable[indexA][indexB][indexC]).

Parameters
mixed$indexIndex (a bag or an operator).
Returns

Definition at line 121 of file Context.php.

122  {
123  if (is_scalar($index) || null === $index) {
124  $index = new Scalar($index);
125  } elseif (is_array($index)) {
126  $index = new RulerArray($index);
127  }
128 
129  $this->_dimensions[] = [
130  static::ACCESS_TYPE => static::ARRAY_ACCESS,
131  static::ACCESS_VALUE => $index
132  ];
133 
134  return $this;
135  }

Member Data Documentation

Hoa\Ruler\Model\Bag\Context::$_dimensions = []
protected

Definition at line 98 of file Context.php.

Hoa\Ruler\Model\Bag\Context::$_id = null
protected

Definition at line 91 of file Context.php.

const Hoa\Ruler\Model\Bag\Context::ACCESS_TYPE = 0

Access type.

int

Definition at line 56 of file Context.php.

const Hoa\Ruler\Model\Bag\Context::ACCESS_VALUE = 1

Access value.

int

Definition at line 63 of file Context.php.

const Hoa\Ruler\Model\Bag\Context::ARRAY_ACCESS = 0

Type: array access.

int

Definition at line 70 of file Context.php.

const Hoa\Ruler\Model\Bag\Context::ATTRIBUTE_ACCESS = 1

Type: attribute access.

int

Definition at line 77 of file Context.php.

const Hoa\Ruler\Model\Bag\Context::METHOD_ACCESS = 2

Type: method access.

int

Definition at line 84 of file Context.php.


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