/** * @internal do not use unless you're absolutely sure what you're doing * @return bool|mixed */ public function processMessage() { if (!($next = $this->nextMessage())) { return FALSE; } list($routingKey, $msgBody) = $next; if (!($consumer = $this->findConsumer($routingKey))) { throw new InvalidStateException(sprintf('No consumer for exchange "%s" with routing key "%s" found.', $this->exchangeOptions['name'], $routingKey)); } $callbackRefl = new Nette\Reflection\Property($consumer, 'callback'); $callbackRefl->setAccessible(TRUE); $callback = $callbackRefl->getValue($consumer); return call_user_func($callback, new AMQPMessage($msgBody, [])); }
public function __invoke($application, $response) { if ($response instanceof JsonResponse && ($payload = $response->getPayload()) instanceof \stdClass) { if (!$this->forwardHasHappened && isset($payload->redirect)) { $url = new Http\UrlScript($payload->redirect); $url->setScriptPath($this->httpRequest->url->scriptPath); $httpRequest = new Http\Request($url); if ($this->router->match($httpRequest) !== NULL) { $prop = new Property($application, 'httpRequest'); $prop->setAccessible(TRUE); $prop->setValue($application, $httpRequest); $application->run(); exit; } } elseif ($this->forwardHasHappened && !isset($payload->redirect)) { $payload->redirect = $application->getPresenter()->link('this'); } $prop = new Property('Nette\\Application\\UI\\Presenter', 'signalReceiver'); $prop->setAccessible(TRUE); $payload->signal = $prop->getValue($application->getPresenter()) !== NULL; } }
/** * @param \Nette\Reflection\Property * @param mixed * @return mixed */ private function getValue(\Nette\Reflection\Property $reflection, $input) { $reflection->setAccessible(TRUE); return $reflection->getValue($input); }
private function getClassMap() { if ($this->registeredClasses !== NULL) { return $this->registeredClasses; } if (property_exists('Nette\\DI\\Container', 'classes')) { return $this->registeredClasses = $this->sl->classes; } $refl = new Nette\Reflection\Property('Nette\\DI\\Container', 'meta'); $refl->setAccessible(TRUE); $meta = $refl->getValue($this->sl); $this->registeredClasses = array(); foreach ($meta['types'] as $type => $serviceIds) { if (isset($this->registeredClasses[$type])) { $this->registeredClasses[$type] = FALSE; continue; } $this->registeredClasses[$type] = $serviceIds; } return $this->registeredClasses; }