public function serializer($serializer)
    {
        if (is_string($serializer)) {
            $serializer = new $serializer;
        }

        if (! $serializer instanceof ErrorSerializer) {
            throw new InvalidErrorSerializerException;
        }

        $this->serializer = $serializer;

        return $this;
    }
public function serializer($serializer)
    {
        if (is_string($serializer)) {
            $serializer = new $serializer;
        }

        if (! $serializer instanceof ErrorSerializer) {
            throw new InvalidErrorSerializerException;
        }

        $this->serializer = $serializer;

        return $this;
    }
public function serializer ( $ serializer ) { if ( is_string ( $ serializer ) ) { $ serializer = new $ serializer ; } if ( ! $ serializer instanceof ErrorSerializer ) { throw new InvalidErrorSerializerException ; } $ this -> serializer = $ serializer ; return $ this ; }
Set the error serializer.

@param  \Flugg\Responder\Contracts\ErrorSerializer|string $serializer
@return $this
@throws \Flugg\Responder\Exceptions\InvalidErrorSerializerException
Set the error serializer .