Hoa central
Public Member Functions | Protected Attributes | List of all members
Hoa\Praspel\Preambler\Handler Class Reference

Public Member Functions

 __construct (Core\Consistency\Xcallable $callable)
 
 __getReflectionObject (&$object)
 
 __set ($name, $value)
 
 __get ($name)
 
 __setCallable (Core\Consistency\Xcallable $callable)
 
 __getCallable ()
 

Protected Attributes

 $__callable = null
 

Detailed Description

Class .

Handle a class and ease to run a preamble.

Definition at line 50 of file Handler.php.

Constructor & Destructor Documentation

Hoa\Praspel\Preambler\Handler::__construct ( Core\Consistency\Xcallable  $callable)

Construct.

Parameters
\Hoa\Core\Consistency\Xcallable$callableCallable.
Returns
void

Definition at line 67 of file Handler.php.

68  {
69  $this->__setCallable($callable);
70 
71  return;
72  }
__setCallable(Core\Consistency\Xcallable $callable)
Definition: Handler.php:164

Here is the call graph for this function:

Member Function Documentation

Hoa\Praspel\Preambler\Handler::__get (   $name)

Get an attribute.

Parameters
string$nameName.
Returns
mixed
Exceptions

Definition at line 140 of file Handler.php.

141  {
142  $reflectionObject = $this->__getReflectionObject($object);
143 
144  if (false === $reflectionObject->hasProperty($name)) {
145  throw new Praspel\Exception\Preambler(
146  'Attribute %s on object %s does not exist, cannot get it.',
147  2,
148  [$name, $reflectionObject->getName()]
149  );
150  }
151 
152  $attribute = $reflectionObject->getProperty($name);
153  $attribute->setAccessible(true);
154 
155  return $attribute->getValue($object);
156  }

Here is the call graph for this function:

Hoa\Praspel\Preambler\Handler::__getCallable ( )

Get callable.

Returns

Definition at line 177 of file Handler.php.

178  {
179  return $this->__callable;
180  }

Here is the caller graph for this function:

Hoa\Praspel\Preambler\Handler::__getReflectionObject ( $object)

Get reflection object.

Parameters
object&$objectObject.
Returns
Exceptions

Definition at line 81 of file Handler.php.

82  {
83  static $_out = null;
84  static $_object = null;
85 
86  if (null === $_out) {
87  $callback = $this->__getCallable()->getValidCallback();
88 
89  if (!is_object($callback[0])) {
90  throw new Praspel\Exception\Preambler(
91  'Callable %s is not an object.',
92  0,
93  $this->__getCallable()
94  );
95  }
96 
97  $_object = $callback[0];
98  $_out = new \ReflectionObject($_object);
99  }
100 
101  $object = $_object;
102 
103  return $_out;
104  }

Here is the call graph for this function:

Here is the caller graph for this function:

Hoa\Praspel\Preambler\Handler::__set (   $name,
  $value 
)

Set an attribute.

Parameters
string$nameName.
mixed$valueValue.
Returns
Exceptions

Definition at line 114 of file Handler.php.

115  {
116  $reflectionObject = $this->__getReflectionObject($object);
117 
118  if (false === $reflectionObject->hasProperty($name)) {
119  throw new Praspel\Exception\Preambler(
120  'Attribute %s on object %s does not exist, cannot set it.',
121  1,
122  [$name, $reflectionObject->getName()]
123  );
124  }
125 
126  $attribute = $reflectionObject->getProperty($name);
127  $attribute->setAccessible(true);
128  $attribute->setValue($object, $value);
129 
130  return $this;
131  }

Here is the call graph for this function:

Hoa\Praspel\Preambler\Handler::__setCallable ( Core\Consistency\Xcallable  $callable)

Set callable.

Parameters
\Hoa\Core\Consistency\Xcallable$callableCallable.
Returns

Definition at line 164 of file Handler.php.

165  {
166  $old = $this->__callable;
167  $this->__callable = $callable;
168 
169  return $old;
170  }

Here is the caller graph for this function:

Member Data Documentation

Hoa\Praspel\Preambler\Handler::$__callable = null
protected

Definition at line 57 of file Handler.php.


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