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

OAuthPackage::getEntityPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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
}