Completed
Push — master ( 6d4bc5...5bd20c )
by Derek Stephen
05:29
created

OAuthPackage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 75
ccs 0
cts 42
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addToContainer() 0 58 1
A getEntityPath() 0 4 1
A hasEntityPath() 0 4 1
1
<?php
2
namespace OAuth;
3
4
use Del\Common\Container\RegistrationInterface;
5
use Doctrine\ORM\EntityManager;
6
use OAuth\Repository\AccessTokenRepository;
7
use Pimple\Container;
8
9
class OAuthPackage implements RegistrationInterface
10
{
11
    /**
12
     * @param Container $c
13
     */
14
    public function addToContainer(Container $c)
15
    {
16
        // AccessToken
17
        $function = function ($c) {
18
            /** @var EntityManager $entityManager */
19
            $entityManager = $c['doctrine.entity_manager'];
20
            $repository = $entityManager->getRepository('OAuth\AccessToken');
21
            return $repository;
22
        };
23
        $c['repository.AccessToken'] = $c->factory($function);
24
25
        // AuthCode
26
        $function = function ($c) {
27
            /** @var EntityManager $entityManager */
28
            $entityManager = $c['doctrine.entity_manager'];
29
            $repository = $entityManager->getRepository('OAuth\AuthCode');
30
            return $repository;
31
        };
32
        $c['repository.AuthCode'] = $c->factory($function);
33
34
        // Client
35
        $function = function ($c) {
36
            /** @var EntityManager $entityManager */
37
            $entityManager = $c['doctrine.entity_manager'];
38
            $repository = $entityManager->getRepository('OAuth\Client');
39
            return $repository;
40
        };
41
        $c['repository.Client'] = $c->factory($function);
42
43
        // RefreshToken
44
        $function = function ($c) {
45
            /** @var EntityManager $entityManager */
46
            $entityManager = $c['doctrine.entity_manager'];
47
            $repository = $entityManager->getRepository('OAuth\RefreshToken');
48
            return $repository;
49
        };
50
        $c['repository.RefreshToken'] = $c->factory($function);
51
52
        // Scope
53
        $function = function ($c) {
54
            /** @var EntityManager $entityManager */
55
            $entityManager = $c['doctrine.entity_manager'];
56
            $repository = $entityManager->getRepository('OAuth\Scope');
57
            return $repository;
58
        };
59
        $c['repository.Scope'] = $c->factory($function);
60
61
        // User
62
        $function = function ($c) {
63
            /** @var EntityManager $entityManager */
64
            $entityManager = $c['doctrine.entity_manager'];
65
            $repository = $entityManager->getRepository('OAuth\User');
66
            return $repository;
67
        };
68
        $c['repository.User'] = $c->factory($function);
69
70
71
    }
72
73
    public function getEntityPath()
74
    {
75
        return 'src/Entity/OAuth';
76
    }
77
78
    public function hasEntityPath()
79
    {
80
        return true;
81
    }
82
83
}