| Conditions | 3 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 2 | public function getClientById($id) |
|
| 35 | { |
||
| 36 | 2 | $randomId = null; |
|
| 37 | 2 | if (strstr($id, '_') !== false) { |
|
| 38 | 1 | $parts = explode('_', $id); |
|
| 39 | 1 | $id = $parts[0]; |
|
| 40 | 1 | $randomId = $parts[1]; |
|
| 41 | } |
||
| 42 | |||
| 43 | 2 | $repo = $this->em->getRepository('LoginCidadaoOAuthBundle:Client'); |
|
| 44 | |||
| 45 | 2 | if ($randomId) { |
|
| 46 | 1 | $client = $repo->findOneBy([ |
|
| 47 | 1 | 'id' => $id, |
|
| 48 | 1 | 'randomId' => $randomId, |
|
| 49 | ]); |
||
| 50 | } else { |
||
| 51 | 1 | $client = $repo->find($id); |
|
| 52 | } |
||
| 53 | 2 | $event = new GetClientEvent($client); |
|
| 54 | 2 | $this->dispatcher->dispatch(LoginCidadaoCoreEvents::GET_CLIENT, $event); |
|
| 55 | |||
| 56 | 2 | return $event->getClient(); |
|
| 57 | } |
||
| 59 |