Passed
Push — main ( 30af20...9663ad )
by Daniel
05:47
created

PublishableAnnotationReader::getConfiguration()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 2
b 0
f 0
nc 2
nop 1
dl 0
loc 8
ccs 4
cts 5
cp 0.8
crap 2.032
rs 10
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\AnnotationReader;
15
16
use Silverback\ApiComponentsBundle\Annotation\Publishable;
17
18
/**
19
 * @author Vincent Chalamon <[email protected]>
20
 */
21
final class PublishableAnnotationReader extends AnnotationReader
22
{
23
    /**
24
     * @param object|string $class
25
     *
26
     * @throws \ReflectionException
27
     */
28 19
    public function getConfiguration($class): Publishable
29
    {
30 19
        $publishable = $this->getClassAnnotationConfiguration($class, Publishable::class);
31 19
        if (!$publishable instanceof Publishable) {
32
            throw new \LogicException(sprintf('getClassAnnotationConfiguration should return the type %s', Publishable::class));
33
        }
34
35 19
        return $publishable;
36
    }
37
}
38