Base::__call PHP Method

__call() public method

Call function identified by hive key
public __call ( $key, $args ) : mixed
$key string
$args array
return mixed
    function __call($key, $args)
    {
        return call_user_func_array($this->get($key), $args);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Call a method of the scope and output it
  *
  * @param *string $name the name of the method
  * @param *array  $args arguments that were passed
  *
  * @return mixed
  */
 public function __call($name, $args)
 {
     Argument::i()->test(1, 'string')->test(2, 'array');
     //if the scope is null
     if (is_null($this->scope)) {
         //just call the parent
         return parent::__call($name, $args);
     }
     //get the results from the method call
     $results = $this->getResults($name, $args);
     //set temp variables
     $name = $this->name;
     $scope = $this->scope;
     //reset globals
     $this->name = null;
     $this->scope = null;
     //if there's a property name
     if ($name) {
         //output that
         $scope->inspect($name);
         //and return the results
         return $results;
     }
     //at this point we should output the results
     $class = get_class($scope);
     $output = sprintf(self::INSPECT, $class . '->' . $name);
     $this->output($output)->output($results);
     //and return the results
     return $results;
 }
All Usage Examples Of Base::__call