GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AbstractAnnotationReader   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 66
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A init() 0 10 2
A getReader() 0 10 2
A setReader() 0 6 1
1
<?php
2
/**
3
 * @link https://github.com/old-town/workflow-zf2-dispatch
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace OldTown\Workflow\ZF2\Dispatch\Metadata\Reader;
7
8
use OldTown\Workflow\ZF2\Dispatch\Metadata\MetadataInterface;
9
use Doctrine\Common\Annotations\AnnotationRegistry;
10
use Doctrine\Common\Annotations\Reader as DoctrineAnnotationsReaderInterface;
11
use Doctrine\Common\Annotations\AnnotationReader as DoctrineAnnotationReader;
12
use OldTown\Workflow\ZF2\Dispatch\Metadata\ReaderInterface;
13
14
/**
15
 * Class AbstractReader
16
 *
17
 * @package OldTown\Workflow\ZF2\Dispatch\Metadata\Reader
18
 */
19
abstract class AbstractAnnotationReader implements ReaderInterface
20
{
21
    /**
22
     * @var DoctrineAnnotationsReaderInterface
23
     */
24
    protected $reader;
25
26
    /**
27
     * Кеш загруженных метаданных
28
     *
29
     * @var MetadataInterface[]
30
     */
31
    protected $classAnnotations = [];
32
33
    /**
34
     *
35
     * @throws Exception\AnnotationReaderException
36
     */
37
    public function __construct()
38
    {
39
        $this->init();
40
    }
41
42
    /**
43
     * Иницилазия
44
     *
45
     * @return void
46
     * @throws Exception\AnnotationReaderException
47
     */
48
    protected function init()
49
    {
50
        try {
51
            AnnotationRegistry::registerLoader(function ($class) {
52
                return (bool) class_exists($class);
53
            });
54
        } catch (\Exception $e) {
55
            throw new Exception\AnnotationReaderException($e->getMessage(), $e->getCode(), $e);
56
        }
57
    }
58
59
    /**
60
     * @return DoctrineAnnotationsReaderInterface
61
     */
62
    public function getReader()
63
    {
64
        if ($this->reader) {
65
            return $this->reader;
66
        }
67
68
        $this->reader = new DoctrineAnnotationReader();
69
70
        return $this->reader;
71
    }
72
73
    /**
74
     * @param DoctrineAnnotationsReaderInterface $reader
75
     *
76
     * @return $this
77
     */
78
    public function setReader(DoctrineAnnotationsReaderInterface $reader)
79
    {
80
        $this->reader = $reader;
81
82
        return $this;
83
    }
84
}
85