Test Failed
Push — master ( 127461...bb3ac0 )
by Daniel
03:58
created

getCollection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Components Bundle Project
5
 *
6
 * (c) Daniel West <[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 Silverback\ApiComponentsBundle\DataProvider\Collection;
15
16
use ApiPlatform\Core\DataProvider\CollectionDataProviderInterface;
17
use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface;
18
use Silverback\ApiComponentsBundle\Metadata\PageDataMetadata;
19
use Silverback\ApiComponentsBundle\Metadata\Provider\PageDataMetadataProvider;
20
21
/**
22
 * @author Daniel West <[email protected]>
23
 */
24
class PageDataMetadataCollectionProvider implements CollectionDataProviderInterface, RestrictedDataProviderInterface
25
{
26
    private PageDataMetadataProvider $pageDataMetadataProvider;
27
28
    public function __construct(PageDataMetadataProvider $pageDataMetadataProvider)
29
    {
30
        $this->pageDataMetadataProvider = $pageDataMetadataProvider;
31
    }
32
33
    public function getCollection(string $resourceClass, string $operationName = null)
34
    {
35
        return $this->pageDataMetadataProvider->createAll();
36
    }
37
38
    public function supports(string $resourceClass, string $operationName = null, array $context = []): bool
39
    {
40
        return PageDataMetadata::class === $resourceClass;
41
    }
42
}
43