-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGetUndefinedValue.php
108 lines (92 loc) · 2.16 KB
/
GetUndefinedValue.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/**
* JBZoo Toolbox - Data.
*
* This file is part of the JBZoo Toolbox project.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT
* @copyright Copyright (C) JBZoo.com, All rights reserved.
* @see https://github.com/JBZoo/Data
*/
declare(strict_types=1);
use JBZoo\Data\Data;
/**
* @BeforeMethods({"init"})
* @Revs(1000000)
* @Iterations(3)
*/
class GetUndefinedValue
{
protected array $array = [];
/** @var Data */
protected $data = [];
/** @var null|ArrayObject */
protected $arrObj;
/** @var null|ArrayObjectExt */
protected $arrObjExt;
public function init(): void
{
$this->array = DataFixture::createRandomArray();
$this->data = new Data($this->array);
$this->arrObj = new ArrayObject($this->array);
$this->arrObjExt = new ArrayObjectExt($this->array);
}
/**
* @Groups({"Native", "Array", "Undefined"})
*/
public function benchArrayRegularMuted()
{
return @$this->array['undefined'];
}
/**
* @Groups({"Native", "Array", "Undefined"})
*/
public function benchArrayIsset()
{
return $this->array['undefined'] ?? null;
}
/**
* @Groups({"Data", "Undefined"})
*/
public function benchDataGet()
{
return $this->data->get('undefined');
}
/**
* @Groups({"Data", "Undefined"})
*/
public function benchDataArrow()
{
return $this->data->undefined;
}
/**
* @Groups({"Data", "Undefined"})
*/
public function benchDataArray()
{
return $this->data['undefined'];
}
/**
* @Groups({"Data", "Undefined"})
*/
public function benchDataFind()
{
return $this->data->find('undefined');
}
/**
* @Groups({"Data", "Undefined"})
*/
public function benchDataFindInner()
{
return $this->data->find('undefined.inner');
}
/**
* @Groups({"Data", "Undefined"})
*/
public function benchDataOffsetGet()
{
return $this->data->offsetGet('undefined');
}
}