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

SwitchController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
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\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