Completed
Push — master ( aa3e09...85e896 )
by Mikołaj
04:06
created

SwitchController::switchTheme()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 1
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Rudolf\Modules\Appearance\One\Admin;
4
5
use Rudolf\Component\Alerts\Alert;
6
use Rudolf\Component\Alerts\AlertsCollection;
7
use Rudolf\Framework\Controller\AdminController;
8
use Rudolf\Modules\Appearance\ThemeConfigEditor;
9
10
class SwitchController extends AdminController
11
{
12
    public function switchTheme($name)
13
    {
14
        $confEditor = new ThemeConfigEditor();
15
16
        $confEditor->setThemeName($name);
17
        $confEditor->save();
18
19
        AlertsCollection::add(new Alert(
20
            'success',
21
            'Pomyślnie zmieniono szablon domyślny na '.$name.'.'
22
        ));
23
24
        $this->redirect(DIR.'/admin/appearance', 302);
25
    }
26
}
27