Passed
Push — sheepy/introspection ( 69e16c...c6c7ca )
by Marco
05:28
created

LoggerTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getLogger() 0 7 2
A setLogger() 0 3 1
1
<?php
2
3
4
namespace Firesphere\SolrSearch\Traits;
5
6
use Psr\Log\LoggerInterface;
7
use SilverStripe\Core\Injector\Injector;
8
9
trait LoggerTrait
10
{
11
    /**
12
     * @var LoggerInterface
13
     */
14
    protected $logger;
15
16
    /**
17
     * @return LoggerInterface
18
     */
19
    public function getLogger()
20
    {
21
        if (!$this->logger) {
22
            $this->logger = Injector::inst()->get(LoggerInterface::class);
23
        }
24
25
        return $this->logger;
26
    }
27
28
    /**
29
     * @param LoggerInterface $logger
30
     */
31
    public function setLogger($logger): void
32
    {
33
        $this->logger = $logger;
34
    }
35
}
36