hasParameter($params, '-nc') || $this->hasParameter($params, '--no-color')) { $this->hideColors = true; } } /** * Return the Psr3 logger level minimum to send log to logger * * @return string */ abstract protected function getMinimumLogLevel(); /** * Propagate the argument process to Action * To load a verbose logger, a check is done Action interfaces to find LoggerInterface * The verbose logger is loaded with the minimum level requires * * @param Action $action */ public function load(Action $action) { if ($action instanceof LoggerAwareInterface) { $action->setLogger( $this->getServiceLocator()->get(LoggerService::SERVICE_ID) ->addLogger( $this->hideColors ? new VerboseLogger($this->getMinimumLogLevel()) : new ColoredVerboseLogger($this->getMinimumLogLevel()) ) ); } } /** * Find a parameter $name into $params arguments * If $value is defined, check if following parameter equals to given $value * * @param array $params * @param $name * @param null $value * @return bool */ protected function hasParameter(array $params, $name, $value = null) { $found = in_array($name, $params); if (is_null($value) || !$found) { return $found; } $paramValueIndex = array_search($name, $params) + 1; return isset($params[$paramValueIndex]) && ($params[$paramValueIndex] == $value); } }