1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,60 +0,0 @@ |
1 |
-<?php |
|
2 |
- |
|
3 |
-namespace Illuminate\Container; |
|
4 |
- |
|
5 |
-use Countable; |
|
6 |
-use IteratorAggregate; |
|
7 |
- |
|
8 |
-class RewindableGenerator implements Countable, IteratorAggregate |
|
9 |
-{ |
|
10 |
- /** |
|
11 |
- * The generator callback. |
|
12 |
- * |
|
13 |
- * @var callable |
|
14 |
- */ |
|
15 |
- protected $generator; |
|
16 |
- |
|
17 |
- /** |
|
18 |
- * The number of tagged services. |
|
19 |
- * |
|
20 |
- * @var callable|int |
|
21 |
- */ |
|
22 |
- protected $count; |
|
23 |
- |
|
24 |
- /** |
|
25 |
- * Create a new generator instance. |
|
26 |
- * |
|
27 |
- * @param callable $generator |
|
28 |
- * @param callable|int $count |
|
29 |
- * @return void |
|
30 |
- */ |
|
31 |
- public function __construct(callable $generator, $count) |
|
32 |
- { |
|
33 |
- $this->count = $count; |
|
34 |
- $this->generator = $generator; |
|
35 |
- } |
|
36 |
- |
|
37 |
- /** |
|
38 |
- * Get an iterator from the generator. |
|
39 |
- * |
|
40 |
- * @return mixed |
|
41 |
- */ |
|
42 |
- public function getIterator() |
|
43 |
- { |
|
44 |
- return ($this->generator)(); |
|
45 |
- } |
|
46 |
- |
|
47 |
- /** |
|
48 |
- * Get the total number of tagged services. |
|
49 |
- * |
|
50 |
- * @return int |
|
51 |
- */ |
|
52 |
- public function count() |
|
53 |
- { |
|
54 |
- if (is_callable($count = $this->count)) { |
|
55 |
- $this->count = $count(); |
|
56 |
- } |
|
57 |
- |
|
58 |
- return $this->count; |
|
59 |
- } |
|
60 |
-} |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,60 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+namespace Illuminate\Container; |
|
4 |
+ |
|
5 |
+use Countable; |
|
6 |
+use IteratorAggregate; |
|
7 |
+ |
|
8 |
+class RewindableGenerator implements Countable, IteratorAggregate |
|
9 |
+{ |
|
10 |
+ /** |
|
11 |
+ * The generator callback. |
|
12 |
+ * |
|
13 |
+ * @var callable |
|
14 |
+ */ |
|
15 |
+ protected $generator; |
|
16 |
+ |
|
17 |
+ /** |
|
18 |
+ * The number of tagged services. |
|
19 |
+ * |
|
20 |
+ * @var callable|int |
|
21 |
+ */ |
|
22 |
+ protected $count; |
|
23 |
+ |
|
24 |
+ /** |
|
25 |
+ * Create a new generator instance. |
|
26 |
+ * |
|
27 |
+ * @param callable $generator |
|
28 |
+ * @param callable|int $count |
|
29 |
+ * @return void |
|
30 |
+ */ |
|
31 |
+ public function __construct(callable $generator, $count) |
|
32 |
+ { |
|
33 |
+ $this->count = $count; |
|
34 |
+ $this->generator = $generator; |
|
35 |
+ } |
|
36 |
+ |
|
37 |
+ /** |
|
38 |
+ * Get an iterator from the generator. |
|
39 |
+ * |
|
40 |
+ * @return mixed |
|
41 |
+ */ |
|
42 |
+ public function getIterator() |
|
43 |
+ { |
|
44 |
+ return ($this->generator)(); |
|
45 |
+ } |
|
46 |
+ |
|
47 |
+ /** |
|
48 |
+ * Get the total number of tagged services. |
|
49 |
+ * |
|
50 |
+ * @return int |
|
51 |
+ */ |
|
52 |
+ public function count() |
|
53 |
+ { |
|
54 |
+ if (is_callable($count = $this->count)) { |
|
55 |
+ $this->count = $count(); |
|
56 |
+ } |
|
57 |
+ |
|
58 |
+ return $this->count; |
|
59 |
+ } |
|
60 |
+} |