示例#1
0
     * Returns the static instance
     *
     * @return StaticSeed
     */
    public static function getInstance()
    {
        if (null === static::$_instance) {
            static::$_instance = new static();
        }
        return static::$_instance;
    }
    /**
     * @param array $settings
     */
    public function __construct($settings = array())
    {
        //  Wire up a destructor to call when I die
        register_shutdown_function(function () {
            $this->__destruct();
            static::_destruct();
        });
        //  Phone home. Calls __wakeup() from base
        parent::__construct($settings);
        //  Call static constructor and save our instance off
        static::_construct($this);
        static::$_instance = $this;
    }
}
//  Call the constructor
StaticSeed::initialize();