LoggerTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setLogger() 0 6 1
A log() 0 6 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