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

Public Member Functions

 offsetExists ($identifier)
 
 offsetGet ($identifier)
 
 offsetSet ($identifier, $instanceName)
 
 offsetUnset ($identifier)
 
 getInstanceName ()
 
 newWith ()
 
 setWith (Ensures $with)
 
 getWith ()
 
 disjunctionWith ($identifier)
 
 isDisjointed ()
 
 getDisjunction ()
 
 getExceptions ()
 
 getIterator ()
 
 count ()
 
- Public Member Functions inherited from Hoa\Praspel\Model\Clause
 __construct (Clause $parent)
 
 getParent ()
 
 getRoot ()
 
 getName ()
 
 getId ()
 
 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 NAME = 'throwable'
 
const IDENTIFIER = 0
 
const INSTANCE_OF = 1
 
const WITH = 2
 
const DISJUNCTION = 3
 

Protected Attributes

 $_exceptions = []
 
 $_currentException = null
 
- Protected Attributes inherited from Hoa\Praspel\Model\Clause
 $_parent = null
 

Additional Inherited Members

- Protected Member Functions inherited from Hoa\Praspel\Model\Clause
 setParent (Clause $parent)
 
 _getId ()
 

Detailed Description

Class .

Represent the clause.

Definition at line 49 of file Throwable.php.

Member Function Documentation

Hoa\Praspel\Model\Throwable::count ( )

Count number of exceptions.

Returns
int

Definition at line 313 of file Throwable.php.

314  {
315  return count($this->getExceptions());
316  }

Here is the call graph for this function:

Hoa\Praspel\Model\Throwable::disjunctionWith (   $identifier)

Declare that this exception is disjointed with another one.

Parameters
string$identifierIdentifier.
Returns

Definition at line 230 of file Throwable.php.

231  {
232  if (null === $this->_currentException) {
233  return $this;
234  }
235 
236  if (false === isset($this[$identifier])) {
237  return $this;
238  }
239 
240  $_identifier = &$this->_exceptions[$identifier];
241  $this->_currentException[static::WITH] = &$_identifier[static::WITH];
242 
243  if (true === is_array($_identifier[static::DISJUNCTION])) {
244  $_identifier[static::DISJUNCTION][] =
245  $this->_currentException[static::IDENTIFIER];
246  } else {
247  $_identifier[static::DISJUNCTION] = [
248  $this->_currentException[static::IDENTIFIER]
249  ];
250  }
251 
252  $this->_currentException[static::DISJUNCTION] = $identifier;
253 
254  return $this;
255  }
Hoa\Praspel\Model\Throwable::getDisjunction ( )

Get disjointed exceptions. Example: T1 t1 or T2 t2 or T3 t3 For t1, this method will return an array containing t2 and t3. For t2, this method will return a string equals to t1. Same for t3. If this method returns null, it means that the exception is not in a disjunction.

Returns
mixed

Definition at line 279 of file Throwable.php.

280  {
281  if (null === $this->_currentException) {
282  return null;
283  }
284 
285  return $this->_currentException[static::DISJUNCTION];
286  }

Here is the caller graph for this function:

Hoa\Praspel\Model\Throwable::getExceptions ( )

Get exceptions list.

Returns
array

Definition at line 293 of file Throwable.php.

294  {
295  return $this->_exceptions;
296  }

Here is the caller graph for this function:

Hoa\Praspel\Model\Throwable::getInstanceName ( )

Get instance name.

Returns
string

Definition at line 173 of file Throwable.php.

174  {
175  if (null === $this->_currentException) {
176  return null;
177  }
178 
179  return $this->_currentException[static::INSTANCE_OF];
180  }
Hoa\Praspel\Model\Throwable::getIterator ( )

Iterator over exceptions.

Returns

Definition at line 303 of file Throwable.php.

304  {
305  return new Iterator\Map(array_keys($this->getExceptions()));
306  }

