| Total Complexity | 2 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | final class AsanaCall extends Command { |
||
| 9 | |||
| 10 | protected $description = 'Arbitrarily call a method on (mostly) any entity.'; |
||
| 11 | |||
| 12 | protected $signature = 'asana:call' |
||
| 13 | . ' {class : The entity class to load, relative to the Helix\\Asana namespace (e.g. "User")}' |
||
| 14 | . ' {path : The entity\'s resource path (e.g. "users/me")}' |
||
| 15 | . ' {method : The method name to call (e.g. "getName", "reload")}' |
||
| 16 | . ' {args* : Any arguments for the method, separated by spaces.}'; |
||
| 17 | |||
| 18 | public function handle () { |
||
| 19 | $api = Asana::getApi(); |
||
| 20 | $entity = $api->load($api, "Helix\\Asana\\" . $this->argument('class'), $this->argument('path')); |
||
| 21 | if (!$entity) { |
||
| 22 | $this->error('404'); |
||
| 23 | exit(1); |
||
| 24 | } |
||
| 25 | var_dump($entity->{$this->argument('method')}(...$this->argument('args'))); |
||
| 26 | echo "\n\n"; |
||
| 27 | } |
||
| 28 | } |