Completed
Push — master ( 6695d4...9bc3b7 )
by Harry
04:41
created

OptionalLoggerTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 18
ccs 3
cts 4
cp 0.75
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A log() 0 6 2
1
<?php
2
3
namespace Graze\DataFile\Helper;
4
5
use Psr\Log\LoggerAwareTrait;
6
7
trait OptionalLoggerTrait
8
{
9
    use LoggerAwareTrait;
10
11
    /**
12
     * Send a log message only if we have a logger instantiated
13
     *
14
     * @param string $level
15
     * @param string $message
16
     * @param array  $context
17
     */
18 67
    protected function log($level, $message, array $context = [])
19
    {
20 67
        if ($this->logger) {
21
            $this->logger->log($level, __CLASS__ . ":" . $message, $context);
22
        }
23 67
    }
24
}
25