/** * <p>Find and return the <code>ForwardConfig</code> instance defining how * forwarding to the specified logical name should be handled. This is * performed by checking local and then global configurations for the * specified forwarding configuration. If no forwarding configuration can * be found, return <code>null</code>.</p> * * @param forwardName string Logical name of the forwarding instance to be * returned * @return \Phruts\Config\ForwardConfig The local or global forward with the specified name. */ public function findForward($forwardName) { $config = $this->findForwardConfig($forwardName); if (empty($config)) { $config = $this->getModuleConfig()->findForwardConfig($forwardName); } if (empty($config)) { if (!empty($this->log)) { $this->log->warn("Unable to find '" + $forwardName + "' forward."); } } return $config; }
/** * Pop the top object off of the parameters stack, and return it * * If the are no objects on the stack, return null. The parameters stack * is used to store CallMethodRule parameters. * * @return object */ public function popParams() { $object = array_pop($this->params); if (is_null($object)) { if (!empty($this->logger)) { $this->logger->warn('Empty stack (returning null)'); } } return $object; }
/** * Main function * * @return type */ public function __invoke() { if (is_null($this->reportWriter)) { $this->logger->warn('no report writer specified, proceeding...'); //$this->reportWriter = new \NoopReportWriter; } if (empty($this->checkers)) { $this->logger->warn('Nothing to check. Exiting.'); return; } $this->label = $this->getOrCreateLabel(self::LABEL_NAME); return; $this->dealWithFirstRunOfTheDay(); $urlsWithEntity = []; foreach ($this->checkers as $check) { switch ($check) { case self::ADS: $ads = $this->getAds(); foreach ($ads as $ad) { $urlsWithEntity[$ad->ad->url] = ['field' => 'url', 'entity' => $ad]; $urlsWithEntity[$ad->ad->displayUrl] = ['field' => 'displayUrl', 'entity' => $ad]; } break; } } $results = $this->checkUrls($urlsWithEntity); foreach ($results as $result) { $entity = $result['entity']; $entity->labels[] = $this->label; $adLabel = new \AdGroupAdLabel(); $adLabel->adGroupId = $entity->adGroupId; $adLabel->adId = $entity->ad->id; $adLabel->labelId = $this->label->id; $operation = new \AdGroupAdLabelOperation(); $operation->operand = $adLabel; $operation->operator = 'ADD'; $this->adwords->getService('AdGroupAdService')->mutate([$operation]); } //$this->reportWriter->finish(); //$this->notifyAboutReport(); //$this->logger->log('Finished. All done for the day!'); }
public function onRollback(UnitOfWorkInterface $unitOfWork, \Exception $failureCause = null) { try { if ($this->getTerminalProperty('isTransactional')) { $this->channel->tx_rollback(); } } catch (\Exception $ex) { $this->logger->warn("Unable to rollback transaction on channel.", $ex); } $this->closeTerminal(); $this->isOpen = false; }
public function readEvents($type, $identifier) { $snapshotScn = -1; $snapshotEvent = null; $lastSnapshotEvent = $this->entryStore->loadLastSnapshotEvent($type, $identifier, $this->entityManager); if (null !== $lastSnapshotEvent) { try { $snapshotEvent = new GenericDomainEventMessage($identifier, $lastSnapshotEvent->getScn(), $this->serializer->deserialize($lastSnapshotEvent->getPayload()), $this->serializer->deserialize($lastSnapshotEvent->getMetaData())); $snapshotScn = $snapshotEvent->getScn(); } catch (\RuntimeException $ex) { $this->logger->warn("Error while reading snapshot event entry. " . "Reconstructing aggregate on entire event stream. Caused by: {class} {message}", array('class' => get_class($ex), 'message' => $ex->getMessage())); } } $entries = $this->entryStore->fetchAggregateStream($type, $identifier, $snapshotScn, $this->batchSize, $this->entityManager); if ($snapshotEvent === null && !$entries->valid()) { throw new EventStreamNotFoundException($type, $identifier); } return new OrmDomainEventStream($this->serializer, $entries, $identifier, $snapshotEvent); }
/** * @param $status * * @return bool */ private function watchdogProcessStatus($status) { switch (true) { case pcntl_wifexited($status): $code = pcntl_wexitstatus($status); $this->handleProcessExitStatus($this->watchdogPID, self::PROCESS_TYPE_WATCHDOG, $code); return true; case pcntl_wifsignaled($status): $sig = pcntl_wtermsig($status); if ($sig !== SIGKILL) { $this->logger->warn(sprintf("watchdog %d terminated with unhandled signal %s\n", $this->watchdogPID, pcntl_sig_name($sig))); } return true; case pcntl_wifstopped($status): $sig = pcntl_wstopsig($status); $this->logger->warn(sprintf("watchdog %d was stopped with signal %s\n", $this->watchdogPID, pcntl_sig_name($sig))); return false; default: $this->logger->error(sprintf("unexpected status for watchdog %d; exiting\n", $this->childPID)); exit(1); } }
/** * Adds a log record at the `WARNING` level. * * This method allows for compatibility with common interfaces. * * @param string $message log message * @param array $placeholders placeholders for replacement * @return bool Whether the record has been processed */ protected function warnInternal($message, array $placeholders = []) { return $this->logger->warn(StringHelper::replace($message, $placeholders, false), $placeholders); }