protected function openInternal()
    {
        $self = $this;
        if (!$this->getId()) {
            $self = $this;
            return $this->handler->createId($this->app)
                ->then(function($id = null) use ($self) {
                    $self->_isActive = true;
                    $self->setId($id);
                    $cookie = $self->createSessionCookie();
                    $self->app->response->cookies->add($cookie);
                    return true;
                });
        } else {
            $this->_isActive = true;
            return $this->readSession()->then(
                function($data) use ($self) {
                    $self->data = is_array($data) ? $data : [];
                    return true;
                },
                function($error = null) use ($self) {
                    $self->data = [];
                    return false;
                }
            )->always(function() {
                //Write initial data state for future needs
                $this->_dataInitial = $this->data;
            });
        }
    }
protected function openInternal()
    {
        $self = $this;
        if (!$this->getId()) {
            $self = $this;
            return $this->handler->createId($this->app)
                ->then(function($id = null) use ($self) {
                    $self->_isActive = true;
                    $self->setId($id);
                    $cookie = $self->createSessionCookie();
                    $self->app->response->cookies->add($cookie);
                    return true;
                });
        } else {
            $this->_isActive = true;
            return $this->readSession()->then(
                function($data) use ($self) {
                    $self->data = is_array($data) ? $data : [];
                    return true;
                },
                function($error = null) use ($self) {
                    $self->data = [];
                    return false;
                }
            )->always(function() {
                //Write initial data state for future needs
                $this->_dataInitial = $this->data;
            });
        }
    }
protected function openInternal ( ) { $ self = $ this ; if ( ! $ this -> getId ( ) ) { $ self = $ this ; return $ this -> handler -> createId ( $ this -> app ) -> then ( function ( $ id = null ) use ( $ self ) { $ self -> _isActive = true ; $ self -> setId ( $ id ) ; $ cookie = $ self -> createSessionCookie ( ) ; $ self -> app -> response -> cookies -> add ( $ cookie ) ; return true ; } ) ; } else { $ this -> _isActive = true ; return $ this -> readSession ( ) -> then ( function ( $ data ) use ( $ self ) { $ self -> data = is_array ( $ data ) ? $ data : [ ] ; return true ; } , function ( $ error = null ) use ( $ self ) { $ self -> data = [ ] ; return false ; } ) -> always ( function ( ) { //Write initial data state for future needs $ this -> _dataInitial = $ this -> data ; } ) ; } }
Open session internal method
@return ExtendedPromiseInterface
Open session internal method