/** * Action must be taken immediately. * * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. * * @param string $message * @param array $context * @return null */ public function alert($message, array $context = array()) { if ($this->logger) { $context = $this->getLoggerContext($context); $this->logger->alert($message, $context); } }
/** * When the process is shutdown we will check for errors. */ public function onShutdown() { $error = error_get_last(); if (!empty($error) && isset($error['type']) && error_reporting()) { $this->logger->alert($error['message'], ['error' => new Error($error['message'], $error['line'], $error['file'])]); } }
/** * Action must be taken immediately. * * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. * * @param string $message * @param array $context * @return bool */ public function alert($message, array $context = array()) { if (self::isSetLogger()) { return self::$logger->alert($message, $context); } return false; }
/** * @param string $path the working directory for filesystem operations * * @throws \InvalidArgumentException * @throws IOException */ public function setWorkingDirectory($path) { $directory = preg_replace('#/+#', '/', $path); // remove multiple slashes try { $directory = $this->locator->locate($directory); if (false === is_string($directory)) { $directory = strval(reset($directory)); $this->logger->alert(sprintf('Ambiguous filename %s, choosing %s', $path, $directory)); } } catch (\InvalidArgumentException $exception) { // continue to check if dir exists even if locator doesn't locate } $exists = $this->filesystem->exists($directory); if (!$exists) { try { $this->filesystem->mkdir($directory); $this->logger->notice("Working directory created at " . $directory); } catch (IOException $exception) { $this->logger->error("An error occurred while creating directory at " . $exception->getPath(), $exception->getTrace()); throw $exception; } } $this->directory = $directory; }
/** * {@inheritdoc} */ public function log($message, $level) { $message .= ' ' . $this->request->getRequestUri(); if ($this->logLevel >= $level) { switch ($level) { case self::EMERGENCY: $this->logger->emergency($message); break; case self::ALERT: $this->logger->alert($message); break; case self::CRITICAL: $this->logger->critical($message); break; case self::ERROR: $this->logger->error($message); break; case self::WARNING: $this->logger->warning($message); break; case self::NOTICE: $this->logger->notice($message); break; case self::INFO: $this->logger->info($message); break; default: $this->logger->debug($message); } } }
/** * @param RequestableInterface $apiRequest * * @return bool|\GuzzleHttp\Message\ResponseInterface */ public function send(RequestableInterface $apiRequest) { $request = $this->guzzleClient->createRequest($apiRequest->getMethod(), $apiRequest->getUrl(), $apiRequest->getOptions()); try { return $this->guzzleClient->send($request); } catch (ClientException $e) { if (null !== $this->logger) { $this->logger->alert($e->getMessage()); } return false; } }
/** * @param int $signal * @return void */ public function signalHandler($signal) { switch ($signal) { case SIGINT: case SIGTERM: $this->logger->alert('Worker killed or terminated', array('sessionId', $this->sessionId)); $this->daemonizable->shutdown(); exit(1); break; case SIGHUP: $this->logger->info('Starting daemon', array('session' => $this->sessionId)); break; } }
/** * Logs a message. * * @param string $message Message * @param string $priority Message priority * * @return void */ public function doLog($message, $priority) { if (!$this->logger) { $this->buffer[] = compact('message', 'priority'); return; } switch ($priority) { case sfLogger::EMERG: $this->logger->emergency($message); break; case sfLogger::ALERT: $this->logger->alert($message); break; case sfLogger::CRIT: $this->logger->critical($message); break; case sfLogger::ERR: $this->logger->error($message); break; case sfLogger::WARNING: $this->logger->warning($message); break; case sfLogger::NOTICE: $this->logger->notice($message); break; case sfLogger::INFO: $this->logger->info($message); break; case sfLogger::DEBUG: $this->logger->debug($message); break; } }
/** * @param Request $request * * @Rest\View(statusCode=204) * @Rest\Post("/webhook", defaults={"_format": "json"}) * * @throws ResourceConflictException * @throws \Exception * @return null */ public function handleWebHookAction(Request $request) { $this->logger->info($request->getContent()); try { $event = null; $store = $this->storeService->getStoreByRequest($request); $eventId = $this->shopifyEventRetriever->verifyWebhookRequest($request, $store); $event = $this->shopifyEventRetriever->retrieve($eventId); if ($event) { throw new EventAlreadyProcessed(sprintf('Event Id %s has already been processed', $eventId)); } //Save the event so we don't process this again $event = Event::createFromRequest($request, $eventId); $this->eventRepository->save($event); $cmd = $this->commandFactory->create($event, $store); $handler = $this->handlerFactory->create($event); $handler->execute($cmd); $event->updateStatus(Event::STATUS_PROCESSED); $this->logger->alert(sprintf('Completed Processing event id %s', $eventId)); } catch (\Exception $e) { if ($event instanceof Event) { $event->updateStatus(Event::STATUS_FAILED); } $this->logger->alert($e->getMessage()); } finally { if ($event instanceof Event) { $this->eventRepository->update($event); } return new Response('', 201); } }
/** * @param ItemInterface $menu * @param AdminMenu[] $tree * @param int $level */ protected function generateMenu(&$menu, &$tree, $level = 0) { while (!empty($tree)) { $item = array_shift($tree); $type = $item->getType(); $itemLabel = $item->getTitle(); $itemLevel = $item->getLevel(); if ($itemLevel == $level) { $options = []; if (AdminMenu::TYPE_FOLDER !== $type) { $admin = $this->pool->getInstance($item->getServiceId()); if ($admin) { $options = $admin->generateMenuUrl('list'); $options['extras'] = ['admin' => $admin]; } else { $this->logger->alert('Admin not found for class', [$item->getServiceId()]); } } $child = $menu->addChild($itemLabel, $options); } elseif ($itemLevel > $level) { array_unshift($tree, $item); $this->generateMenu($child, $tree, $itemLevel); } else { array_unshift($tree, $item); break; } } }
/** * @param MessageInterface $message * @return MessageHandlerInterface[] * @throws EventBusException */ public function getHandlers(MessageInterface $message) { $handlers = []; $eventName = $message->getName(); if (!array_key_exists($eventName, $this->map)) { return $handlers; } foreach ($this->map[$eventName] as $handlerName) { try { $handlers[] = $this->locator->get($handlerName); } catch (\Exception $e) { $this->logger->alert($e->getMessage(), ['exception' => $e]); } } return $handlers; }
private function addSignals() { \Amp\onSignal(SIGINT, function () { exit; }); \Amp\onSignal(SIGTERM, function () { exit; }); register_shutdown_function(function () { $this->logger->alert('Clean exit. Thank you.'); if (\Amp\info()["state"] !== \Amp\Reactor::STOPPED) { \Amp\stop(); } }); return true; }
/** * {@inheritdoc} */ public function alert($message, array $context = array()) { if (!$this->logger) { return; } return $this->logger->alert($message, $context); }
/** * Action must be taken immediately. * * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. * * @param string $message * @param array $context * @return null */ public function alert($message, array $context = array()) { if (empty($this->logger)) { return; } $this->logger->alert($this->getDefaultMessage() . $message, $context); }
private function setValue(&$item, $key, $value, $options = []) { try { $this->debug && $this->logger->info("Value adding is started."); switch ($options['type']) { case "string": case "text": case "integer": case "collection": case "bool": if (isset($options['modifier'])) { $value = $this->modify($value, $options['modifier'], $item); } break; case "date": if (isset($options['modifier'])) { $value = $this->modify($value, $options['modifier'], $item); } else { $value = $this->modifyDate($value, $options); } break; case "object": $value = $this->setObjectValue($item, $key, $value, $options); break; } if (array_key_exists('value', $options)) { $value = $options['value']; } $value ? $this->accessor->setValue($item, $key, $value) : $this->logger->alert("Value is null for {$key}."); $this->debug && $this->logger->info("Value adding is completed."); } catch (\Exception $e) { $this->logger->critical($e->getMessage()); } }
/** * {@inheritdoc} */ public function log($message, $severity = null) { if (null !== $this->logger) { $message = is_string($message) ? $message : var_export($message, true); switch ($severity) { case 'alert': $this->logger->alert($message); break; case 'crit': $this->logger->critical($message); break; case 'err': $this->logger->error($message); break; case 'warning': $this->logger->warning($message); break; case 'notice': $this->logger->notice($message); break; case 'info': $this->logger->info($message); break; case 'debug': default: $this->logger->debug($message); } } }
private function setValue(&$item, $key, $value, $options = []) { $this->debug && $this->logger->info("Value adding is started."); switch ($options['type']) { case "string": case "text": case "integer": case "collection": case "bool": if (isset($options['modifier'])) { $value = $this->modify($value, $options['modifier'], $item); } break; case "date": if (!array_key_exists('format', $options)) { $options['format'] = "Y-m-d H:i:s"; } $value = !empty($value) ? \DateTime::createFromFormat($options['format'], $value) : new \DateTime(); break; case "object": $value = $this->setObjectValue($item, $key, $value, $options); break; } if (array_key_exists('value', $options)) { $value = $options['value']; } $value ? $this->accessor->setValue($item, $key, $value) : $this->logger->alert("Value is null for {$key}."); $this->debug && $this->logger->info("Value adding is completed."); }
/** * @param TokenInterface $token * * @return OAuthToken|TokenInterface * @throws \Symfony\Component\Security\Core\Exception\AuthenticationException */ public function authenticate(TokenInterface $token) { try { $tokenString = $token->getToken(); $user = $this->userProvider->loadUserByToken($tokenString); $token = new OAuthToken($user->getRoles()); $token->setToken($tokenString); $token->setUser($user); $token->setAuthenticated(true); return $token; } catch (\Exception $e) { if ($this->logger) { $this->logger->alert('Can not authenticate user', array('message' => $e->getMessage())); } } throw new AuthenticationException('The OAuth authentication failed.'); }
/** * @param Otp $otp * @return OtpVerificationResult */ public function verify(Otp $otp) { try { $result = $this->service->verify($otp); } catch (UntrustedSignatureException $e) { $this->logger->alert(sprintf('Yubico responded with invalid signature (%s)', $e->getMessage()), ['exception' => $e, 'otp' => $otp->otp]); return new OtpVerificationResult(OtpVerificationResult::ERROR_BAD_SIGNATURE); } catch (RequestResponseMismatchException $e) { $this->logger->alert(sprintf('Yubico request and response didn\'t match (%s)', $e->getMessage()), ['exception' => $e, 'otp' => $otp->otp]); return new OtpVerificationResult(OtpVerificationResult::ERROR_BACKEND_ERROR); } if ($result->isSuccessful()) { return $result; } $this->logger->critical(sprintf('Yubico responded with error status \'%s\'', $result->getError()), ['otp' => $otp->otp]); return $result; }
/** * @param mixed $message * @param array $context * @return self */ public function alert($message, array $context = []) : self { if (!$this->logger) { return $this; } $this->logger->alert($message, $context); return $this; }
/** * Create client instances & auth * * @return bool True if one or more clients are connected, false otherwise * * @throws ServerException */ public function connect() { $this->logger->info('Starting clients...'); $tmpClients = []; $accounts = ConfigurationLoader::get('client.accounts'); foreach ($accounts as $accountKey => $account) { $client = ClientFactory::create($this->logger, $this->redis, $accountKey, $this->getNextClientId()); $client->authenticate(); $tmpClients[] = $client; } $nbClients = count($tmpClients); $isAsync = true === ConfigurationLoader::get('client.async.enabled'); $i = 0; $connectedCount = 0; /** @var LOLClientInterface $client */ while ($i < $nbClients) { $deleteClients = []; foreach ($tmpClients as $j => $client) { $isAuthenticated = $client->isAuthenticated(); if (null !== $isAuthenticated) { if (true === $isAuthenticated) { if (!$isAsync && isset($this->clients[$client->getRegion()])) { throw new ServerException('Multiple account for the same region in synchronous mode is not allowed. Please enable the asynchronous mode in the configuration file'); } $this->clients[$client->getRegion()][] = $client; $this->logger->info('Client ' . $client . ' is connected'); $connectedCount++; } else { if ($isAsync) { $this->cleanAsyncClients(false, $client); } } $i++; $deleteClients[] = $j; } } foreach ($deleteClients as $deleteClientId) { unset($tmpClients[$deleteClientId]); } if ($isAsync) { pcntl_signal_dispatch(); LoggerFactory::subscribe(); sleep(1); } } // No connected client, abort if (0 == $connectedCount) { return false; } $totalClientCount = count($accounts); $message = sprintf('%d/%d client%s successfully connected', $connectedCount, $totalClientCount, $connectedCount > 1 ? 's' : ''); if ($connectedCount < $totalClientCount) { $this->logger->alert('Only ' . $message); } else { $this->logger->info($message); } return true; }
public static function exception(Exception $exception, LoggerInterface $log = NULL) { if ($log) { $log->alert("Excpetion in: " . $exception->getFile() . " Line: " . $exception->getLine() . ". " . $exception->getMessage() . "\nStack trace:\n" . $exception->getTraceAsString()); } //we'll be instatic context here so I have to do it this way. header('Content-Type: application/json'); echo json_encode(array('status' => self::EXCEPTION, 'messages' => array($exception->getMessage()))); }
/** * Send request to UPS. * * @param string $access The access request xml * @param string $request The request xml * @param string $endpointurl The UPS API Endpoint URL * @param string $operation Operation to perform on SOAP endpoint * @param string $wsdl Which WSDL file to use * * @throws Exception * @todo: make access, request and endpointurl nullable to make the testable * * @return ResponseInterface */ public function request($access, $request, $endpointurl, $operation = null, $wsdl = null) { // Check for operation if (is_null($operation)) { throw new \Exception('Operation is required'); } // Check for WSDL if (is_null($wsdl)) { throw new \Exception('WSDL is required'); } // Set data $this->setAccess($access); $this->setRequest($request); $this->setEndpointUrl($endpointurl); // Settings based on UPS PHP Example $mode = array('soap_version' => 'SOAP_1_1', 'trace' => 1, 'connection_timeout' => 2, 'cache_wsdl' => WSDL_CACHE_BOTH); // Initialize soap client $client = new SoapClient(__DIR__ . '/WSDL/' . $wsdl . '.wsdl', $mode); // Set endpoint URL + auth & request data $client->__setLocation($endpointurl); $auth = (array) new SimpleXMLElement($access); $request = (array) new SimpleXMLElement($request); // Build auth header $header = new \SoapHeader('http://www.ups.com/schema/xpci/1.0/auth', 'AccessRequest', $auth); $client->__setSoapHeaders($header); // Log request $date = new DateTime(); $id = $date->format('YmdHisu'); $this->logger->info('Request To UPS API', ['id' => $id, 'endpointurl' => $this->getEndpointUrl()]); $this->logger->debug('Request: ' . $this->getRequest(), ['id' => $id, 'endpointurl' => $this->getEndpointUrl()]); // Perform call and get response try { $request = json_decode(json_encode((array) $request), true); $client->__soapCall($operation, [$request]); $body = $client->__getLastResponse(); $this->logger->info('Response from UPS API', ['id' => $id, 'endpointurl' => $this->getEndpointUrl()]); $this->logger->debug('Response: ' . $body, ['id' => $id, 'endpointurl' => $this->getEndpointUrl()]); // Strip off namespaces and make XML $body = preg_replace('/(<\\/*)[^>:]+:/', '$1', $body); $xml = new SimpleXMLElement($body); $responseInstance = new Response(); return $responseInstance->setText($body)->setResponse($xml); } catch (\Exception $e) { // Parse error response $xml = new SimpleXMLElement($client->__getLastResponse()); $xml->registerXPathNamespace('err', 'http://www.ups.com/schema/xpci/1.0/error'); $errorCode = $xml->xpath('//err:PrimaryErrorCode/err:Code'); $errorMsg = $xml->xpath('//err:PrimaryErrorCode/err:Description'); if (isset($errorCode[0]) && isset($errorMsg[0])) { $this->logger->alert($errorMsg[0], ['id' => $id, 'endpointurl' => $this->getEndpointUrl()]); throw new InvalidResponseException('Failure: ' . (string) $errorMsg[0] . ' (' . (string) $errorCode[0] . ')'); } else { $this->logger->alert($e->getMessage(), ['id' => $id, 'endpointurl' => $this->getEndpointUrl()]); throw new InvalidResponseException('Cannot parse error from UPS: ' . $e->getMessage(), $e->getCode(), $e); } } }
/** * Gets entrance fee model * * @return EntranceFee * * @throws LogicException */ protected function getEntranceFee() { $fee = $this->repository->findEntranceFee(); if (is_null($fee)) { $this->logger->alert('No fee configured'); throw new PaymentMessage('No fee is configured'); } return $fee; }
/** * Get the new module presenter class of the specified name provided. * It contains data from its instance, the disk, the database and from the marketplace if exists. * * @param string $name The technical name of the module * * @return \PrestaShop\PrestaShop\Adapter\Module\Module */ public function getModule($name) { $php_file_path = _PS_MODULE_DIR_ . $name . '/' . $name . '.php'; /* Data which design the module class */ $attributes = array('name' => $name); $disk = array(); $database = array(); // Get filemtime of module main class (We do this directly with an error suppressor to go faster) $current_filemtime = (int) @filemtime($php_file_path); // We check that we have data from the marketplace try { $module_catalog_data = $this->adminModuleProvider->getCatalogModules(array('name' => $name)); $attributes = array_merge($attributes, (array) array_shift($module_catalog_data)); } catch (Exception $e) { $this->logger->alert($this->translator->trans('Loading data from Addons failed. %error_details%', array('%error_details%' => $e->getMessage()), 'Admin.Modules.Notification')); } // Now, we check that cache is up to date if (isset($this->cache[$name]['disk']['filemtime']) && $this->cache[$name]['disk']['filemtime'] === $current_filemtime) { // OK, cache can be loaded and used directly $attributes = array_merge($attributes, $this->cache[$name]['attributes']); $disk = $this->cache[$name]['disk']; } else { // NOPE, we have to fulfil the cache with the module data $disk = array('filemtime' => $current_filemtime, 'filemtime' => $current_filemtime, 'is_present' => (int) $this->moduleProvider->isOnDisk($name), 'is_valid' => 0, 'version' => null); $main_class_attributes = array(); if ($this->moduleProvider->isModuleMainClassValid($name)) { require_once $php_file_path; // We load the main class of the module, and get its properties $tmp_module = \PrestaShop\PrestaShop\Adapter\ServiceLocator::get($name); foreach (array('warning', 'name', 'tab', 'displayName', 'description', 'author', 'author_uri', 'limited_countries', 'need_instance') as $data_to_get) { if (isset($tmp_module->{$data_to_get})) { $main_class_attributes[$data_to_get] = $tmp_module->{$data_to_get}; } } $main_class_attributes['parent_class'] = get_parent_class($name); $main_class_attributes['is_configurable'] = (int) method_exists($tmp_module, 'getContent'); $disk['is_valid'] = 1; $disk['version'] = $tmp_module->version; $attributes = array_merge($attributes, $main_class_attributes); } else { $main_class_attributes['warning'] = 'Invalid module class'; } $this->cache[$name]['attributes'] = $main_class_attributes; $this->cache[$name]['disk'] = $disk; } foreach (array('logo.png', 'logo.gif') as $logo) { $logo_path = _PS_MODULE_DIR_ . $name . DIRECTORY_SEPARATOR . $logo; if (file_exists($logo_path)) { $attributes['img'] = __PS_BASE_URI__ . basename(_PS_MODULE_DIR_) . '/' . $name . '/' . $logo; break; } } // Get data from database $database = $this->moduleProvider->findByName($name); return new Module($attributes, $disk, $database); }
/** * @inheritdoc */ public function authenticateToken(TokenInterface $token, UserProviderInterface $userProvider, $providerKey) { if (!$userProvider instanceof ApiKeyUserProvider) { throw new \InvalidArgumentException(sprintf('The user provider must be an instance of ApiKeyUserProvider (%s was given).', get_class($userProvider))); } $apiKey = $token->getCredentials(); try { $apiKeyInfo = $this->apiKeyManager->getInfoFromApiKey($apiKey); } catch (\Exception $e) { $this->logger->error('Someone is trying to fake the token', [$this->serverBag]); throw new InvalidApiKeyException($apiKey, 0, $e); } $user = $userProvider->loadUserById($apiKeyInfo->id); if ($apiKeyInfo->token !== $user->getToken()) { $this->logger->alert('Someone found the JWT secret and is trying to fake the token', [$this->serverBag]); throw new InvalidApiKeyException($apiKey); } return new PreAuthenticatedToken($user, $apiKey, $providerKey, $user->getRoles()); }
/** * {@inheritdoc} */ public function invalidate(array $caches, array $keys) { foreach ($caches as $cache) { if (!$cache instanceof CacheAdapterInterface) { throw new \RuntimeException('The object must implements the CacheAdapterInterface interface'); } try { if ($this->logger) { $this->logger->info(sprintf('[%s] flushing cache keys : %s', __CLASS__, json_encode($keys))); } $cache->flush($keys); } catch (\Exception $e) { if ($this->logger) { $this->logger->alert(sprintf('[%s] %s', __CLASS__, $e->getMessage())); } else { throw new \RunTimeException(null, null, $e); } } } return true; }
/** * Send request to UPS * * @param string $access The access request xml * @param string $request The request xml * @param string $endpointurl The UPS API Endpoint URL * @return ResponseInterface * @throws Exception * todo: make access, request and endpointurl nullable to make the testable */ public function request($access, $request, $endpointurl) { $this->setAccess($access); $this->setRequest($request); $this->setEndpointUrl($endpointurl); // Log request if ($this->logger) { $date = new \DateTime(); $id = $date->format('YmdHisu'); $this->logger->info('Request To UPS API', array('id' => $id, 'endpointurl' => $this->getEndpointUrl())); $this->logger->debug('Request: ' . $this->getRequest(), array('id' => $id, 'endpointurl' => $this->getEndpointUrl())); } // Create POST request $form = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $this->getAccess() . $this->getRequest())); $request = stream_context_create($form); if (!($handle = fopen($this->getEndpointUrl(), 'rb', false, $request))) { if ($this->logger) { $this->logger->alert('Connection to UPS API failed', array('id' => $id, 'endpointurl' => $this->getEndpointUrl())); } throw new Exception("Failure: Connection to Endpoint URL failed."); } $response = stream_get_contents($handle); fclose($handle); if ($this->logger) { $this->logger->info('Response from UPS API', array('id' => $id, 'endpointurl' => $this->getEndpointUrl())); $this->logger->debug('Response: ' . $response, array('id' => $id, 'endpointurl' => $this->getEndpointUrl())); } if ($response != false) { $text = $response; $response = new SimpleXMLElement($response); if (isset($response->Response) && isset($response->Response->ResponseStatusCode)) { $responseInstance = new Response(); return $responseInstance->setText($text)->setResponse($response); } } if ($this->logger) { $this->logger->critical('UPS Response is invalid', array('id' => $id)); } throw new Exception("Failure: Response is invalid."); }
public function dispatch(Request $request, Response $response, $args) { // ONLY WHEN CALLED THROUGH CLI if (PHP_SAPI !== 'cli') { return $response->withStatus(404)->withHeader('Location', '/404'); } if (!$request->getParam('event')) { return $response->withStatus(404)->withHeader('Location', '/404'); } // Default UserID for the required auth token $userID = 1; // Create talks for approved events try { $result = $this->eventsService->manageApprovedEvents($userID); $this->logger->info(__CLASS__ . ' :: ' . $result); echo $result; echo PHP_EOL; } catch (\Exception $e) { echo __CLASS__ . ' :: ERROR :: ' . $e->getMessage() . PHP_EOL; $this->logger->alert(__CLASS__ . ' :: ' . $e->getMessage()); } exit; }
/** * @expectedException \AppBundle\Exception\InvalidApiKeyException * @expectedExceptionMessage API key `apiKey` is invalid */ public function testAuthenticateTokenThrowsExceptionForFakeToken() { $userProvider = $this->prophesize('AppBundle\\Security\\ApiKeyUserProvider'); $token = $this->prophesize('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface'); $user = $this->prophesize('AppBundle\\Entity\\User'); $token->getCredentials()->willReturn('apiKey'); $apiKeyInfo = new \stdClass(); $apiKeyInfo->id = 1; $apiKeyInfo->token = 'userToken1'; $this->apiKeyManager->getInfoFromApiKey('apiKey')->willReturn($apiKeyInfo); $userProvider->loadUserById(1)->willReturn($user); $user->getToken()->willReturn('userToken2'); $this->logger->alert(Argument::cetera())->shouldBeCalled(); $this->apiKeyAuthenticator->authenticateToken($token->reveal(), $userProvider->reveal(), 'key'); }