Completed
Push — master ( a85ca4...6010a8 )
by Derek Stephen
04:06
created

ClientRepository::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace OAuth\Repository;
4
5
use OAuth\Client;
6
use Doctrine\ORM\EntityRepository;
7
use League\OAuth2\Server\Entities\ClientEntityInterface;
8
use League\OAuth2\Server\Repositories\ClientRepositoryInterface;
9
10
class ClientRepository extends EntityRepository implements ClientRepositoryInterface
11
{
12
    /**
13
     * @param string $clientIdentifier
14
     * @param string $grantType
15
     * @param null|string|null $clientSecret
16
     * @param bool $mustValidateSecret
17
     * @return ClientEntityInterface
18
     */
19
    public function getClientEntity($clientIdentifier, $grantType, $clientSecret = null, $mustValidateSecret = true)
20
    {
21
        // TODO: Implement getClientEntity() method.
22
    }
23
24
    /**
25
     * @param Client $client
26
     * @return Client
27
     */
28
    public function save(Client $client)
29
    {
30
        if(!$client->getID()) {
31
            $this->_em->persist($client);
32
        }
33
        $this->_em->flush($client);
34
        return $client;
35
    }
36
37
    /**
38
     * @param Client $client
39
     */
40
    public function delete(Client $client)
41
    {
42
        $this->_em->remove($client);
43
        $this->_em->flush($client);
44
    }
45
46
}