Passed
Push — master ( aaaf0e...6c38be )
by Alex
01:04 queued 12s
created

FilterManager::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\LaminasDoctrineQueryFilter\Filter;
6
7
use Arp\DoctrineQueryFilter\Filter\FilterFactoryInterface;
8
use Arp\DoctrineQueryFilter\Filter\FilterInterface;
9
use Arp\DoctrineQueryFilter\QueryFilterManagerInterface;
10
use Laminas\ServiceManager\AbstractPluginManager;
11
use Psr\Container\ContainerExceptionInterface;
12
13
/**
14
 * @author  Alex Patterson <[email protected]>
15
 * @package Arp\LaminasDoctrineQueryFilter
16
 */
17
class FilterManager extends AbstractPluginManager implements FilterFactoryInterface
18
{
19
    /**
20
     * @var class-string<FilterInterface>
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<FilterInterface> at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<FilterInterface>.
Loading history...
21
     */
22
    protected $instanceOf = FilterInterface::class;
23
24
    /**
25
     * @param QueryFilterManagerInterface $manager
26
     * @param string                      $name
27
     * @param array<mixed>                $options
28
     *
29
     * @return FilterInterface
30
     *
31
     * @throws ContainerExceptionInterface
32
     */
33
    public function create(QueryFilterManagerInterface $manager, string $name, array $options = []): FilterInterface
34
    {
35
        return $this->build(
36
            $name,
37
            array_replace_recursive($options, ['query_filter_manager' => $manager])
38
        );
39
    }
40
}
41