Completed
Push — master ( efa801...d3c12f )
by Mihail
12s queued 11s
created

Cli   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 3
b 0
f 0
dl 0
loc 18
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 4 2
A __construct() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Koded package.
5
 *
6
 * (c) Mihail Binev <[email protected]>
7
 *
8
 * Please view the LICENSE distributed with this source code
9
 * for the full copyright and license information.
10
 *
11
 */
12
13
namespace Koded\Logging\Processors;
14
15
/**
16
 * Log processor for CLI apps.
17
 *
18
 */
19
class Cli extends Processor
20
{
21
    /** @var string Message format */
22
    protected $format = '> [timestamp][levelname] - message';
23
24
    /** @var bool */
25
    private $buffer;
26
27 1
    public function __construct(array $settings)
28
    {
29 1
        parent::__construct($settings);
30 1
        $this->buffer = defined('STDERR');
31 1
    }
32
33 1
    protected function parse(array $message): void
34
    {
35 1
        if ($this->buffer) {
36 1
            fwrite(STDERR, strtr($this->format, $message) . PHP_EOL);
37
        }
38 1
    }
39
}
40