LoggerTrait::log()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 2
1
<?php
2
3
namespace Kuleuven\AuthenticationBundle\Traits;
4
5
use Psr\Log\LoggerInterface;
6
7
trait LoggerTrait
8
{
9
    /**
10
     * @var LoggerInterface
11
     */
12
    protected $logger;
13
14
    /**
15
     * @param LoggerInterface $logger
16
     * @return $this
17
     */
18
    public function setLogger(LoggerInterface $logger)
19
    {
20
        $this->logger = $logger;
21
22
        return $this;
23
    }
24
25
    /**
26
     * @param string $message
27
     * @param string $type
28
     */
29
    protected function log($message, $type = 'info')
30
    {
31
        if (null !== $this->logger) {
32
            $this->logger->$type($message);
33
        }
34
    }
35
}
36