Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 23 deletions.
13 changes: 6 additions & 7 deletions src/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down
23 changes: 11 additions & 12 deletions src/Writer/AbstractWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Writer/ChromePhp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Writer/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Writer/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Writer/Syslog.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function __construct($params = null)
$this->initializeSyslog();
}

if($this->formatter === null) {
if ($this->formatter === null) {
$this->setFormatter(new SimpleFormatter('%message%'));
}
}
Expand Down

0 comments on commit 18ca28d

Please sign in to comment.