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

SettingsDuplicateController::displayAction()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 21
Code Lines 17

Duplication

Lines 7
Ratio 33.33 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 7
loc 21
rs 9.3142
cc 3
eloc 17
nc 3
nop 2
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 SettingsDuplicateController extends Controller
21
{
22
    /**
23
     * Renders add setting form.
24
     *
25
     * @return Response
26
     */
27
    public function displayAction($name, $profile)
28
    {
29
        $setting = $this->get('ongr_settings.settings_manager')
30
                ->get($name, $profile);
31
        $profileManager = $this->get('ongr_settings.profiles_manager');
32
        $profiles = $profileManager->getAllProfiles();
33
        $params = [];
34
        $params['profiles'] = $profiles;
35
        $params['setting'] = $setting;
36
        $cache = $this->get('es.cache_engine');
37 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...
38
            $params['errors'] = $cache->fetch('settings_errors');
39
            $cache->delete('settings_errors');
40
        } elseif ($cache->contains('settings_success')) {
41
            $params['success'] = $cache->fetch('settings_success');
42
            $cache->delete('settings_success');
43
        }
44
        return $this->render(
45
            'ONGRSettingsBundle:Settings:duplicate.html.twig', $params
46
        );
47
    }
48
}
49