Monolog   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 10 1
A createMonolog() 0 5 1
1
<?php
2
3
namespace BfwSql\Runners;
4
5
/**
6
 * Declare monolog instance for bfw-sql
7
 * It's a runner, so is called when the module is initialized.
8
 * 
9
 * @package bfw-sql
10
 * @author Vermeulen Maxime <[email protected]>
11
 * @version 2.0
12
 */
13
class Monolog extends AbstractRunner
14
{
15
    /**
16
     * {@inheritdoc}
17
     * Run the system to generate the monolog instance
18
     */
19
    public function run()
20
    {
21
        $currentClass          = get_called_class();
22
        $this->module->monolog = $currentClass::createMonolog(
23
            $this->module->getConfig()
24
        );
25
        
26
        $this->module->monolog->addAllHandlers(
27
            'handlers',
28
            'monolog.php'
29
        );
30
    }
31
    
32
    /**
33
     * Create a new \BFW\Monolog instance
34
     * 
35
     * @param \BFW\Config $config
36
     * 
37
     * @return \BFW\Monolog
38
     */
39
    public static function createMonolog(\BFW\Config $config): \BFW\Monolog
40
    {
41
        return new \BFW\Monolog(
42
            'bfw-sql',
43
            $config
44
        );
45
    }
46
}
47