Completed
Push — master ( d015d4...c50906 )
by Mikołaj
02:42
created

SwitchController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 22
rs 10
wmc 1
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A switchTheme() 0 14 1
1
<?php
2
3
namespace Rudolf\Modules\Appearance\Change;
4
5
use Rudolf\Component\Alerts\Alert;
6
use Rudolf\Component\Alerts\AlertsCollection;
7
use Rudolf\Framework\Controller\AdminController;
8
9
class SwitchController extends AdminController
10
{
11
    /**
12
     * @param $name
13
     *
14
     * @throws \Exception
15
     */
16
    public function switchTheme($name)
17
    {
18
        $confEditor = new ThemeConfigEditor();
19
20
        $confEditor->setThemeName($name);
21
        $confEditor->save();
22
23
        AlertsCollection::add(new Alert(
24
            'success',
25
            'Pomyślnie zmieniono szablon domyślny na '.$name.'.'
26
        ));
27
28
        $this->redirect(DIR.'/admin/appearance', 302);
29
    }
30
}
31