FormatterConstructorTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getMsg() 0 3 1
A getLevel() 0 3 1
1
<?php
2
/**
3
 * @codingStandardsIgnoreStart
4
 *
5
 * @author       Barney Hanlon <[email protected]>
6
 * @copyright    Barney Hanlon 2017
7
 * @license      https://opensource.org/licenses/MIT
8
 *
9
 * @codingStandardsIgnoreEnd
10
 */
11
12
namespace Shrikeh\GuzzleMiddleware\TimerLogger\Formatter\Traits;
13
14
use Psr\Log\LogLevel;
15
16
/**
17
 * Trait FormatterConstructorTrait.
18
 */
19
trait FormatterConstructorTrait
20
{
21
    /**
22
     * @var string|callable
23
     */
24
    private $msg;
25
26
    /**
27
     * @var string|callable
28
     */
29
    private $level;
30
31
    /**
32
     * StartFormatter constructor.
33
     *
34
     * @param callable        $msg   A callable used to create the message
35
     * @param callable|string $level The level this should be logged at
36
     */
37
    private function __construct(callable $msg, $level = LogLevel::DEBUG)
38
    {
39
        $this->msg = $msg;
40
        $this->level = $level;
41
    }
42
43
    /**
44
     * @return callable|string
45
     */
46
    protected function getMsg()
47
    {
48
        return $this->msg;
49
    }
50
51
    /**
52
     * @return callable|string
53
     */
54
    protected function getLevel()
55
    {
56
        return $this->level;
57
    }
58
}
59