Passed
Pull Request — develop (#130)
by Laurent
02:40 queued 01:18
created

GetSettingsController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 11 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the G.L.S.R. Apps package.
7
 *
8
 * (c) Dev-Int Création <[email protected]>.
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Administration\Infrastructure\Settings\Controller;
15
16
use Administration\Infrastructure\Settings\Query\GetSettings;
17
use Core\Infrastructure\Common\MessengerQueryBus;
18
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
0 ignored issues
show
Bug introduced by
The type Symfony\Bundle\Framework...ller\AbstractController was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
use Symfony\Component\HttpFoundation\RedirectResponse;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\HttpFoundation\RedirectResponse was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
use Symfony\Component\HttpFoundation\Response;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\HttpFoundation\Response was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
22
class GetSettingsController extends AbstractController
23
{
24
    private MessengerQueryBus $queryBus;
25
26
    public function __construct(MessengerQueryBus $queryBus)
27
    {
28
        $this->queryBus = $queryBus;
29
    }
30
31
    public function __invoke(): Response
32
    {
33
        $query = new GetSettings();
34
        $settings = $this->queryBus->handle($query);
35
36
        if (null === $settings) {
37
            return new RedirectResponse($this->generateUrl('admin_settings_new'));
38
        }
39
40
        return $this->render('Administration/Settings/index.html.twig', [
41
            'settings' => $settings,
42
        ]);
43
    }
44
}
45