code: private function cleanUnwanted(Parameters $params, $permitted)
      {
          foreach ($params->toArray() as $key => $value) {
              if (is_array($value) && !is_int($key)) {
                  if (!array_key_exists($key, $permitted)) {
                      $this->handleUnpermittedParam($key, $params);
                  }
              } elseif (!is_int($key) && !in_array($key, $permitted) && !array_key_exists($key, $permitted)) {
                  $this->handleUnpermittedParam($key, $params);
              }
          }
      }
docs: Filters out or throws exception when parameters are neigher keys nor values
  in the permitted array
  @param  Parameter                 $params
  @param  array                     $permitted
  @throws ParameterMissingException when parameter is missing