original_string: public function resolve(array $options = [])
      {
          if ($this->locked) {
              throw new AccessException('Options cannot be resolved from a lazy option or normalizer.');
          }
  
          // Allow this method to be called multiple times
          $clone = clone $this;
  
          // Make sure that no unknown options are passed
          $diff = array_diff_key($options, $clone->defined);
  
          if (\count($diff) > 0) {
              ksort($clone->defined);
              ksort($diff);
  
              throw new UndefinedOptionsException(sprintf((\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".', implode('", "', array_keys($diff)), implode('", "', array_keys($clone->defined))));
          }
  
          // Override options set by the user
          foreach ($options as $option => $value) {
              $clone->given[$option] = true;
              $clone->defaults[$option] = $value;
              unset($clone->resolved[$option], $clone->lazy[$option]);
          }
  
          // Check whether any required option is missing
          $diff = array_diff_key($clone->required, $clone->defaults);
  
          if (\count($diff) > 0) {
              ksort($diff);
  
              throw new MissingOptionsException(sprintf(\count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.', implode('", "', array_keys($diff))));
          }
  
          // Lock the container
          $clone->locked = true;
  
          // Now process the individual options. Use offsetGet(), which resolves
          // the option itself and any options that the option depends on
          foreach ($clone->defaults as $option => $_) {
              $clone->offsetGet($option);
          }
  
          return $clone->resolved;
      }
code: public function resolve(array $options = [])
      {
          if ($this->locked) {
              throw new AccessException('Options cannot be resolved from a lazy option or normalizer.');
          }
  
          // Allow this method to be called multiple times
          $clone = clone $this;
  
          // Make sure that no unknown options are passed
          $diff = array_diff_key($options, $clone->defined);
  
          if (\count($diff) > 0) {
              ksort($clone->defined);
              ksort($diff);
  
              throw new UndefinedOptionsException(sprintf((\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".', implode('", "', array_keys($diff)), implode('", "', array_keys($clone->defined))));
          }
  
          // Override options set by the user
          foreach ($options as $option => $value) {
              $clone->given[$option] = true;
              $clone->defaults[$option] = $value;
              unset($clone->resolved[$option], $clone->lazy[$option]);
          }
  
          // Check whether any required option is missing
          $diff = array_diff_key($clone->required, $clone->defaults);
  
          if (\count($diff) > 0) {
              ksort($diff);
  
              throw new MissingOptionsException(sprintf(\count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.', implode('", "', array_keys($diff))));
          }
  
          // Lock the container
          $clone->locked = true;
  
          // Now process the individual options. Use offsetGet(), which resolves
          // the option itself and any options that the option depends on
          foreach ($clone->defaults as $option => $_) {
              $clone->offsetGet($option);
          }
  
          return $clone->resolved;
      }
code_tokens: public function resolve ( array $ options = [ ] ) { if ( $ this -> locked ) { throw new AccessException ( 'Options cannot be resolved from a lazy option or normalizer.' ) ; } // Allow this method to be called multiple times $ clone = clone $ this ; // Make sure that no unknown options are passed $ diff = array_diff_key ( $ options , $ clone -> defined ) ; if ( \ count ( $ diff ) > 0 ) { ksort ( $ clone -> defined ) ; ksort ( $ diff ) ; throw new UndefinedOptionsException ( sprintf ( ( \ count ( $ diff ) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.' ) . ' Defined options are: "%s".' , implode ( '", "' , array_keys ( $ diff ) ) , implode ( '", "' , array_keys ( $ clone -> defined ) ) ) ) ; } // Override options set by the user foreach ( $ options as $ option => $ value ) { $ clone -> given [ $ option ] = true ; $ clone -> defaults [ $ option ] = $ value ; unset ( $ clone -> resolved [ $ option ] , $ clone -> lazy [ $ option ] ) ; } // Check whether any required option is missing $ diff = array_diff_key ( $ clone -> required , $ clone -> defaults ) ; if ( \ count ( $ diff ) > 0 ) { ksort ( $ diff ) ; throw new MissingOptionsException ( sprintf ( \ count ( $ diff ) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.' , implode ( '", "' , array_keys ( $ diff ) ) ) ) ; } // Lock the container $ clone -> locked = true ; // Now process the individual options. Use offsetGet(), which resolves // the option itself and any options that the option depends on foreach ( $ clone -> defaults as $ option => $ _ ) { $ clone -> offsetGet ( $ option ) ; } return $ clone -> resolved ; }
docstring: Merges options with the default values stored in the container and
  validates them.
  
  Exceptions are thrown if:
  
  - Undefined options are passed;
  - Required options are missing;
  - Options have invalid types;
  - Options have invalid values.
  
  @param array $options A map of option names to values
  
  @return array The merged and validated options
  
  @throws UndefinedOptionsException If an option name is undefined
  @throws InvalidOptionsException   If an option doesn't fulfill the
  specified validation rules
  @throws MissingOptionsException   If a required option is missing
  @throws OptionDefinitionException If there is a cyclic dependency between
  lazy options and/or normalizers
  @throws NoSuchOptionException     If a lazy option reads an unavailable option
  @throws AccessException           If called from a lazy option or normalizer
docstring_tokens: Merges options with the default values stored in the container and validates them .