ProviderFactory::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 9
ccs 7
cts 7
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 *  This file is part of the Micro framework package.
5
 *
6
 *  (c) Stanislau Komar <[email protected]>
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 Micro\Plugin\EventEmitter\Business\Provider;
13
14
use Micro\Component\DependencyInjection\Autowire\AutowireHelperInterface;
15
use Micro\Component\EventEmitter\ListenerProviderInterface;
16
use Micro\Plugin\EventEmitter\Business\Locator\EventListenerClassLocatorFactoryInterface;
17
18
class ProviderFactory implements ProviderFactoryInterface
19
{
20 1
    public function __construct(
21
        private readonly AutowireHelperInterface $autowireHelper,
22
        private readonly EventListenerClassLocatorFactoryInterface $eventListenerClassLocatorFactory
23
    ) {
24 1
    }
25
26
    /**
27
     *{@inheritDoc}
28
     */
29 1
    public function create(): ListenerProviderInterface
30
    {
31 1
        $listeners = $this->eventListenerClassLocatorFactory
32 1
            ->create()
33 1
            ->lookupListenerClasses();
34
35 1
        return new ApplicationListenerProvider(
36 1
            $this->autowireHelper,
37 1
            $listeners
38 1
        );
39
    }
40
}
41