public function proxy($object)
{
$reflector = new ReflectionObject($object);
foreach ($reflector->getMethods() as $method) {
if (!$method->isStatic() || $method->isPrivate()) {
continue;
}
$name = $method->getName();
if ($this->class->hasMethod($name)) {
$method->setAccessible(true);
$this->stub($name)->doesWith(function ($arguments) use($method, $object) {
return $method->invokeArgs($object, $arguments->all());
}, array(), false, true, false);
}
}
return $this;
}