original_string: public function fetch($key, $default = null)
      {
          if ($this->hasKey($key)) {
              return $this[$key];
          } elseif ($default !== null) {
              if (is_callable($default)) {
                  return $default($key);
              }
  
              return $default;
          }
  
          throw new InvalidArgumentException("Invalid key '$key'");
      }
code: public function fetch($key, $default = null)
      {
          if ($this->hasKey($key)) {
              return $this[$key];
          } elseif ($default !== null) {
              if (is_callable($default)) {
                  return $default($key);
              }
  
              return $default;
          }
  
          throw new InvalidArgumentException("Invalid key '$key'");
      }
code_tokens: public function fetch ( $ key , $ default = null ) { if ( $ this -> hasKey ( $ key ) ) { return $ this [ $ key ] ; } elseif ( $ default !== null ) { if ( is_callable ( $ default ) ) { return $ default ( $ key ) ; } return $ default ; } throw new InvalidArgumentException ( "Invalid key '$key'" ) ; }
docstring: Get the value by the key. Throws exception when key is not set
  
  @param string $key
  @param mixed  $default either value or callable function
  
  @return mixed the value for the given key
  
  @throws InvalidArgumentException
docstring_tokens: Get the value by the key . Throws exception when key is not set