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 — develop ( d01357...2837d4 )
by Borut
02:57
created

DoctrineManagerRegistry::resetManager()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
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
0 ignored issues
show
Bug introduced by
There is at least one abstract method in this class. Maybe declare it as abstract, or implement the remaining methods: getAliasNamespace, resetManager
Loading history...
11
    implements ManagerRegistry
0 ignored issues
show
Coding Style introduced by
The implements keyword must be on the same line as the class name
Loading history...
12
{
13
    protected $managers;
14
    protected $connections;
15
    protected $defaultManager;
16
    protected $defaultConnection;
17
    protected $name;
18
19
    public function __construct($name, array $connections, array $managers, $defaultConnection = 'default', $defaultManager = 'default')
20
    {
21
        $this->name = $name;
22
        $this->managers = $managers;
23
        $this->connections = $connections;
24
        $this->defaultManager = $defaultManager;
25
        $this->defaultConnection = $defaultConnection;
26
    }
27
28
    /**
29
     * {@inheritDoc}
30
     */
31
    public function getDefaultConnectionName()
32
    {
33
        return $this->defaultConnection;
34
    }
35
36
    /**
37
     * {@inheritDoc}
38
     */
39
    public function getConnection($name = null)
40
    {
41
        if ($name === null) {
42
            $name = $this->getDefaultConnectionName();
43
        }
44
45
        return $this->connections[$name];
46
    }
47
48
    /**
49
     * {@inheritDoc}
50
     */
51
    public function getConnections()
52
    {
53
        return $this->connections;
54
    }
55
56
    /**
57
     * {@inheritDoc}
58
     */
59
    public function getConnectionNames()
60
    {
61
        array_keys($this->connections);
62
    }
63
64
    /**
65
     * {@inheritDoc}
66
     */
67
    public function getDefaultManagerName()
68
    {
69
        return $this->defaultManager;
70
    }
71
72
    /**
73
     * {@inheritDoc}
74
     */
75
    public function getManager($name = null)
76
    {
77
        if ($name === null) {
78
            $name = $this->getDefaultManagerName();
79
        }
80
81
        return $this->managers[$name];
82
    }
83
84
    /**
85
     * {@inheritDoc}
86
     */
87
    public function getManagers()
88
    {
89
        return $this->managers;
90
    }
91
92
    /**
93
     * {@inheritDoc}
94
     */
95
    public function getManagerNames()
96
    {
97
        return array_keys($this->managers);
98
    }
99
100
    /**
101
     * {@inheritDoc}
102
     */
103
    public function getRepository($persistentObject, $persistentManagerName = null)
104
    {
105
        $this->getManager($persistentManagerName)->getRepository($persistentObject);
106
    }
107
108
    /**
109
     * {@inheritDoc}
110
     */
111
    public function getManagerForClass($class)
112
    {
113
        foreach ($this->managers as $manager) {
114
            /* @var $manager \Doctrine\ORM\EntityManager */
115
            if (!$manager->getMetadataFactory()->isTransient($class)) {
116
                return $manager;
117
            }
118
        }
119
120
        return;
121
    }
122
}
123