private function process(array $data, $resource, $type, $require)
    {
        if ($this->processor) {
            if ($this->processor instanceof ProcessorInterface) {
                if ($this->processor->supports($resource, $type)) {
                    $data = $this->processor->process($data);
                } elseif ($require) {
                    throw ProcessorException::format(
                        'The resource "%s"%s is not supported by the processor.',
                        is_string($resource) ? $resource : gettype($resource),
                        $type ? " ($type)" : ''
                    );
                }
            } else {
                $processor = new Processor();
                $data = $processor->processConfiguration(
                    $this->processor,
                    $data
                );
            }
        } elseif ($require) {
            throw ProcessorException::format(
                'No processor registered to handle any resource.'
            );
        }

        return $data;
    }