|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Finder\Pipelines\Builders; |
|
4
|
|
|
|
|
5
|
|
|
use League\Pipeline\Pipeline; |
|
6
|
|
|
use Operador\Contracts\StageInterface; |
|
7
|
|
|
|
|
8
|
|
|
use Operador\Contracts\PipelineBuilder; |
|
9
|
|
|
|
|
10
|
|
|
use Finder\Pipelines\Finder\File; |
|
11
|
|
|
|
|
12
|
|
|
class FileBuilder extends PipelineBuilder |
|
13
|
|
|
{ |
|
14
|
|
|
public static function getPipelineWithOutput($output) |
|
15
|
|
|
{ |
|
16
|
|
|
$builder = self::makeWithOutput($output); |
|
17
|
|
|
$builder |
|
18
|
|
|
->add(File::makeWithOutput($builder->getOutput())); |
|
19
|
|
|
|
|
20
|
|
|
return $builder->build(); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
// public function run($eloquentClasses) |
|
24
|
|
|
// { |
|
25
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
// $tables = (new Pipeline) |
|
28
|
|
|
// // Retorna Todas as Tabelas |
|
29
|
|
|
// ->pipe(new TablesParser) |
|
30
|
|
|
// // Mapea as Tabelas |
|
31
|
|
|
// ->pipe(new TablesBuilder) |
|
32
|
|
|
// // Builda e Retorna o Entity |
|
33
|
|
|
// ->pipe(new TablesMount); |
|
34
|
|
|
|
|
35
|
|
|
// // Returns 21 |
|
36
|
|
|
// $entitys = $pipeline->process(10); |
|
37
|
|
|
|
|
38
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
// } |
|
41
|
|
|
// public function runTwo($eloquentClasses) |
|
42
|
|
|
// { |
|
43
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
// $tables = (new Pipeline) |
|
46
|
|
|
// ->pipe(new DatabaseRender) |
|
47
|
|
|
// ->pipe(new DatabaseMount); |
|
48
|
|
|
|
|
49
|
|
|
// // Returns 21 |
|
50
|
|
|
// $entitys = $pipeline->process(10); |
|
51
|
|
|
|
|
52
|
|
|
|
|
53
|
|
|
|
|
54
|
|
|
// // Re-usable Pipelines |
|
55
|
|
|
// // Because the PipelineInterface is an extension of the StageInterface pipelines can be re-used as stages. This creates a highly composable model to create complex execution patterns while keeping the cognitive load low. |
|
56
|
|
|
|
|
57
|
|
|
// // For example, if we'd want to compose a pipeline to process API calls, we'd create something along these lines: |
|
58
|
|
|
|
|
59
|
|
|
// $databaseEntity = (new Pipeline) |
|
60
|
|
|
// ->pipe(new ExecuteHttpRequest) // 2 |
|
61
|
|
|
// ->pipe(new ParseJsonResponse); // 3 |
|
62
|
|
|
|
|
63
|
|
|
// $pipeline = (new Pipeline) |
|
64
|
|
|
// ->pipe(new ConvertToPsr7Request) // 1 |
|
65
|
|
|
// ->pipe($processApiRequest) // (2,3) |
|
66
|
|
|
// ->pipe(new ConvertToResponseDto); // 4 |
|
67
|
|
|
|
|
68
|
|
|
// $pipeline->process(new DeleteBlogPost($postId)); |
|
69
|
|
|
// } |
|
70
|
|
|
} |