Completed
Push — master ( 24ab37...36f73c )
by Derek Stephen
01:35
created

OAuthPackage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 97.56%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 75
ccs 40
cts 41
cp 0.9756
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getEntityPath() 0 4 1
A hasEntityPath() 0 4 1
A addToContainer() 0 58 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 1
        $function = function ($c) {
18
            /** @var EntityManager $entityManager */
19 1
            $entityManager = $c['doctrine.entity_manager'];
20 1
            $repository = $entityManager->getRepository('OAuth\AccessToken');
21 1
            return $repository;
22 1
        };
23 1
        $c['repository.AccessToken'] = $c->factory($function);
24
25
        // AuthCode
26 1
        $function = function ($c) {
27
            /** @var EntityManager $entityManager */
28 1
            $entityManager = $c['doctrine.entity_manager'];
29 1
            $repository = $entityManager->getRepository('OAuth\AuthCode');
30 1
            return $repository;
31 1
        };
32 1
        $c['repository.AuthCode'] = $c->factory($function);
33
34
        // Client
35 1
        $function = function ($c) {
36
            /** @var EntityManager $entityManager */
37 1
            $entityManager = $c['doctrine.entity_manager'];
38 1
            $repository = $entityManager->getRepository('OAuth\Client');
39 1
            return $repository;
40 1
        };
41 1
        $c['repository.Client'] = $c->factory($function);
42
43
        // RefreshToken
44 1
        $function = function ($c) {
45
            /** @var EntityManager $entityManager */
46 1
            $entityManager = $c['doctrine.entity_manager'];
47 1
            $repository = $entityManager->getRepository('OAuth\RefreshToken');
48 1
            return $repository;
49 1
        };
50 1
        $c['repository.RefreshToken'] = $c->factory($function);
51
52
        // Scope
53 1
        $function = function ($c) {
54
            /** @var EntityManager $entityManager */
55 1
            $entityManager = $c['doctrine.entity_manager'];
56 1
            $repository = $entityManager->getRepository('OAuth\Scope');
57 1
            return $repository;
58 1
        };
59 1
        $c['repository.Scope'] = $c->factory($function);
60
61
        // User
62 1
        $function = function ($c) {
63
            /** @var EntityManager $entityManager */
64 1
            $entityManager = $c['doctrine.entity_manager'];
65 1
            $repository = $entityManager->getRepository('OAuth\User');
66
            return $repository;
67 1
        };
68 1
        $c['repository.User'] = $c->factory($function);
69
70
71 1
    }
72
73 1
    public function getEntityPath()
74
    {
75 1
        return 'src/Entity/OAuth';
76
    }
77
78 1
    public function hasEntityPath()
79
    {
80 1
        return true;
81
    }
82
83
}