public function addParam(string $name, $value): self
    {
        if (!is_array($value) && !is_scalar($value) && null !== $value) {
            if (is_object($value) && method_exists($value, '__toString')) {
                $value = (string) $value;
            } else {
                throw new \InvalidArgumentException(
                        'Argument 2 passed to ' . __METHOD__ . '() must be'
                        . ' a string, array, object with __toString() method'
                        . ' or any other scalar value.'
                );
            }
        }

        $this->parameters[$name] = $value;
        return $this;
    }