public function supportsClass($class) { if (is_object($class)) { $refl = new \ReflectionObject($class); return $refl->implementsInterface('Knp\\Rad\\Security\\OwnableInterface'); } return false; }
protected function createComponent($class) { $configuration = $this->ctx->getConfiguration(); $object = $this->createObject($configuration, $class); $reflected = new \ReflectionObject($object); if ($reflected->implementsInterface('\\FS\\Components\\Factory\\ComponentPostConstructInterface')) { $object->postConstruct(); } if ($reflected->implementsInterface('\\FS\\Context\\ApplicationContextAwareInterface')) { $object->setApplicationContext($this->ctx); } if ($reflected->implementsInterface('\\FS\\Components\\Factory\\ComponentFactoryAwareInterface')) { $object->setComponentFactory($this); } if ($reflected->implementsInterface('\\FS\\Components\\Factory\\ComponentInitializingInterface')) { $object->afterPropertiesSet(); } return $object; }
/** * Return module instance by context * * @param array $request * @return true */ public function GetModuleInstanceByContext($request) { foreach ($this->ListModules() as $module_name) { $m =& $this->GetModuleObjectByName($module_name); $reflectionobject = new ReflectionObject($m); if ($reflectionobject->implementsInterface("IPostBackPaymentModule")) { if ($m->CheckSignature($request)) { return $m; } } } return false; }
/** * Looks for all *Command.php files to load all commands * * @return Twr\Application */ public function loadCommands() { $services = $this->container->findTaggedServiceIds('command'); foreach ($services as $id => $attributes) { $command = $this->container->get($id); $refl = new \ReflectionObject($command); if ($refl->implementsInterface('Symfony\\Component\\DependencyInjection\\ContainerAwareInterface')) { $command->setContainer($this->container); } $this->console->add($command); } return $this; }
public function generate($obj) { $refObj = new \ReflectionObject($obj); if ($refObj->implementsInterface("\\hvasoares\\phplombok\\GeneratedClass")) { return $obj; } $oldClassName = array_pop(explode("\\", $refObj->getName())); $newClassName = $oldClassName . (time() + rand()); if (!$this->c->classExists(get_class($obj))) { $this->c->generateAndLoadClassFile(get_class($obj), $this->t->generateInheritedClass($newClassName, $obj)); $this->f->configure($refObj->getName(), $refObj->getNamespaceName() . "\\" . $newClassName); } return $this->f->get($obj); }
/** * Tests that the configuration object can be accessed using array * syntax. * * @return void */ public function testImplementsArrayAccess() { $reflector = new ReflectionObject($this->config); $this->assertTrue($reflector->implementsInterface('ArrayAccess'), 'Config instance does not implement ArrayAccess'); }
/** * Tests countability of the plugin handler. * * @return void */ public function testImplementsCountable() { $reflection = new ReflectionObject($this->handler); $this->assertTrue($reflection->implementsInterface('Countable'), 'Handler does not implement Countable'); $this->assertType('int', count($this->handler), 'count() must return an integer'); }
{ // If Total = 0 then mark all invoices in order as paid if ($Order->GetTotal() == 0) { // Invoice automaticly mark as paid after creation if Total == 0; //$Order->MarkAsPaid($payment_module); CoreUtils::Redirect("pdt.php"); } else { $PaymentForm = $payment_module->GetPaymentForm(); if ($PaymentForm == false) { $reflect = new ReflectionObject($payment_module); if ($reflect->implementsInterface("IPostBackPaymentModule")) { $payment_module->RedirectToGateway( $Order, $userinfo ); } else { $res = $payment_module->ProcessPayment( $Order, $userinfo ); if ($res) $payment_module->NotifyObservers(PAYMENT_STATUS::SUCCESS); else
/** * Ensures that we can iterate over the handler * * @return void */ public function testImplementsIterator() { $reflection = new ReflectionObject($this->handler); $this->assertTrue($reflection->implementsInterface('IteratorAggregate')); $this->assertType('Iterator', $this->handler->getIterator(), 'getIterator() must actually return an Iterator'); }
/** * Gets profile info of some Gravatar's user, based on his/her * email address. Return value is NP_Gravatar_Profile instance, * in case $_responseFormat implements * NP_Service_Gravatar_Profiles_ResponseFormat_ParserInterface * interface. Otherwise, or in case $rawResponse flag is set to * boolean true, Zend_Http_Response instance is returned. * * @param string $email * @param bool $rawResponse Whether raw response object should be returned. * @return NP_Gravatar_Profile|Zend_Http_Response */ public function getProfileInfo($email, $rawResponse = false) { $email = strtolower(trim((string) $email)); $hash = NP_Service_Gravatar_Utility::emailHash($email); $response = $this->getHttpClient()->setMethod(Zend_Http_Client::GET)->setUri(self::GRAVATAR_SERVER . '/' . $hash . '.' . $this->_responseFormat)->request(); $reflected = new ReflectionObject($this->_responseFormat); if ($reflected->implementsInterface('NP_Service_Gravatar_Profiles_ResponseFormat_ParserInterface') && !$rawResponse) { return $this->_responseFormat->profileFromHttpResponse($response); } else { return $response; } }
/** * @group http */ public function testImplementsPsr7ResponseInterface() { $r = new \ReflectionObject($this->response); $this->assertTrue($r->implementsInterface('Psr\\Http\\Message\\ResponseInterface')); }