Completed
Push — master ( d1f4bd...fa732c )
by Ross
8s
created

ClassPropertiesFormatter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 5
Bugs 0 Features 1
Metric Value
wmc 3
c 5
b 0
f 1
lcom 1
cbo 3
dl 0
loc 23
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A commandContext() 0 4 1
1
<?php
2
namespace League\Tactician\Logger\Formatter;
3
4
use League\Tactician\Logger\PropertyNormalizer\PropertyNormalizer;
5
use League\Tactician\Logger\PropertyNormalizer\SimplePropertyNormalizer;
6
use Exception;
7
8
/**
9
 * Formatter that includes the Command's name and properties for more detail
10
 */
11
class ClassPropertiesFormatter extends ClassNameFormatter
12
{
13
    /**
14
     * @var PropertyNormalizer
15
     */
16
    private $normalizer;
17
18
    /**
19
     * @param PropertyNormalizer $normalizer
20
     */
21
    public function __construct(PropertyNormalizer $normalizer = null)
22
    {
23
        $this->normalizer = $normalizer ?: new SimplePropertyNormalizer();
24
    }
25
26
    /**
27
     * {@inheritDoc}
28
     */
29
    public function commandContext($command)
30
    {
31
        return $this->normalizer->normalize($command) + parent::commandContext($command);
32
    }
33
}
34