| Conditions | 4 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | private function getOptions() : ParameterBag |
||
| 36 | { |
||
| 37 | if (null !== $this->options) { |
||
| 38 | return $this->options; |
||
| 39 | } |
||
| 40 | |||
| 41 | // it's not the most beautiful code possible, but making the properties |
||
| 42 | // private and the methods public allows to configure the deployment using |
||
| 43 | // a config builder and the IDE autocompletion. Here we need to access |
||
| 44 | // those private properties and their values |
||
| 45 | $options = new ParameterBag(); |
||
| 46 | $r = new \ReflectionObject($this->config); |
||
| 47 | foreach ($r->getProperties() as $property) { |
||
| 48 | try { |
||
| 49 | $property->setAccessible(true); |
||
| 50 | $options->set($property->getName(), $property->getValue($this->config)); |
||
| 51 | } catch (\ReflectionException $e) { |
||
| 52 | // ignore this error |
||
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | return $this->options = $options; |
||
| 57 | } |
||
| 59 |