Passed
Push — main ( 964870...8374cd )
by Daniel
08:40 queued 03:10
created

PublishableAttributeReader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 13
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfiguration() 0 8 2
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\AttributeReader;
15
16
use Silverback\ApiComponentsBundle\Annotation\Publishable;
17
18
/**
19
 * @author Vincent Chalamon <[email protected]>
20
 */
21
final class PublishableAttributeReader extends AttributeReader
22
{
23
    /**
24
     * @throws \ReflectionException
25
     */
26
    public function getConfiguration(object|string $class): Publishable
27
    {
28
        $publishable = $this->getClassAttributeConfiguration($class, Publishable::class);
29
        if (!$publishable instanceof Publishable) {
30
            throw new \LogicException(sprintf('getClassAnnotationConfiguration should return the type %s', Publishable::class));
31
        }
32
33
        return $publishable;
34
    }
35
}
36