These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the API Platform project. |
||
5 | * |
||
6 | * (c) Kévin Dunglas <[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 | declare(strict_types=1); |
||
13 | |||
14 | namespace ApiPlatform\Core\Api; |
||
15 | |||
16 | use Psr\Container\ContainerInterface; |
||
17 | |||
18 | /** |
||
19 | * Filter collection factory. |
||
20 | * |
||
21 | * @author Baptiste Meyer <[email protected]> |
||
22 | * |
||
23 | * @internal |
||
24 | */ |
||
25 | class FilterCollectionFactory |
||
26 | { |
||
27 | private $filtersIds; |
||
28 | |||
29 | /** |
||
30 | * @param string[] $filtersIds |
||
31 | */ |
||
32 | public function __construct(array $filtersIds) |
||
33 | { |
||
34 | $this->filtersIds = $filtersIds; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Creates a filter collection from a filter locator. |
||
39 | * |
||
40 | * @param ContainerInterface $filterLocator |
||
41 | * |
||
42 | * @return FilterCollection |
||
43 | */ |
||
44 | public function createFilterCollectionFromLocator(ContainerInterface $filterLocator): FilterCollection |
||
45 | { |
||
46 | $filters = []; |
||
47 | |||
48 | foreach ($this->filtersIds as $filterId) { |
||
49 | if ($filterLocator->has($filterId)) { |
||
50 | $filters[$filterId] = $filterLocator->get($filterId); |
||
51 | } |
||
52 | } |
||
53 | |||
54 | return new FilterCollection($filters); |
||
1 ignored issue
–
show
|
|||
55 | } |
||
56 | } |
||
57 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.