Completed
Push — master ( b59dfe...bf8cd7 )
by Klochok
02:38
created

TextPage::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace hiqdev\thememanager\widgets;
4
5
class TextPage extends \yii\base\Widget
6
{
7
    protected $header;
8
9
    protected $footer;
10
11
    public function init()
12
    {
13
        $this->start();
14
    }
15
16
    public function run()
17
    {
18
        return $this->render('TextPage', [
19
            'content' => $this->finish(),
20
            'header' => $this->header,
21
            'footer' => $this->footer,
22
        ]);
23
    }
24
25
    public function beginHeader()
26
    {
27
        $this->start();
28
    }
29
30
    public function endHeader()
31
    {
32
        $this->header = $this->finish();
33
    }
34
35
    public function beginFooter()
36
    {
37
        $this->start();
38
    }
39
40
    public function endFooter()
41
    {
42
        $this->footer = $this->finish();
43
    }
44
45
    protected function start()
46
    {
47
        ob_start();
48
        ob_implicit_flush(false);
49
    }
50
51
    protected function finish()
52
    {
53
        return ob_get_clean();
54
    }
55
}
56