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.
Completed
Pull Request — master (#13)
by Evgeny
09:21
created

Object::setLogger()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace SimaLand\API;
4
5
use Monolog\Handler\StreamHandler;
6
use Monolog\Logger;
7
8
/**
9
 * Базовый класс.
10
 */
11
class Object
12
{
13
    /**
14
     * Наименование лога.
15
     */
16
    const LOGGER_NAME = 'SimaAPI';
17
18
    /**
19
     * @var \Psr\Log\LoggerInterface
20
     */
21
    private $logger;
22
23
    /**
24
     * @param array $options
25
     */
26 93
    public function __construct(array $options = [])
27
    {
28 93
        foreach ($options as $key => $value) {
29 93
            $setter = 'set' . ucfirst($key);
30 93
            if (method_exists($this, $setter)) {
31 81
                call_user_func([$this, $setter], $value);
32 81
                continue;
33
            }
34 90
            $this->{$key} = $value;
35 93
        }
36 93
    }
37
38
    /**
39
     * Получить логгер.
40
     *
41
     * @return \Psr\Log\LoggerInterface
42
     */
43 57
    public function getLogger()
44
    {
45 57
        if (is_null($this->logger)) {
46 3
            $this->logger = new Logger(self::LOGGER_NAME);
47 3
            $this->logger->pushHandler(new StreamHandler('php://output'));
48 3
        }
49 57
        return $this->logger;
50
    }
51
52
    /**
53
     * Установить логгер.
54
     *
55
     * @param \Psr\Log\LoggerInterface $logger
56
     * @return $this
57
     */
58 81
    public function setLogger(\Psr\Log\LoggerInterface $logger)
59
    {
60 81
        $this->logger = $logger;
61 81
        return $this;
62
    }
63
}
64