GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

LoggerTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setLogger() 0 6 1
A logInfo() 0 8 2
1
<?php
2
3
namespace Ozean12\GooglePubSubBundle\Service;
4
5
use Psr\Log\LoggerInterface;
6
7
/**
8
 * Class LoggerTrait
9
 */
10
trait LoggerTrait
11
{
12
    /**
13
     * @var LoggerInterface
14
     */
15
    private $logger;
16
17
    /**
18
     * @param LoggerInterface $logger
19
     * @return AbstractClient
20
     */
21
    public function setLogger(LoggerInterface $logger)
22
    {
23
        $this->logger = $logger;
24
25
        return $this;
26
    }
27
28
    /**
29
     * A proxy to logger->info() method
30
     * Ensures that logging is enabled
31
     *
32
     * @param string $message
33
     * @param array  $context
34
     */
35
    protected function logInfo($message, $context)
36
    {
37
        if (is_null($this->logger)) {
38
            return;
39
        }
40
41
        $this->logger->info($message, $context);
42
    }
43
}
44