Completed
Push — master ( ab8175...d69783 )
by Kamil
15s
created

LoggerListener   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A beforeSuite() 0 4 1
A beforeFixture() 0 4 1
A getName() 0 4 1
A configureOptionsNode() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\FixturesBundle\Listener;
13
14
use Psr\Log\LoggerInterface;
15
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
16
17
/**
18
 * @author Kamil Kokot <[email protected]>
19
 */
20
final class LoggerListener extends AbstractListener implements BeforeSuiteListenerInterface, BeforeFixtureListenerInterface
21
{
22
    /**
23
     * @var LoggerInterface
24
     */
25
    private $logger;
26
27
    /**
28
     * @param LoggerInterface $logger
29
     */
30
    public function __construct(LoggerInterface $logger)
31
    {
32
        $this->logger = $logger;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function beforeSuite(SuiteEvent $suiteEvent, array $options)
39
    {
40
        $this->logger->notice(sprintf('Running suite "%s"...', $suiteEvent->suite()->getName()));
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function beforeFixture(FixtureEvent $fixtureEvent, array $options)
47
    {
48
        $this->logger->notice(sprintf('Running fixture "%s"...', $fixtureEvent->fixture()->getName()));
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function getName()
55
    {
56
        return 'logger';
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62
    protected function configureOptionsNode(ArrayNodeDefinition $optionsNode)
63
    {
64
        // left blank
65
    }
66
}
67