/ Published in: PHP
Expand |
Embed | Plain Text
<?php /* * CLI * @package CLI */ final class CLI { public $out = NULL; public $err = NULL; public $in = NULL; private $argc = 0; private function __construct() { } public function __destruct() { } public function __clone() { } self::$instance = new self(); self::$instance->initialize(); } return self::$instance; } private function initialize() { $this->out = new CLIOutputStream('php://stdout'); $this->err = new CLIOutputStream('php://stderr'); $this->in = new CLIInputStream('php://stdin'); $this->argc = $_SERVER['argc']; $this->argv = $_SERVER['argv']; for ($i = 1; $i < $this->argc; $i++) { break; } $opt = $this->argv[$i]; $args[$i] = $opt; continue; } } else { $value = NULL; } $args[$opt] = $value; } $this->args = $args; } public function quit($status = 0) { } public function wait($seconds = 0) { } public function arg($opt) { return $this->args[$opt]; } } public function args() { return $this->args; } public function __toString() { } } /* * CLIOutputStream * @package CLI */ final class CLIOutputStream { private $output; const LF = PHP_EOL; public function __construct($stream) { } public function __destruct() { $this->close(); } public function close() { } public function write($text) { } public function writeln($text, $numlines = 1) { } } /* * CLIInputStream * @package CLI */ final class CLIInputStream { private $input; public function __construct($stream) { } public function __destruct() { $this->close(); } public function close() { } } } class Scanner { private $scanner = NULL; public function __construct(CLIInputStream $input) { $this->scanner = $input; } return (string) $token[0]; } public function nextBoolean() { return TRUE; return FALSE; } return NULL; } public function nextDouble() { $double = $this->next(); return (double) $double; } return NULL; } public function nextFloat() { $float = $this->next(); return (float) $float; } return NULL; } public function nextInt() { $int = $this->next(); return (int) $int; } return NULL; } public function nextLine() { return (string) $this->scanner->next(); } } // EOF
You need to login to post a comment.
