Completed
Pull Request — master (#2)
by Beñat
02:41
created

AjaxFileGalleryAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 8 1
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