Completed
Pull Request — master (#168)
by
unknown
02:59
created

SettingsAddController::displayAction()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 18
Code Lines 14

Duplication

Lines 7
Ratio 38.89 %

Importance

Changes 3
Bugs 0 Features 3
Metric Value
c 3
b 0
f 3
dl 7
loc 18
rs 9.4285
cc 3
eloc 14
nc 3
nop 0
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[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 ONGR\SettingsBundle\Controller;
13
14
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
15
use Symfony\Component\HttpFoundation\Response;
16
17
/**
18
 * Class SettingsListController. Is used for managing settings in General env.
19
 */
20
class SettingsAddController extends Controller
21
{
22
    /**
23
     * Renders add setting form.
24
     *
25
     * @return Response
26
     */
27
    public function displayAction()
28
    {
29
        $profileManager = $this->get('ongr_settings.profiles_manager');
30
        $profiles = $profileManager->getAllProfiles();
31
        $params = [];
32
        $params['profiles'] = $profiles;
33
        $cache = $this->get('es.cache_engine');
34 View Code Duplication
        if ($cache->contains('settings_errors')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
35
            $params['errors'] = $cache->fetch('settings_errors');
36
            $cache->delete('settings_errors');
37
        } elseif ($cache->contains('settings_success')) {
38
            $params['success'] = $cache->fetch('settings_success');
39
            $cache->delete('settings_success');
40
        }
41
        return $this->render(
42
            'ONGRSettingsBundle:Settings:add.html.twig', $params
43
        );
44
    }
45
}
46