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

ClassPropertiesFormatter::commandContext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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