public function read() { if ($this->type === Input::TYPE_BOOL) { $valueRequired = $this->option->getValueOption('none'); } else { $valueRequired = $this->option->getValueOption('required'); } $data = $this->option->get($this->id, $this->shortName, $valueRequired); if ($data !== null) { if ($this->type === Input::TYPE_BOOL) { if ($data === true) { $data = 'true'; } else { $data = 'false'; } } else { $data = (string) $data; } } return $data; }
<?php namespace empire\framework\tests\cli; use empire\framework\autoload\psr4\Psr4AutoLoader; use empire\framework\cli\Option; use empire\framework\error\ErrorHandler; // Include the bootstrap file $tail = str_replace('\\', DIRECTORY_SEPARATOR, substr(__NAMESPACE__, strpos(__NAMESPACE__, '\\'))); $path = substr(__DIR__, 0, strlen(__DIR__) - strlen($tail)) . DIRECTORY_SEPARATOR . 'bootstrap.php'; require $path; define('IPC_FILE', __DIR__ . DIRECTORY_SEPARATOR . "option_ipc.json"); $decoded = json_decode(file_get_contents(IPC_FILE), true); $option = new Option(); $decoded['res'] = $option->get($decoded['name'], $decoded['shortName'], $decoded['valueOptions']); file_put_contents(IPC_FILE, json_encode($decoded)); exit;