/** * 通过调用静态方法的方式,生产一个组件 */ public static function __callStatic($name, $arguments = array()) { if (isset(self::$components[$name])) { return self::$components[$name]; } else { self::$components[$name] = ClassFactory::make($name, $arguments); return self::$components[$name]; } }
/** * 将所有组件注册 */ private function bind() { foreach ($this->components as $k => $v) { ClassFactory::bind($k, $v); } }