Completed
Pull Request — master (#3)
by Mihail
10:52
created

Cli::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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.
17
 *
18
 */
19
class Cli extends Processor
20
{
21
    protected string $format = '> [timestamp][levelname] - message';
22
23
    /** @var resource */
24
    private $handle;
25
26
    public function __construct(array $settings)
27 1
    {
28
        parent::__construct($settings);
29 1
        $this->handle = \defined('STDERR') ? STDERR : \fopen('php://stderr', 'w');
30 1
    }
31 1
32
    protected function process(array $message): void
33 1
    {
34
        \fwrite($this->handle, \strtr($this->format, $message) . PHP_EOL);
35 1
    }
36
}
37