LoggerTrait::setLogger()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php declare(strict_types=1);
2
3
namespace Terah\ColourLog;
4
5
use Psr\Log\LoggerInterface;
6
7
/**
8
 * Basic Implementation of LoggerAwareInterface.
9
 */
10
trait LoggerTrait
11
{
12
    /** @var LoggerInterface */
13
    protected $logger;
14
15
    /**
16
     * Sets a logger.
17
     *
18
     * @param LoggerInterface $logger
19
     * @return $this
20
     */
21
    public function setLogger(LoggerInterface $logger)
22
    {
23
        $this->logger = $logger;
24
25
        return $this;
26
    }
27
28
    /**
29
     * Gets a logger.
30
     *
31
     * @return LoggerInterface
32
     */
33
    public function getLogger() : LoggerInterface
34
    {
35
        return $this->logger;
36
    }
37
}
38