public function setPublishStatus($status)
    {
        if ($status === null || $status === '') {
            $this->publishStatus = null;
            return $this;
        }

        $specialStatus = [
            static::STATUS_EXPIRED  => static::STATUS_PUBLISHED,
            static::STATUS_UPCOMING => static::STATUS_PUBLISHED
        ];

        /** Resolve any special statuses */
        if (isset($specialStatus[$status])) {
            $status = $specialStatus[$status];
        }

        $validStatus = [
            static::STATUS_DRAFT,
            static::STATUS_PENDING,
            static::STATUS_PUBLISHED
        ];

        if (!in_array($status, $validStatus)) {
            throw new InvalidArgumentException(sprintf(
                'Status "%s" is not a valid publish status.',
                $status
            ));
        }

        $this->publishStatus = $status;

        return $this;
    }
public function setPublishStatus($status)
    {
        if ($status === null || $status === '') {
            $this->publishStatus = null;
            return $this;
        }

        $specialStatus = [
            static::STATUS_EXPIRED  => static::STATUS_PUBLISHED,
            static::STATUS_UPCOMING => static::STATUS_PUBLISHED
        ];

        /** Resolve any special statuses */
        if (isset($specialStatus[$status])) {
            $status = $specialStatus[$status];
        }

        $validStatus = [
            static::STATUS_DRAFT,
            static::STATUS_PENDING,
            static::STATUS_PUBLISHED
        ];

        if (!in_array($status, $validStatus)) {
            throw new InvalidArgumentException(sprintf(
                'Status "%s" is not a valid publish status.',
                $status
            ));
        }

        $this->publishStatus = $status;

        return $this;
    }
public function setPublishStatus ( $ status ) { if ( $ status === null || $ status === '' ) { $ this -> publishStatus = null ; return $ this ; } $ specialStatus = [ static :: STATUS_EXPIRED => static :: STATUS_PUBLISHED , static :: STATUS_UPCOMING => static :: STATUS_PUBLISHED ] ; /** Resolve any special statuses */ if ( isset ( $ specialStatus [ $ status ] ) ) { $ status = $ specialStatus [ $ status ] ; } $ validStatus = [ static :: STATUS_DRAFT , static :: STATUS_PENDING , static :: STATUS_PUBLISHED ] ; if ( ! in_array ( $ status , $ validStatus ) ) { throw new InvalidArgumentException ( sprintf ( 'Status "%s" is not a valid publish status.' , $ status ) ) ; } $ this -> publishStatus = $ status ; return $ this ; }
Set the object's publication status.

@param  string $status A publication status.
@throws InvalidArgumentException If the status is invalid.
@return PublishableInterface Chainable
Set the object s publication status .