AccessorsTraitBench::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 1
1
<?php
2
3
use ByTIC\DataObjects\Tests\Fixtures\Dto\ObjectWithGetSet;
4
5
/**
6
 * Class AccessorsTraitBench
7
 * @Iterations(5)
8
 * @Revs(100)
9
 * @BeforeMethods({"init"})
10
 */
11
class AccessorsTraitBench
12
{
13
    protected $objectWithData;
14
    protected $object;
15
16
    public function bench_GetProperty_DynamicProperty()
17
    {
18
        $this->object->name;
19
    }
20
21
    public function bench_GetterMethod_DynamicProperty()
22
    {
23
        $this->object->getName();
24
    }
25
26
    public function bench_GetProperty_PrivateProperty()
27
    {
28
        $this->object->title;
29
    }
30
31
    public function bench_GetterMethod_PrivateProperty()
32
    {
33
        $this->object->getTitle();
34
    }
35
36
    public function init()
37
    {
38
        $this->objectWithData = new ObjectWithGetSet(['name' => 'test']);
39
        $this->object = new ObjectWithGetSet();
40
    }
41
}
42