public function addProcessor(array $processor, $key = null)
    {
        if (!isset($processor['type'])) {
            throw new InvalidArgumentException(
                'Processor type is required.'
            );
        }

        if (!is_string($key)) {
            $this->processors[] = $processor;
        } else {
            $this->processors[$key] = $processor;
        }

        return $this;
    }