protected function checkType($value)
    {
        if (!$value instanceof AssetContract) {
            throw new InvalidArgumentException("You can only add values of '{$this->forceType}' to this list");
        }

        if (!$mimeType = $value->mimeType()) {
            throw new InvalidArgumentException('The added asset must have a mimeType to add it to this collection');
        }

        if (!$this->mimeType) {
            $this->mimeType = $mimeType;

            return;
        }

        if ($this->mimeType != $mimeType) {
            throw new InvalidArgumentException("This collection accepts only mimeType {$this->mimeType} not $mimeType");
        }
    }
protected function checkType($value)
    {
        if (!$value instanceof AssetContract) {
            throw new InvalidArgumentException("You can only add values of '{$this->forceType}' to this list");
        }

        if (!$mimeType = $value->mimeType()) {
            throw new InvalidArgumentException('The added asset must have a mimeType to add it to this collection');
        }

        if (!$this->mimeType) {
            $this->mimeType = $mimeType;

            return;
        }

        if ($this->mimeType != $mimeType) {
            throw new InvalidArgumentException("This collection accepts only mimeType {$this->mimeType} not $mimeType");
        }
    }
protected function checkType ( $ value ) { if ( ! $ value instanceof AssetContract ) { throw new InvalidArgumentException ( "You can only add values of '{$this->forceType}' to this list" ) ; } if ( ! $ mimeType = $ value -> mimeType ( ) ) { throw new InvalidArgumentException ( 'The added asset must have a mimeType to add it to this collection' ) ; } if ( ! $ this -> mimeType ) { $ this -> mimeType = $ mimeType ; return ; } if ( $ this -> mimeType != $ mimeType ) { throw new InvalidArgumentException ( "This collection accepts only mimeType {$this->mimeType} not $mimeType" ) ; } }
Checks the type of any added item and throws an exception
if it does not match.

@param mixed $value
Checks the type of any added item and throws an exception if it does not match .