diff --git a/src/Logger.php b/src/Logger.php index 3f75e9cd..6f67192c 100644 --- a/src/Logger.php +++ b/src/Logger.php @@ -132,11 +132,10 @@ public function __construct(array $options = null) } if (is_array($options)) { + if (isset($options['writers']) && is_array($options['writers'])) { + foreach ($options['writers'] as $writer) { - if(isset($options['writers']) && is_array($options['writers'])) { - foreach($options['writers'] as $writer) { - - if(!isset($writer['name'])) { + if (!isset($writer['name'])) { throw new Exception\InvalidArgumentException('Options must contain a name for the writer'); } @@ -147,11 +146,11 @@ public function __construct(array $options = null) } } - if(isset($options['exceptionhandler']) && $options['exceptionhandler'] === true) { + if (isset($options['exceptionhandler']) && $options['exceptionhandler'] === true) { self::registerExceptionHandler($this); } - if(isset($options['errorhandler']) && $options['errorhandler'] === true) { + if (isset($options['errorhandler']) && $options['errorhandler'] === true) { self::registerErrorHandler($this); } @@ -410,7 +409,7 @@ public function log($priority, $message, $extra = array()) 'extra' => $extra ); - foreach($this->processors->toArray() as $processor) { + foreach ($this->processors->toArray() as $processor) { $event = $processor->process($event); } diff --git a/src/Writer/AbstractWriter.php b/src/Writer/AbstractWriter.php index 8a10475a..3ca1d44e 100644 --- a/src/Writer/AbstractWriter.php +++ b/src/Writer/AbstractWriter.php @@ -77,17 +77,16 @@ public function __construct($options = null) } if (is_array($options)) { - - if(isset($options['filters'])) { + if (isset($options['filters'])) { $filters = $options['filters']; - if(is_string($filters) || $filters instanceof Filter\FilterInterface) { + if (is_string($filters) || $filters instanceof Filter\FilterInterface) { $this->addFilter($filters); - } elseif(is_array($filters)) { - foreach($filters as $filter) { - if(is_string($filter) || $filter instanceof Filter\FilterInterface) { + } elseif (is_array($filters)) { + foreach ($filters as $filter) { + if (is_string($filter) || $filter instanceof Filter\FilterInterface) { $this->addFilter($filter); - } elseif(is_array($filter)) { - if(!isset($filter['name'])) { + } elseif (is_array($filter)) { + if (!isset($filter['name'])) { throw new Exception\InvalidArgumentException('Options must contain a name for the filter'); } $filterOptions = (isset($filter['options'])) ? $filter['options'] : null; @@ -97,12 +96,12 @@ public function __construct($options = null) } } - if(isset($options['formatter'])) { + if (isset($options['formatter'])) { $formatter = $options['formatter']; - if(is_string($formatter) || $formatter instanceof Formatter\FormatterInterface) { + if (is_string($formatter) || $formatter instanceof Formatter\FormatterInterface) { $this->setFormatter($formatter); - } elseif(is_array($formatter)) { - if(!isset($formatter['name'])) { + } else if(is_array($formatter)) { + if (!isset($formatter['name'])) { throw new Exception\InvalidArgumentException('Options must contain a name for the formatter'); } $formatterOptions = (isset($formatter['options'])) ? $formatter['options'] : null; diff --git a/src/Writer/ChromePhp.php b/src/Writer/ChromePhp.php index 7b7cb9b0..97f8522b 100644 --- a/src/Writer/ChromePhp.php +++ b/src/Writer/ChromePhp.php @@ -42,7 +42,7 @@ public function __construct($instance = null) $instance = isset($instance['instance']) ? $instance['instance'] : null; } - if(!($instance instanceof ChromePhpInterface || $instance === null)) { + if (!($instance instanceof ChromePhpInterface || $instance === null)) { throw new Exception\InvalidArgumentException('You must pass a valid Zend\Log\Writer\ChromePhp\ChromePhpInterface'); } diff --git a/src/Writer/Mail.php b/src/Writer/Mail.php index 90dbb8e8..337bc38e 100644 --- a/src/Writer/Mail.php +++ b/src/Writer/Mail.php @@ -109,7 +109,7 @@ public function __construct($mail, Transport\TransportInterface $transport = nul } $this->setTransport($transport); - if($this->formatter === null) { + if ($this->formatter === null) { $this->formatter = new SimpleFormatter(); } } diff --git a/src/Writer/Stream.php b/src/Writer/Stream.php index 3285a105..1f84861d 100644 --- a/src/Writer/Stream.php +++ b/src/Writer/Stream.php @@ -91,7 +91,7 @@ public function __construct($streamOrUrl, $mode = null, $logSeparator = null) $this->setLogSeparator($logSeparator); } - if($this->formatter === null) { + if ($this->formatter === null) { $this->formatter = new SimpleFormatter(); } } diff --git a/src/Writer/Syslog.php b/src/Writer/Syslog.php index f02b940f..e8133316 100644 --- a/src/Writer/Syslog.php +++ b/src/Writer/Syslog.php @@ -108,7 +108,7 @@ public function __construct($params = null) $this->initializeSyslog(); } - if($this->formatter === null) { + if ($this->formatter === null) { $this->setFormatter(new SimpleFormatter('%message%')); } }