Test Failed
Push — master ( a5a28b...999969 )
by Marcin
02:51
created

App::setLoggerInstance()   A

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 1
1
<?php
2
/**
3
 * Grandstream-XMLApp
4
 *
5
 * Copyright (c) 2017 pudelek.org.pl
6
 *
7
 * @license MIT License (MIT)
8
 *
9
 * For the full copyright and license information, please view source file
10
 * that is bundled with this package in the file LICENSE
11
 *
12
 * @author  Marcin Pudełek <[email protected]>
13
 */
14
15
namespace mrcnpdlk\Grandstream\XMLApp;
16
17
18
use Psr\Log\LoggerInterface;
19
use Psr\Log\NullLogger;
20
use Psr\SimpleCache\CacheInterface;
21
22
class App
23
{
24
    /**
25
     * @var LoggerInterface
26
     */
27
    private $oLogger;
28
    /**
29
     * @var CacheInterface
30
     */
31
    private $oCache;
32
33
    public function __construct()
34
    {
35
    }
36
37
    /**
38
     * Set Logger handler (PSR-3)
39
     *
40
     * @param \Psr\Log\LoggerInterface|null $oLogger
41
     *
42
     * @return $this
43
     */
44
    public function setLoggerInstance(LoggerInterface $oLogger = null)
45
    {
46
        $this->oLogger = $oLogger ?: new NullLogger();
47
48
        return $this;
49
    }
50
51
    /**
52
     * Set Cache handler (PSR-16)
53
     *
54
     * @param CacheInterface|null $oCache
55
     *
56
     * @return \mrcnpdlk\Grandstream\XMLApp\App
57
     * @see https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-16-simple-cache.md PSR-16
58
     */
59
    public function setCacheInstance(CacheInterface $oCache = null)
60
    {
61
        $this->oCache = $oCache;
62
63
        return $this;
64
    }
65
66
    /**
67
     * @return \Psr\Log\LoggerInterface
68
     */
69
    public function getLogger()
70
    {
71
        return $this->oLogger;
72
    }
73
}
74