public function resolveOptions($options, $defaults, $required = [], $allowedTypes = [])
  {
      $resolver = new OptionsResolver();
      $resolver->setDefaults($defaults);

      if (!empty($required)) {
          $resolver->setRequired($required);
      }

      if (!empty($allowedTypes)) {
          foreach ($allowedTypes as $type => $value) {
              $resolver->setAllowedValues($type, $value);
          }
      }

      return $resolver->resolve($options);
  }