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

PublishableAnnotationReader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 15
ccs 4
cts 5
cp 0.8
rs 10
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\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