1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace WebStream\Annotation\Container; |
4
|
|
|
|
5
|
|
|
use WebStream\Container\ValueProxy; |
|
|
|
|
6
|
|
|
use WebStream\Exception\Extend\CollectionException; |
|
|
|
|
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* AnnotationListContainer |
10
|
|
|
* @author Ryuichi TANAKA. |
11
|
|
|
* @since 2014/05/21 |
12
|
|
|
* @version 0.4 |
13
|
|
|
*/ |
14
|
|
|
class AnnotationListContainer extends AnnotationContainer implements \Iterator, \SeekableIterator, \ArrayAccess, \Countable |
15
|
|
|
{ |
16
|
|
|
/** index */ |
17
|
|
|
private int $index; |
18
|
|
|
|
19
|
|
|
/** カーソル位置 */ |
20
|
|
|
private int $position; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* constructor |
24
|
|
|
*/ |
25
|
20 |
|
public function __construct() |
26
|
|
|
{ |
27
|
20 |
|
parent::__construct(); |
28
|
20 |
|
$this->index = 0; |
29
|
20 |
|
$this->position = 0; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* 値を登録する |
34
|
|
|
* @param mixed $value 値 |
35
|
|
|
*/ |
36
|
16 |
|
public function push($value) |
37
|
|
|
{ |
38
|
16 |
|
$this->values[$this->index++] = $value; |
|
|
|
|
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* 遅延評価の値を登録する |
43
|
|
|
* @param callable $callback クロージャ |
44
|
|
|
* @param array $context クロージャの引数リスト |
45
|
|
|
*/ |
46
|
|
|
public function pushAsLazy(callable $callback, $context = []) |
47
|
|
|
{ |
48
|
|
|
$this->values[$this->index++] = new ValueProxy($callback, $context, true); |
|
|
|
|
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Implements Countable#count |
53
|
|
|
* @return integer 結果件数 |
54
|
|
|
*/ |
55
|
|
|
public function count() |
56
|
|
|
{ |
57
|
|
|
return count($this->values); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Implements SeekableIterator#seek |
62
|
|
|
* カーソル位置を移動する |
63
|
|
|
* @param mixed オフセット |
|
|
|
|
64
|
|
|
* @return mixed |
65
|
|
|
*/ |
66
|
|
|
public function seek($offset) |
67
|
|
|
{ |
68
|
|
|
if (!array_key_exists($offset, $this->values)) { |
69
|
|
|
throw new \OutOfBoundsException("Current cursor is out of range: " . $offset); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
return $this->values[$offset]; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Implements Iterator#current |
77
|
|
|
* 現在の要素を返却する |
78
|
|
|
* @return array<string> 列データ |
79
|
|
|
*/ |
80
|
16 |
|
public function current() |
81
|
|
|
{ |
82
|
16 |
|
return $this->values[$this->position]; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Implements Iterator#key |
87
|
|
|
* 現在の要素のキーを返却する |
88
|
|
|
* @return integer キー |
89
|
|
|
*/ |
90
|
|
|
public function key() |
91
|
|
|
{ |
92
|
|
|
return $this->position; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Implements Iterator#next |
97
|
|
|
* 次の要素に進む |
98
|
|
|
*/ |
99
|
16 |
|
public function next() |
100
|
|
|
{ |
101
|
16 |
|
$this->position++; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Implements Iterator#rewind |
106
|
|
|
* イテレータを先頭に巻き戻す |
107
|
|
|
*/ |
108
|
20 |
|
public function rewind() |
109
|
|
|
{ |
110
|
20 |
|
$this->position = 0; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Implements Iterator#valid |
115
|
|
|
* 現在位置が有効かどうかを調べる |
116
|
|
|
* @return boolean 有効かどうか |
117
|
|
|
*/ |
118
|
20 |
|
public function valid() |
119
|
|
|
{ |
120
|
20 |
|
return array_key_exists($this->position, $this->values); |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Implements ArrayAccess#offsetExists |
125
|
|
|
* オフセットの位置に値が存在するかどうか返却する |
126
|
|
|
* @param mixed $offset |
127
|
|
|
* @return boolean 値が存在するかどうか |
128
|
|
|
*/ |
129
|
|
|
public function offsetExists($offset) |
130
|
|
|
{ |
131
|
|
|
return array_key_exists($offset, $this->values); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Implements ArrayAccess#offsetGet |
136
|
|
|
* オフセットの位置の値を返却する |
137
|
|
|
* @param mixed $offset |
138
|
|
|
* @return mixed 値 |
139
|
|
|
*/ |
140
|
|
|
public function offsetGet($offset) |
141
|
|
|
{ |
142
|
|
|
return array_key_exists($offset, $this->values) ? $this->values[$offset] : null; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Implements ArrayAccess#offsetSet |
147
|
|
|
* オフセットの位置に値を設定する |
148
|
|
|
* @param mixed オフセット |
|
|
|
|
149
|
|
|
* @param mixed 値 |
150
|
|
|
*/ |
151
|
|
|
public function offsetSet($offset, $value) |
152
|
|
|
{ |
153
|
|
|
throw new CollectionException("AnnotationListContainer are read only."); |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* Implements ArrayAccess#offsetUnSet |
158
|
|
|
* オフセットの設定を解除する |
159
|
|
|
* @param mixed オフセット |
|
|
|
|
160
|
|
|
*/ |
161
|
|
|
public function offsetUnSet($offset) |
162
|
|
|
{ |
163
|
|
|
throw new CollectionException("AnnotationListContainer is read only."); |
164
|
|
|
} |
165
|
|
|
} |
166
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths