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

ClassPropertiesFormatter::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
rs 10
cc 2
eloc 2
nc 2
nop 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