/** * Return true if the script was executed in the CLI enviroment * * @return boolean */ static final function isCli() { if (is_null(self::$__is_cli)) { self::$__is_cli = !isset($_SERVER['SERVER_SOFTWARE']) && (php_sapi_name() == 'cli' || is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0); } return self::$__is_cli; }