Example #1
0
 /**
  * Construct a new wrapped method.
  *
  * @param ReflectionMethod $method The method.
  * @param Handle           $handle The handle.
  */
 public function __construct(ReflectionMethod $method, Handle $handle)
 {
     $this->method = $method;
     $this->handle = $handle;
     $this->name = $method->getName();
     if ($handle instanceof StaticHandle) {
         $this->mock = null;
         $callback = array($method->getDeclaringClass()->getName(), $this->name);
     } else {
         $this->mock = $handle->get();
         $callback = array($this->mock, $this->name);
     }
     parent::__construct($callback, null);
 }
Example #2
0
 /**
  * Construct a new wrapped magic method.
  *
  * @param string           $name            The name.
  * @param ReflectionMethod $callMagicMethod The _callMagic() method.
  * @param bool             $isUncallable    True if the underlying magic method is uncallable.
  * @param Handle           $handle          The handle.
  */
 public function __construct($name, ReflectionMethod $callMagicMethod, $isUncallable, Handle $handle)
 {
     $this->name = $name;
     $this->callMagicMethod = $callMagicMethod;
     $this->isUncallable = $isUncallable;
     $this->handle = $handle;
     if ($callMagicMethod->isStatic()) {
         $this->mock = null;
         $callback = array($callMagicMethod->getDeclaringClass()->getName(), '__callStatic');
     } else {
         $this->mock = $handle->get();
         $callback = array($this->mock, '__call');
     }
     parent::__construct($callback, null);
 }