Skip to content

Commit

Permalink
Merge pull request #76 from devosc/master
Browse files Browse the repository at this point in the history
named constructor args
  • Loading branch information
devosc committed Dec 6, 2016
2 parents b91ea5c + 3095652 commit aef52d4
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/Log/Error.php
Expand Up @@ -5,21 +5,33 @@

namespace Mvc5\Log;

use Mvc5\Arg;

class Error
{
/**
* @var null
* @var string
*/
protected $destination = '';

/**
* @var string
*/
protected $extra_headers = '';

/**
* @var int
*/
protected $options = [];
protected $message_type = 0;

/**
* @param array $options
* @param int $message_type
* @param string $destination
* @param string $extra_headers
*/
function __construct(array $options = [])
function __construct($message_type = 0, $destination = '', $extra_headers = '')
{
$this->options = $options;
$this->destination = $destination;
$this->extra_headers = $extra_headers;
$this->message_type = $message_type;
}

/**
Expand All @@ -28,6 +40,6 @@ function __construct(array $options = [])
*/
function __invoke($message)
{
return error_log(...array_values([Arg::MESSAGE => (string) $message] + $this->options));
return error_log((string) $message, $this->message_type, $this->destination, $this->extra_headers);
}
}

0 comments on commit aef52d4

Please sign in to comment.