WriteLogs   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 3
c 2
b 0
f 1
dl 0
loc 30
rs 10
ccs 0
cts 5
cp 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A writeLog() 0 3 1
A log() 0 3 1
1
<?php
2
3
namespace Nip\Logger\Manager;
4
5
use Nip\Logger\Logger;
6
use Psr\Log\LoggerInterface;
7
8
/**
9
 * Class WriteLogs
10
 * @package Nip\Logger\Traits
11
 */
12
trait WriteLogs
13
{
14
15
    /**
16
     * @inheritdoc
17
     */
18
    public function log($level, $message, array $context = [])
19
    {
20
        $this->writeLog($level, $message, $context);
21
    }
22
23
    /**
24
     * Write a message to Monolog.
25
     *
26
     * @param string $level
27
     * @param string $message
28
     * @param array  $context
29
     *
30
     * @return bool
31
     */
32
    protected function writeLog($level, $message, $context)
33
    {
34
        return $this->driver()->{$level}($message, $context);
35
    }
36
37
    /**
38
     * @param string|null $driver
39
     * @return Logger|LoggerInterface
40
     */
41
    abstract public function driver($driver = null);
42
}
43