| Total Complexity | 7 | 
| Total Lines | 54 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 0 | ||
| 1 | <?php | ||
| 11 | final class Argument | ||
| 12 | { | ||
| 13 | private $definition; | ||
| 14 | |||
| 15 | 7 | public function __construct(Definition $argument) | |
| 18 | 7 | } | |
| 19 | |||
| 20 | 6 | public function __toString(): string | |
| 21 |     { | ||
| 22 | 6 | $method = new MethodName($this->definition->name()); | |
| 23 | $code = <<<PHP | ||
| 24 | 6 | public function $method() | |
| 25 |     { | ||
| 26 | 6 |         if (\$this->arguments->contains('{$this->definition->name()}')) { | |
| 27 | 6 |             return \$this->arguments->get('{$this->definition->name()}'); | |
| 28 | } | ||
| 29 | |||
| 30 | 6 |         {$this->buildDefault()} | |
| 31 | 6 |         {$this->buildOptional()} | |
| 32 | } | ||
| 33 | PHP; | ||
| 34 | |||
| 35 | 6 | return $code; | |
| 36 | } | ||
| 37 | |||
| 38 | 6 | private function buildDefault(): string | |
| 47 | ); | ||
| 48 | } | ||
| 49 | |||
| 50 | 6 | private function buildOptional(): string | |
| 65 | } | ||
| 66 | } | ||
| 67 |