Conditions | 1 |
Paths | 1 |
Total Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
37 | public static function make($eloquentClasses) |
||
38 | { |
||
39 | |||
40 | |||
41 | |||
42 | // Returns 21 |
||
43 | $entitys = $pipeline->process($eloquentClasses); |
||
44 | |||
45 | |||
46 | |||
47 | // Re-usable Pipelines |
||
48 | // 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. |
||
49 | |||
50 | // For example, if we'd want to compose a pipeline to process API calls, we'd create something along these lines: |
||
51 | |||
52 | $processApiRequest = (new Pipeline) |
||
53 | ->pipe(new ExecuteHttpRequest) // 2 |
||
54 | ->pipe(new ParseJsonResponse); // 3 |
||
55 | |||
56 | $pipeline = (new Pipeline) |
||
57 | ->pipe(new ConvertToPsr7Request) // 1 |
||
58 | ->pipe($processApiRequest) // (2,3) |
||
59 | ->pipe(new ConvertToResponseDto); // 4 |
||
60 | |||
61 | $pipeline->process(new DeleteBlogPost($postId)); |
||
62 | } |
||
63 | } |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.