properties with params passed to PHP * via http request or cli arguments. * * @return null */ public function __construct() { if (isset($_SERVER['REQUEST_METHOD'])) { // http $this->properties = $_REQUEST; } elseif (isset($_SERVER['argc'], $_SERVER['argv']) && $_SERVER['argc'] >= 2) { // cli foreach ($_SERVER['argv'] as $arg) { if (strpos($arg, '=')) { list($key, $value) = explode('=', $arg); $this->setProperty($key, $value); } } } } /** * Set property a new property * * @param string $key property key * @param string $value property value * @return null */ public function setProperty($key, $value) { $this->properties[$key] = $value; } /** * Return property value * * @param string $key property key * @return string|null property value or null */ public function getProperty($key) { if (isset($this->properties[$key])) { return $this->properties[$key]; } } /** * Return true or false depending whether the * property exist or not. * * @param string $key * @return bool */ public function hasProperty($key) { if (isset($this->properties[$key])) { return true; } return false; } }