From 6f7fdef0f500cd4bb540affd3bc1482243f337c1 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 24 Feb 2016 23:18:07 +0100 Subject: * Prado 3.3.0 --- .../3rdParty/PhpShell/PHP/Shell/Extensions.php | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 lib/prado/framework/3rdParty/PhpShell/PHP/Shell/Extensions.php (limited to 'lib/prado/framework/3rdParty/PhpShell/PHP/Shell/Extensions.php') diff --git a/lib/prado/framework/3rdParty/PhpShell/PHP/Shell/Extensions.php b/lib/prado/framework/3rdParty/PhpShell/PHP/Shell/Extensions.php new file mode 100644 index 0000000..9b210c4 --- /dev/null +++ b/lib/prado/framework/3rdParty/PhpShell/PHP/Shell/Extensions.php @@ -0,0 +1,86 @@ +name->... + * + * @param string registered name of the extension + * @return PHP_Shell_Extension object handle + */ + public function __get($key) { + if (!isset($this->exts[$key])) { + throw new Exception("Extension $s is not known."); + } + return $this->exts[$key]; + } + + /** + * register set of extensions + * + * @param array set of (name, class-name) pairs + */ + public function registerExtensions($exts) { + foreach ($exts as $k => $v) { + $this->registerExtension($k, $v); + } + } + + /** + * register a single extension + * + * @param string name of the registered extension + * @param PHP_Shell_Extension the extension object + */ + public function registerExtension($k, PHP_Shell_Extension $obj) { + $obj->register(); + + $this->exts[$k] = $obj; + } + + /** + * @return object a singleton of the class + */ + static function getInstance() { + if (is_null(self::$instance)) { + $class = __CLASS__; + self::$instance = new $class(); + } + return self::$instance; + } +} + + -- cgit v1.2.3