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.

DoctrineManagerRegistry::resetManager()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
1
<?php
2
3
namespace Application\Doctrine\ORM;
4
5
use Doctrine\Common\Persistence\ManagerRegistry;
6
7
/**
8
 * @author Borut Balažek <[email protected]>
9
 */
10
class DoctrineManagerRegistry implements ManagerRegistry
11
{
12
    protected $managers;
13
    protected $connections;
14
    protected $defaultManager;
15
    protected $defaultConnection;
16
    protected $name;
17
18
    public function __construct($name, array $connections, array $managers, $defaultConnection = 'default', $defaultManager = 'default')
19
    {
20
        $this->name = $name;
21
        $this->managers = $managers;
22
        $this->connections = $connections;
23
        $this->defaultManager = $defaultManager;
24
        $this->defaultConnection = $defaultConnection;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function getDefaultConnectionName()
31
    {
32
        return $this->defaultConnection;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function getConnection($name = null)
39
    {
40
        if ($name === null) {
41
            $name = $this->getDefaultConnectionName();
42
        }
43
44
        return $this->connections[$name];
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function getConnections()
51
    {
52
        return $this->connections;
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function getConnectionNames()
59
    {
60
        array_keys($this->connections);
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function getDefaultManagerName()
67
    {
68
        return $this->defaultManager;
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74
    public function getManager($name = null)
75
    {
76
        if ($name === null) {
77
            $name = $this->getDefaultManagerName();
78
        }
79
80
        return $this->managers[$name];
81
    }
82
83
    /**
84
     * {@inheritdoc}
85
     */
86
    public function getManagers()
87
    {
88
        return $this->managers;
89
    }
90
    /**
91
     * {@inheritdoc}
92
     */
93
    public function resetManager($name = null)
94
    {
95
    }
96
97
    /**
98
     * {@inheritdoc}
99
     */
100
    public function getAliasNamespace($alias)
101
    {
102
    }
103
104
    /**
105
     * {@inheritdoc}
106
     */
107
    public function getManagerNames()
108
    {
109
        return array_keys($this->managers);
110
    }
111
112
    /**
113
     * {@inheritdoc}
114
     */
115
    public function getRepository($persistentObject, $persistentManagerName = null)
116
    {
117
        $this->getManager($persistentManagerName)->getRepository($persistentObject);
118
    }
119
120
    /**
121
     * {@inheritdoc}
122
     */
123
    public function getManagerForClass($class)
124
    {
125
        foreach ($this->managers as $manager) {
126
            /* @var $manager \Doctrine\ORM\EntityManager */
127
            if (!$manager->getMetadataFactory()->isTransient($class)) {
128
                return $manager;
129
            }
130
        }
131
132
        return;
133
    }
134
}
135