Esempio n. 1
0
 /**
  * Class sonstructor
  * 
  * @param   callback    The PHP callback
  * @return  void
  */
 public function __construct($callback)
 {
     // Ensures the callback is valid
     if (!is_callable($callback)) {
         // Error - The callback is not valid
         throw new Woops_Core_Callback_Exception('Invalid PHP callback', Woops_Core_Callback_Exception::EXCEPTION_INVALID_CALLBACK);
     }
     // Stores the callback
     $this->_callback = $callback;
     // Checks the callback type
     if (is_array($this->_callback)) {
         // Checks if the callback returns a reference
         $ref = Woops_Core_Reflection_Method::getInstance($callback[0], $callback[1]);
         $this->_returnsReference = $ref->returnsReference();
     } else {
         // Checks if the callback returns a reference
         $ref = Woops_Core_Reflection_Function::getInstance($callback);
         $this->_returnsReference = $ref->returnsReference();
     }
 }
Esempio n. 2
0
 /**
  * 
  */
 private final function _getFunctions()
 {
     if (!$this->_hasFunctions) {
         $functions = $this->_reflector->getFunctions();
         foreach ($functions as $function) {
             $this->_functions[$function->getName()] = Woops_Core_Reflection_Function::getInstance($function->getName());
         }
         $this->_hasFunctions = true;
     }
     return $this->_functions;
 }