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

Public Member Functions

 __construct (Clause $clause,\Closure $postClone=null)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 get ($offset)
 
 getNth ($position)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 getIterator ()
 
 count ()
 
 accept (Visitor\Visit $visitor, &$handle=null, $eldnah=null)
 
- Public Member Functions inherited from Hoa\Visitor\Element
 accept (Visit $visitor, &$handle=null, $eldnah=null)
 

Protected Member Functions

 getClause ()
 
 getPostClone ()
 

Protected Attributes

 $_clauses = []
 
 $_mapping = []
 
 $_clause = null
 
 $_postClone = null
 

Detailed Description

Class .

Represent a collection of clauses.

Definition at line 51 of file Collection.php.

Constructor & Destructor Documentation

Hoa\Praspel\Model\Collection::__construct ( Clause  $clause,
\Closure  $postClone = null 
)

Build a collection of clauses.

Parameters
\Hoa\Praspel\Model\Clause$clauseClause.
\Closure$postClonePost-clone function.
Returns
void

Definition at line 94 of file Collection.php.

95  {
96  $this->_clause = $clause;
97  $this->_postClone = $postClone;
98 
99  return;
100  }

Member Function Documentation

Hoa\Praspel\Model\Collection::accept ( Visitor\Visit  $visitor,
$handle = null,
  $eldnah = null 
)

Accept a visitor.

Parameters
\Hoa\Visitor\Visit$visitorVisitor.
mixed&$handleHandle (reference).
mixed$eldnahHandle (no reference).
Returns
mixed

Definition at line 231 of file Collection.php.

235  {
236  return $visitor->visit($this, $handle, $eldnah);
237  }
Hoa\Praspel\Model\Collection::count ( )

Count number of clauses.

Returns
int

Definition at line 218 of file Collection.php.

219  {
220  return count($this->_clauses);
221  }
Hoa\Praspel\Model\Collection::get (   $offset)

Alias of $this->offsetGet($offset).

Parameters
string$identifierIdentifier.
Returns

Definition at line 141 of file Collection.php.

142  {
143  return $this->offsetGet($offset);
144  }

Here is the call graph for this function:

Hoa\Praspel\Model\Collection::getClause ( )
protected

Get reference clause.

Returns

Definition at line 188 of file Collection.php.

189  {
190  return $this->_clause;
191  }

Here is the caller graph for this function:

Hoa\Praspel\Model\Collection::getIterator ( )

Iterate over all clauses.

Returns

Definition at line 208 of file Collection.php.

209  {
210  return new Iterator\Map($this->_clauses);
211  }
Hoa\Praspel\Model\Collection::getNth (   $position)

Get a clause from its position.

Parameters
string$positionPosition.
Returns

Definition at line 152 of file Collection.php.

153  {
154  if (!isset($this->_mapping[$position])) {
155  return null;
156  }
157 
158  return $this->_mapping[$position];
159  }
Hoa\Praspel\Model\Collection::getPostClone ( )
protected

Get post-clone function.

Returns

Definition at line 198 of file Collection.php.

199  {
200  return $this->_postClone;
201  }

Here is the caller graph for this function:

Hoa\Praspel\Model\Collection::offsetExists (   $offset)

Check whether an offset exists.

Parameters
string$offsetOffset.
Returns
bool

Definition at line 108 of file Collection.php.

109  {
110  return false !== array_key_exists($offset, $this->_clauses);
111  }

Here is the caller graph for this function:

Hoa\Praspel\Model\Collection::offsetGet (   $offset)

Get a clause.

Parameters
string$offsetOffset.
Returns

Definition at line 119 of file Collection.php.

120  {
121  if (false === $this->offsetExists($offset)) {
122  $clause = $this->getClause();
123  $this->_clauses[$offset] = clone $clause;
124  $this->_mapping[] = &$this->_clauses[$offset];
125  $postClone = $this->getPostClone();
126 
127  if (null !== $postClone) {
128  $postClone($this->_clauses[$offset], $offset);
129  }
130  }
131 
132  return $this->_clauses[$offset];
133  }

Here is the call graph for this function:

Here is the caller graph for this function:

Hoa\Praspel\Model\Collection::offsetSet (   $offset,
  $value 
)

Disabled.

Returns
void
Exceptions

Definition at line 167 of file Collection.php.

168  {
169  throw new Praspel\Exception\Model('Operation denied.', 0);
170  }
Hoa\Praspel\Model\Collection::offsetUnset (   $offset)

Disabled.

Returns
void
Exceptions

Definition at line 178 of file Collection.php.

179  {
180  throw new Praspel\Exception\Model('Operation denied.', 1);
181  }

Member Data Documentation

Hoa\Praspel\Model\Collection::$_clause = null
protected

Definition at line 76 of file Collection.php.

Hoa\Praspel\Model\Collection::$_clauses = []
protected

Definition at line 62 of file Collection.php.

Hoa\Praspel\Model\Collection::$_mapping = []
protected

Definition at line 69 of file Collection.php.

Hoa\Praspel\Model\Collection::$_postClone = null
protected

Definition at line 83 of file Collection.php.


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