/**
  * Validates given $intentions.
  *
  * @param ParametersIntentionInterface $intention
  *
  * @throws InvalidArgumentException
  */
 protected function validate(ParametersIntentionInterface $intention)
 {
     $errors = $intention->validate();
     if ($errors->count() > 0) {
         throw new InvalidArgumentException($errors);
     }
 }
 /**
  * Creates an instance of OptionsResolver which is then configured and used by given $intention.
  *
  * @param ParametersIntentionInterface $intention
  * @throws InvalidArgumentException
  */
 protected function resolveParameters(ParametersIntentionInterface $intention)
 {
     $optionsResolver = new OptionsResolver();
     $intention->configureOptionsResolver($optionsResolver);
     try {
         $intention->resolveParameters($optionsResolver);
     } catch (ExceptionInterface $exception) {
         throw new InvalidArgumentException($exception->getMessage());
     }
 }