Completed
Push — master ( a9822c...8aa0e0 )
by Derek Stephen
14:27
created

ClientController::indexAction()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 16
c 0
b 0
f 0
ccs 0
cts 10
cp 0
rs 9.7333
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace App\Controller;
4
5
use Del\Common\ContainerService;
6
use OAuth\Client;
7
use OAuth\Repository\ClientRepository;
8
9
class ClientController extends BaseController
10
{
11
    public function indexAction()
12
    {
13
        $container = ContainerService::getInstance()->getContainer();
14
15
        /** @var ClientRepository $clientRepository */
16
        $clientRepository = $container['repository.Client'];
17
18
        /** @var Client $user */
19
        $clients = $clientRepository->findAll();
20
21
        if (count($clients) == 0) {
22
            $this->sendJsonResponse(['No clients found']);
23
        }
24
25
        $this->sendJsonResponse($clients);
26
    }
27
}