/** * @return bool */ protected function isInstanceOf(GClass $controllerClass, $fqn) { return $controllerClass->getReflection()->isSubclassOf($fqn); }
public function testNewClassInstance() { $exception = GClass::newClassInstance('Psc\\Exception', array('just a test error')); $this->assertInstanceOf('Psc\\Exception', $exception); $this->assertEquals('just a test error', $exception->getMessage()); $exception = GClass::newClassInstance($gClass = new GClass('Psc\\Exception'), array('just a test error')); $this->assertInstanceOf('Psc\\Exception', $exception); $this->assertEquals('just a test error', $exception->getMessage()); $exception = GClass::newClassInstance($gClass->getReflection(), array('just a test error')); $this->assertInstanceOf('Psc\\Exception', $exception); $this->assertEquals('just a test error', $exception->getMessage()); }
/** * @return Object */ public function getControllerInstance(GClass $class) { $controller = $class->getReflection()->newInstanceArgs(array_slice(func_get_args(), 1)); return $controller; }