public function setParameter($spec, $value = null)
    {
        if (is_string($spec)) {
            $this->parameters[$spec] = $value;
            return $this;
        }

        if (!is_array($spec) && !$spec instanceof \Traversable) {
            throw new \InvalidArgumentException(sprintf(
                'Expected a string, array, or Traversable argument in first position; received "%s"',
                (is_object($spec) ? get_class($spec) : gettype($spec))
            ));
        }

        foreach ($spec as $key => $value) {
            $this->parameters[$key] = $value;
        }

        return $this;
    }