Completed
Pull Request — 4.2 (#140)
by David
26:56
created

GeneratorEventDispatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A onGenerate() 0 6 2
1
<?php
2
3
4
namespace Mouf\Database\TDBM\Utils;
5
6
use Mouf\Database\TDBM\ConfigurationInterface;
7
8
class GeneratorEventDispatcher implements GeneratorListenerInterface
9
{
10
    /**
11
     * @var GeneratorListenerInterface[]
12
     */
13
    private $listeners;
14
15
    /**
16
     * GeneratorEventDispatcher constructor.
17
     * @param GeneratorListenerInterface[] $listeners
18
     */
19
    public function __construct(array $listeners)
20
    {
21
        $this->listeners = $listeners;
22
    }
23
24
    /**
25
     * @param ConfigurationInterface $configuration
26
     * @param BeanDescriptorInterface[] $beanDescriptors
27
     */
28
    public function onGenerate(ConfigurationInterface $configuration, array $beanDescriptors): void
29
    {
30
        foreach ($this->listeners as $listener) {
31
            $listener->onGenerate($configuration, $beanDescriptors);
32
        }
33
    }
34
}
35