src/Container/AbstractObjectContainer.php
protected function beforeObjectIsStored($object)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException(sprintf('You must only pass object to this container (%s), "%s" passed as parameter!', get_called_class(), gettype($object)), __LINE__);
        }
        $instanceOf = $this->objectClass();
        if (get_class($object) !== $this->objectClass() && !$object instanceof $instanceOf) {
            throw new \InvalidArgumentException(sprintf('Model of type "%s" does not match the object contained by this class: "%s"', get_class($object), $this->objectClass()), __LINE__);
        }
    }
protected function beforeObjectIsStored($object)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException(sprintf('You must only pass object to this container (%s), "%s" passed as parameter!', get_called_class(), gettype($object)), __LINE__);
        }
        $instanceOf = $this->objectClass();
        if (get_class($object) !== $this->objectClass() && !$object instanceof $instanceOf) {
            throw new \InvalidArgumentException(sprintf('Model of type "%s" does not match the object contained by this class: "%s"', get_class($object), $this->objectClass()), __LINE__);
        }
    }
protected function beforeObjectIsStored ( $ object ) { if ( ! is_object ( $ object ) ) { throw new \ InvalidArgumentException ( sprintf ( 'You must only pass object to this container (%s), "%s" passed as parameter!' , get_called_class ( ) , gettype ( $ object ) ) , __LINE__ ) ; } $ instanceOf = $ this -> objectClass ( ) ; if ( get_class ( $ object ) !== $ this -> objectClass ( ) && ! $ object instanceof $ instanceOf ) { throw new \ InvalidArgumentException ( sprintf ( 'Model of type "%s" does not match the object contained by this class: "%s"' , get_class ( $ object ) , $ this -> objectClass ( ) ) , __LINE__ ) ; } }
This method is called before the object has been stored
@throws \InvalidArgumentException
@param mixed $object
This method is called before the object has been stored