Completed
Push — 3.0 ( fea5eb...c29f0e )
by Vermeulen
02:17
created

Monolog::getMonolog()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace BFW\Core\AppSystems;
4
5
class Monolog extends AbstractSystem
6
{
7
    /**
8
     * @var \BFW\Monolog|null $monolog The monolog system for bfw channel
9
     */
10
    protected $monolog;
11
    
12
    /**
13
     * {@inheritdoc}
14
     * 
15
     * @return \BFW\Monolog|null
16
     */
17
    public function __invoke()
18
    {
19
        return $this->monolog;
20
    }
21
22
    /**
23
     * @return \BFW\Monolog|null
24
     */
25
    public function getMonolog()
26
    {
27
        return $this->monolog;
28
    }
29
    
30
    /**
31
     * {@inheritdoc}
32
     * Initialize all monolog handlers declared for bfw channel
33
     */
34
    public function init()
35
    {
36
        $config        = \BFW\Application::getInstance()->getConfig();
0 ignored issues
show
Documentation Bug introduced by
The method getConfig does not exist on object<BFW\Application>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
37
        $this->monolog = new \BFW\Monolog('bfw', $config);
38
        $this->monolog->addAllHandlers('handlers', 'monolog.php');
39
        
40
        $this->monolog->getLogger()->debug(
41
            'Currently during the initialization framework step.'
42
        );
43
        
44
        $this->initStatus = true;
45
    }
46
}
47