public function setContainerObj($obj)
    {
        if ($obj === null) {
            $this->containerObj = null;

            return $this;
        }

        if (!$obj instanceof AttachmentContainerInterface) {
            throw new InvalidArgumentException(sprintf(
                'Container object must be an instance of %s; received %s',
                AttachmentContainerInterface::class,
                (is_object($obj) ? get_class($obj) : gettype($obj))
            ));
        }

        if (!$obj->id()) {
            throw new InvalidArgumentException(sprintf(
                'Container object must have an ID.',
                (is_object($obj) ? get_class($obj) : gettype($obj))
            ));
        }

        $this->containerObj = $obj;

        return $this;
    }
public function setContainerObj($obj)
    {
        if ($obj === null) {
            $this->containerObj = null;

            return $this;
        }

        if (!$obj instanceof AttachmentContainerInterface) {
            throw new InvalidArgumentException(sprintf(
                'Container object must be an instance of %s; received %s',
                AttachmentContainerInterface::class,
                (is_object($obj) ? get_class($obj) : gettype($obj))
            ));
        }

        if (!$obj->id()) {
            throw new InvalidArgumentException(sprintf(
                'Container object must have an ID.',
                (is_object($obj) ? get_class($obj) : gettype($obj))
            ));
        }

        $this->containerObj = $obj;

        return $this;
    }
public function setContainerObj ( $ obj ) { if ( $ obj === null ) { $ this -> containerObj = null ; return $ this ; } if ( ! $ obj instanceof AttachmentContainerInterface ) { throw new InvalidArgumentException ( sprintf ( 'Container object must be an instance of %s; received %s' , AttachmentContainerInterface :: class , ( is_object ( $ obj ) ? get_class ( $ obj ) : gettype ( $ obj ) ) ) ) ; } if ( ! $ obj -> id ( ) ) { throw new InvalidArgumentException ( sprintf ( 'Container object must have an ID.' , ( is_object ( $ obj ) ? get_class ( $ obj ) : gettype ( $ obj ) ) ) ) ; } $ this -> containerObj = $ obj ; return $ this ; }
Set the attachment's container instance.

@param  AttachmentContainerInterface|null $obj The container object or NULL.
@throws InvalidArgumentException If the given object is invalid.
@return Attachment
Set the attachment s container instance .