| Total Complexity | 7 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 15 | trait CMDKit |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @param Proxy $cmd |
||
| 19 | * @param string $class |
||
| 20 | * @param array $names |
||
| 21 | * @return Proxy |
||
| 22 | */ |
||
| 23 | protected function setCommandPTS(Proxy $cmd, string $class, array $names) : Proxy |
||
| 24 | { |
||
| 25 | $pts = $this->getCommandPTS($class, $names); |
||
| 26 | |||
| 27 | foreach ($pts as $name => $value) { |
||
| 28 | $setter = sprintf('set%s', ucfirst($name)); |
||
| 29 | if (method_exists($cmd, $setter)) { |
||
| 30 | $cmd->$setter($value); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | if (method_exists($cmd->getCommand(), 'configure')) { |
||
| 35 | call_user_func_array([$cmd->getCommand(), 'configure'], [new Configure($cmd)]); |
||
| 36 | } |
||
| 37 | |||
| 38 | return $cmd; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param string $class |
||
| 43 | * @param array $pts |
||
| 44 | * @return array |
||
| 45 | */ |
||
| 46 | private function getCommandPTS(string $class, array $pts) : array |
||
| 57 | } |
||
| 58 | } |
||
| 59 |