Here is the call graph for this function:

Hoa\Praspel\Model\Throwable::getWith ( )

Get with declaration.

Returns

Definition at line 215 of file Throwable.php.

216  {
217  if (null === $this->_currentException) {
218  return null;
219  }
220 
221  return $this->_currentException[static::WITH];
222  }
Hoa\Praspel\Model\Throwable::isDisjointed ( )

Check if an exception is disjointed with another one.

Returns
bool

Definition at line 262 of file Throwable.php.

263  {
264  return is_string($this->getDisjunction());
265  }

Here is the call graph for this function:

Hoa\Praspel\Model\Throwable::newWith ( )

Create a new with instance (an Hoa instance with this instance as parent).

Returns

Definition at line 188 of file Throwable.php.

189  {
190  return new Ensures($this);
191  }
Hoa\Praspel\Model\Throwable::offsetExists (   $identifier)

Check if an exception identifier exists.

Parameters
string$identifierException identifier.
Returns
bool

Definition at line 112 of file Throwable.php.

113  {
114  return isset($this->_exceptions[$identifier]);
115  }

Here is the caller graph for this function:

Hoa\Praspel\Model\Throwable::offsetGet (   $identifier)

Select an exception.

Parameters
string$identifierException identifier.
Returns

Definition at line 123 of file Throwable.php.

124  {
125  if (false === $this->offsetExists($identifier)) {
126  return null;
127  }
128 
129  unset($this->_currentException);
130  $this->_currentException = &$this->_exceptions[$identifier];
131 
132  return $this;
133  }

Here is the call graph for this function:

Here is the caller graph for this function:

Hoa\Praspel\Model\Throwable::offsetSet (   $identifier,
  $instanceName 
)

Add an exception.

Parameters
string$identifierException identifier.
mixed$instanceNameException instance name.
Returns
mixed

Definition at line 142 of file Throwable.php.

143  {
144  $old = $this->offsetGet($identifier);
145  $this->_exceptions[$identifier] = [
146  static::IDENTIFIER => $identifier,
147  static::INSTANCE_OF => $instanceName,
148  static::WITH => null,
149  static::DISJUNCTION => null
150  ];
151 
152  return $old;
153  }

Here is the call graph for this function:

Hoa\Praspel\Model\Throwable::offsetUnset (   $identifier)

Delete an exception.

Parameters
string$identifierException identifier.
Returns
void

Definition at line 161 of file Throwable.php.

162  {
163  unset($this->_exceptions[$identifier]);
164 
165  return;
166  }
Hoa\Praspel\Model\Throwable::setWith ( Ensures  $with)

Set with declaration.

Parameters
\Hoa\Praspel\Model\Ensures$withWith.
Returns

Definition at line 199 of file Throwable.php.

200  {
201  if (null === $this->_currentException) {
202  return $this;
203  }
204 
205  $this->_currentException[static::WITH] = $with;
206 
207  return $this;
208  }

Member Data Documentation

Hoa\Praspel\Model\Throwable::$_currentException = null
protected

Definition at line 102 of file Throwable.php.

Hoa\Praspel\Model\Throwable::$_exceptions = []
protected

Definition at line 95 of file Throwable.php.

const Hoa\Praspel\Model\Throwable::DISJUNCTION = 3

Disjunction index.

int

Definition at line 88 of file Throwable.php.

const Hoa\Praspel\Model\Throwable::IDENTIFIER = 0

Identifier index.

int

Definition at line 67 of file Throwable.php.

const Hoa\Praspel\Model\Throwable::INSTANCE_OF = 1

Instance of index.

int

Definition at line 74 of file Throwable.php.

const Hoa\Praspel\Model\Throwable::NAME = 'throwable'

Name.

string

Definition at line 60 of file Throwable.php.

const Hoa\Praspel\Model\Throwable::WITH = 2

With index.

int

Definition at line 81 of file Throwable.php.


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