Session::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
namespace leandrogehlen\exporter\data;
4
5
/**
6
 * Represents the Session layout element
7
 *
8
 * @author Leandro Guindani Gehlen <[email protected]>
9
 */
10
class Session extends Element
11
{
12
    use CollectionTrait;
13
14
    /**
15
     * @var Session the owner session.
16
     */
17
    public $owner;
18
19
    /**
20
     * @var string the provider name.
21
     */
22
    public $provider;
23
24
    /**
25
     * @var boolean whether this session will be executed. Defaults to true.
26
     */
27
    public $visible = true;
28
29
    /**
30
     * @var integer the rows count.
31
     */
32
    public $rows;
33
34
    /**
35
     * @var Session[]
36
     */
37
    public $sessions = [];
38
39
    /**
40
     * @var array column configuration. Each array element represents the configuration
41
     * for one particular column. For example,
42
     *
43
     * ```php
44
     * [
45
     *     ['name' => 'id', 'align' => 'left', 'size' => 10, 'charComplete' => 0],
46
     *     ['name' => 'firstName', 'dictionary' => 'text']
47
     *     ['name' => 'birthDate', 'expression' => 'return date('Y-m-d');']
48
     * ]
49
     * ```
50
     */
51
    public $columns = [];
52
53
54
    /**
55
     * Initializes the session.
56
     * This method will instantiate [[columns]] and [[sessions]] objects.
57
     */
58 8
    public function init()
59
    {
60 8
        parent::init();
61 8
        $this->initElements($this->columns, Column::className());
62 8
        $this->initElements($this->sessions, Session::className(), ['owner' => $this]);
63 8
    }
64
}
65