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 $index; |
18
|
|
|
|
19
|
|
|
/** カーソル位置 */ |
20
|
|
|
private $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($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
|
|
|
*/ |
65
|
|
|
public function seek($offset) |
66
|
|
|
{ |
67
|
|
|
if (!array_key_exists($offset, $this->values)) { |
68
|
|
|
throw new \OutOfBoundsException("Current cursor is out of range: " . $offset); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
return $this->values[$offset]; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Implements Iterator#current |
76
|
|
|
* 現在の要素を返却する |
77
|
|
|
* @return array<string> 列データ |
78
|
|
|
*/ |
79
|
16 |
|
public function current() |
80
|
|
|
{ |
81
|
16 |
|
return $this->values[$this->position]; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Implements Iterator#key |
86
|
|
|
* 現在の要素のキーを返却する |
87
|
|
|
* @return integer キー |
88
|
|
|
*/ |
89
|
|
|
public function key() |
90
|
|
|
{ |
91
|
|
|
return $this->position; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Implements Iterator#next |
96
|
|
|
* 次の要素に進む |
97
|
|
|
*/ |
98
|
16 |
|
public function next() |
99
|
|
|
{ |
100
|
16 |
|
$this->position++; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Implements Iterator#rewind |
105
|
|
|
* イテレータを先頭に巻き戻す |
106
|
|
|
*/ |
107
|
20 |
|
public function rewind() |
108
|
|
|
{ |
109
|
20 |
|
$this->position = 0; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Implements Iterator#valid |
114
|
|
|
* 現在位置が有効かどうかを調べる |
115
|
|
|
* @return boolean 有効かどうか |
116
|
|
|
*/ |
117
|
20 |
|
public function valid() |
118
|
|
|
{ |
119
|
20 |
|
return array_key_exists($this->position, $this->values); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Implements ArrayAccess#offsetExists |
124
|
|
|
* オフセットの位置に値が存在するかどうか返却する |
125
|
|
|
* @return boolean 値が存在するかどうか |
126
|
|
|
*/ |
127
|
|
|
public function offsetExists($offset) |
128
|
|
|
{ |
129
|
|
|
return array_key_exists($offset, $this->values); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Implements ArrayAccess#offsetGet |
134
|
|
|
* オフセットの位置の値を返却する |
135
|
|
|
* @return mixed 値 |
136
|
|
|
*/ |
137
|
|
|
public function offsetGet($offset) |
138
|
|
|
{ |
139
|
|
|
return array_key_exists($offset, $this->values) ? $this->values[$offset] : null; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Implements ArrayAccess#offsetSet |
144
|
|
|
* オフセットの位置に値を設定する |
145
|
|
|
* @param mixed オフセット |
|
|
|
|
146
|
|
|
* @param mixed 値 |
147
|
|
|
*/ |
148
|
|
|
public function offsetSet($offset, $value) |
149
|
|
|
{ |
150
|
|
|
throw new CollectionException("AnnotationListContainer are read only."); |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Implements ArrayAccess#offsetUnSet |
155
|
|
|
* オフセットの設定を解除する |
156
|
|
|
* @param mixed オフセット |
|
|
|
|
157
|
|
|
*/ |
158
|
|
|
public function offsetUnSet($offset) |
159
|
|
|
{ |
160
|
|
|
throw new CollectionException("AnnotationListContainer is read only."); |
161
|
|
|
} |
162
|
|
|
} |
163
|
|
|
|
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