Conditions | 5 |
Paths | 6 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
52 | 5 | public function resolve( |
|
53 | StreamInterface $built, |
||
54 | Definitions $definitions |
||
55 | ): StreamInterface { |
||
56 | try { |
||
57 | 5 | $value = $definitions->arguments()->get($this->name); |
|
58 | 4 | } catch (ArgumentNotProvided $e) { |
|
59 | 3 | if ($e->argument()->hasDefault()) { |
|
60 | 1 | $value = $definitions->build($e->argument()->default()); |
|
61 | } |
||
62 | |||
63 | 3 | if ($e->argument()->optional()) { |
|
64 | 3 | $value = []; |
|
65 | } |
||
66 | 1 | } catch (ArgumentNotDefined $e) { |
|
67 | 1 | $value = $definitions->build($this->name); |
|
68 | } |
||
69 | |||
70 | 5 | return $built->append(Stream::of( |
|
71 | 5 | 'mixed', |
|
72 | 5 | ...$value |
|
73 | )); |
||
76 |