/** * Constructor * * @param OperationCommand $command */ public function __construct(OperationCommand $command) { $this->setClient($command->getClient()); $this->setCommandName($command->getName()); $data = $command->getResponse()->json(); foreach ($data as $key => $value) { $setter = 'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key))); if (method_exists($this, $setter)) { $this->{$setter}($value); } } }