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.
Completed
Push — dev ( 40bda2...5b7120 )
by Андрей
04:01
created

AbstractAnnotationReader::init()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 6
nc 2
nop 0
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