Completed
Pull Request — master (#202)
by
unknown
07:29
created

IndexController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace SumoCoders\FrameworkUserBundle\Controller;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
8
use SumoCoders\FrameworkMultiUserBundle\User\AbstractUserRepository;
9
10
/**
11
 * @Route(service="sumo_coders.user.controller.index")
12
 */
13
final class IndexController
14
{
15
    /** @var AbstractUserRepository */
16
    private $userRepository;
17
18
    public function __construct(AbstractUserRepository $userRepository)
19
    {
20
        $this->userRepository = $userRepository;
21
    }
22
23
    /**
24
     * @Route("/user")
25
     * @Security("has_role('ROLE_ADMIN')")
26
     * @Template()
27
     *
28
     * @return array
29
     */
30
    public function indexAction(): array
31
    {
32
        return ['users' => $this->userRepository->findBy([], ['username' => 'ASC'])];
33
    }
34
}
35