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
Branch develop (137ee9)
by Borut
03:38 queued 32s
created

DoctrineManagerRegistry   A

Complexity

Total Complexity 17

Size/Duplication

Total Lines 127
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Importance

Changes 4
Bugs 2 Features 1
Metric Value
wmc 17
c 4
b 2
f 1
lcom 2
cbo 3
dl 0
loc 127
rs 10

13 Methods

Rating   Name   Duplication   Size   Complexity  
A getManagerForClass() 0 11 3
A __construct() 0 8 1
A getDefaultConnectionName() 0 4 1
A getConnection() 0 8 2
A getConnections() 0 4 1
A getConnectionNames() 0 4 1
A getDefaultManagerName() 0 4 1
A getManager() 0 8 2
A getManagers() 0 4 1
A getAliasNamespace() 0 3 1
A resetManager() 0 3 1
A getManagerNames() 0 4 1
A getRepository() 0 4 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
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 getAliasNamespace()
96
    {
97
    }
98
    
99
    /**
100
     * {@inheritDoc}
101
     */
102
    public function resetManager()
103
    {
104
    }
105
106
    /**
107
     * {@inheritDoc}
108
     */
109
    public function getManagerNames()
110
    {
111
        return array_keys($this->managers);
112
    }
113
114
    /**
115
     * {@inheritDoc}
116
     */
117
    public function getRepository($persistentObject, $persistentManagerName = null)
118
    {
119
        $this->getManager($persistentManagerName)->getRepository($persistentObject);
120
    }
121
122
    /**
123
     * {@inheritDoc}
124
     */
125
    public function getManagerForClass($class)
126
    {
127
        foreach ($this->managers as $manager) {
128
            /* @var $manager \Doctrine\ORM\EntityManager */
129
            if (!$manager->getMetadataFactory()->isTransient($class)) {
130
                return $manager;
131
            }
132
        }
133
134
        return;
135
    }
136
}
137