Completed
Push — master ( d015d4...c50906 )
by Mikołaj
02:42
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
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 14
rs 9.4285
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