@@ -47,7 +47,7 @@ |
||
47 | 47 | * @param string $path any file wildcard (ie:/tmp/*.txt). Use the full path! |
48 | 48 | * @param int $flags any GlobIterator or FilesystemIterator flag |
49 | 49 | * |
50 | - * @return \Pipes\Pipe |
|
50 | + * @return FilesTrait |
|
51 | 51 | */ |
52 | 52 | public function files($path, $flags = \GlobIterator::CURRENT_AS_PATHNAME) |
53 | 53 | { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * }); |
20 | 20 | * |
21 | 21 | * |
22 | - * @param callable $callback |
|
22 | + * @param callable $______callback |
|
23 | 23 | * |
24 | 24 | * @return \Pipes\Pipe |
25 | 25 | */ |
@@ -33,7 +33,7 @@ |
||
33 | 33 | if ($reflectionFunction->isGenerator()) { |
34 | 34 | $generator = $______callback; |
35 | 35 | } else { |
36 | - $generator = function ($iterator) use ($pipe, $______callback) { |
|
36 | + $generator = function($iterator) use ($pipe, $______callback) { |
|
37 | 37 | foreach ($iterator as $key => $value) { |
38 | 38 | // yield $key => $pipe->executeCallback($______callback, true, $value, $key, $iterator); |
39 | 39 | $value = $pipe->executeCallback($______callback, true, $value, $key, $iterator); |
@@ -8,17 +8,17 @@ discard block |
||
8 | 8 | p($this->getUsers())->limit(1000)->map(function($user) { |
9 | 9 | // process the user |
10 | 10 | return p::emit($user['id'], $user); |
11 | -})->each(function($userData){ |
|
11 | +})->each(function($userData) { |
|
12 | 12 | // save the data |
13 | 13 | }); |
14 | 14 | |
15 | 15 | // alternative (PHP 5.5) syntax |
16 | -p($this)->map(function($value, &$key){ |
|
16 | +p($this)->map(function($value, &$key) { |
|
17 | 17 | $key = 4545; |
18 | 18 | }); |
19 | 19 | |
20 | 20 | // alternative (PHP 5.5) syntax |
21 | -p($this)->map(function($value, $key){ |
|
21 | +p($this)->map(function($value, $key) { |
|
22 | 22 | yield $key => $value; |
23 | 23 | }); |
24 | 24 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | |
32 | 32 | p($this->getUsers())->chunk(100)->limit(1000)->each(function($usersChunk) { |
33 | - foreach ( $usersChunk as $user ) |
|
33 | + foreach ($usersChunk as $user) |
|
34 | 34 | { |
35 | 35 | print "$user->id \n"; |
36 | 36 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | /** |
59 | 59 | * distributing the effort |
60 | 60 | */ |
61 | -p($this->getUsers())->shard(3, function($v, $k, Pipe $p){ |
|
61 | +p($this->getUsers())->shard(3, function($v, $k, Pipe $p) { |
|
62 | 62 | echo "shard n. {$p->getShard()}: $k => $v \n"; |
63 | 63 | }); |
64 | 64 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | // factory methods |
22 | 22 | p()->emit($key = null, $value); //ok |
23 | -p()->flags($flag1, $flag2 =null, $flagN = null); |
|
23 | +p()->flags($flag1, $flag2 = null, $flagN = null); |
|
24 | 24 | |
25 | 25 | // terminals |
26 | 26 | p()->toValues(); // ok. outputs an indexed array. |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | // --- advanced stuff |
60 | 60 | |
61 | 61 | // caching |
62 | -p()->keep(3)->each(function(){ |
|
62 | +p()->keep(3)->each(function() { |
|
63 | 63 | $previous = p()->kept(-1); // also -2, -3 |
64 | 64 | }); |
65 | 65 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | return $this->chainWith( |
17 | 17 | new \CallbackFilterIterator($this->getIterator(), |
18 | - function () use ($seconds) { |
|
18 | + function() use ($seconds) { |
|
19 | 19 | usleep($seconds * 1000000); |
20 | 20 | |
21 | 21 | return true; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $iterator = $this->getIterator(); |
29 | 29 | $pipe = $this; |
30 | 30 | |
31 | - $generator = function () use ($pipe, $iterator, $______callback, $______allArgs) { |
|
31 | + $generator = function() use ($pipe, $iterator, $______callback, $______allArgs) { |
|
32 | 32 | foreach ($iterator as $key => $value) { |
33 | 33 | if ($pipe->executeCallback($______callback, $______allArgs, $value, $key, $iterator) |
34 | 34 | ) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $iterator = $this->getIterator(); |
66 | 66 | $pipe = $this; |
67 | 67 | |
68 | - $generator = function () use ($pipe, $iterator, $______callback, $______allArgs) { |
|
68 | + $generator = function() use ($pipe, $iterator, $______callback, $______allArgs) { |
|
69 | 69 | foreach ($iterator as $key => $value) { |
70 | 70 | if (!$pipe->executeCallback($______callback, $______allArgs, $value, $key, $iterator) |
71 | 71 | ) { |
@@ -27,7 +27,7 @@ |
||
27 | 27 | { |
28 | 28 | return $this->chainWith( |
29 | 29 | new \CallbackFilterIterator($this->getIterator(), |
30 | - function () use ($______callback, $______allArgs |
|
30 | + function() use ($______callback, $______allArgs |
|
31 | 31 | ) { |
32 | 32 | call_user_func_array($______callback, $______allArgs ? func_get_args() : [func_get_arg(0)]); |
33 | 33 |
@@ -116,6 +116,6 @@ |
||
116 | 116 | return call_user_func_array( |
117 | 117 | $______callback, |
118 | 118 | $______allArgs ? [$value, $key, $iterator] : [$value] |
119 | - ); |
|
119 | + ); |
|
120 | 120 | } |
121 | 121 | } |