public function setState($state)
    {
        $state = (int) $state;
        if ($this->isRoot() && !($state & Page::STATE_ONLINE)) {
            throw new \LogicException("Root page state must be online.");
        }

        if (!$this->isOnline() && (self::STATE_ONLINE & $state) && !$this->isRoot() && !$this->getPublishing()) {
            $this->setPublishing(new \DateTime());
        }

        $this->_state = $state;

        return $this;
    }
public function setState($state)
    {
        $state = (int) $state;
        if ($this->isRoot() && !($state & Page::STATE_ONLINE)) {
            throw new \LogicException("Root page state must be online.");
        }

        if (!$this->isOnline() && (self::STATE_ONLINE & $state) && !$this->isRoot() && !$this->getPublishing()) {
            $this->setPublishing(new \DateTime());
        }

        $this->_state = $state;

        return $this;
    }
public function setState ( $ state ) { $ state = ( int ) $ state ; if ( $ this -> isRoot ( ) && ! ( $ state & Page :: STATE_ONLINE ) ) { throw new \ LogicException ( "Root page state must be online." ) ; } if ( ! $ this -> isOnline ( ) && ( self :: STATE_ONLINE & $ state ) && ! $ this -> isRoot ( ) && ! $ this -> getPublishing ( ) ) { $ this -> setPublishing ( new \ DateTime ( ) ) ; } $ this -> _state = $ state ; return $ this ; }
Sets the state.

@param  integer              $state

@return Page

@throws \LogicException                          Raises if this page is root and not online.
Sets the state .