Completed
Push — master ( 32f168...027778 )
by Beñat
05:09 queued 02:35
created

AjaxFileGalleryAction::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the CMS Kernel package.
5
 *
6
 * Copyright (c) 2016-present LIN3S <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace LIN3S\CMSKernel\Infrastructure\BenGorFileBundle\HttpAction;
13
14
use BenGorFile\File\Application\Query\AllFilesHandler;
15
use BenGorFile\File\Application\Query\AllFilesQuery;
16
use Symfony\Component\HttpFoundation\JsonResponse;
17
18
/**
19
 * @author Beñat Espiña <[email protected]>
20
 */
21
class AjaxFileGalleryAction
22
{
23
    private $allFilesHandler;
24
25
    public function __construct(AllFilesHandler $allFilesHandler)
26
    {
27
        $this->allFilesHandler = $allFilesHandler;
28
    }
29
30
    public function __invoke()
31
    {
32
        $files = $this->allFilesHandler->__invoke(
33
            new AllFilesQuery()
34
        );
35
36
        return new JsonResponse($files);
37
    }
38
}
39