Total Complexity | 9 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Coverage | 34.78% |
Changes | 0 |
1 | <?php |
||
12 | class ClientRepository extends EntityRepository implements ClientRepositoryInterface |
||
13 | { |
||
14 | /** |
||
15 | * @param string $clientIdentifier |
||
16 | * @param null|string $grantType |
||
17 | * @param null|string|null $clientSecret |
||
18 | * @param bool $mustValidateSecret |
||
19 | * |
||
20 | * @return ClientEntityInterface|null |
||
21 | */ |
||
22 | 7 | public function getClientEntity($clientIdentifier, $grantType = null, $clientSecret = null, $mustValidateSecret = true) |
|
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param Client $client |
||
42 | * @return Client |
||
43 | * @throws \Doctrine\ORM\OptimisticLockException |
||
44 | */ |
||
45 | public function create(Client $client) |
||
46 | { |
||
47 | $em = $this->getEntityManager(); |
||
48 | $user = $client->getUser(); |
||
49 | if ($em->getUnitOfWork()->getEntityState($user) !== UnitOfWork::STATE_MANAGED) { |
||
50 | /** @var OAuthUser $user */ |
||
51 | $user = $em->merge($user); |
||
52 | $client->setUser($user); |
||
53 | } |
||
54 | $em->persist($client); |
||
55 | $em->flush(); |
||
56 | return $client; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @param Client $client |
||
61 | * @return Client |
||
62 | * @throws \Doctrine\ORM\OptimisticLockException |
||
63 | */ |
||
64 | public function save(Client $client) |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @param Client $client |
||
72 | * @throws \Doctrine\ORM\OptimisticLockException |
||
73 | */ |
||
74 | public function delete(Client $client) |
||
78 | } |
||
79 | } |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.