original_string: private function getRequestParametersArray($requiredParameters, $parametersRequest)
      {
          $finalParameters = array();
          foreach ($requiredParameters as $name => $defaultValue) {
              try {
                  if ($defaultValue instanceof NoDefaultValue) {
                      $requestValue = Common::getRequestVar($name, null, null, $parametersRequest);
                  } else {
                      try {
                          if ($name == 'segment' && !empty($parametersRequest['segment'])) {
                              // segment parameter is an exception: we do not want to sanitize user input or it would break the segment encoding
                              $requestValue = ($parametersRequest['segment']);
                          } else {
                              $requestValue = Common::getRequestVar($name, $defaultValue, null, $parametersRequest);
                          }
                      } catch (Exception $e) {
                          // Special case: empty parameter in the URL, should return the empty string
                          if (isset($parametersRequest[$name])
                              && $parametersRequest[$name] === ''
                          ) {
                              $requestValue = '';
                          } else {
                              $requestValue = $defaultValue;
                          }
                      }
                  }
              } catch (Exception $e) {
                  throw new Exception(Piwik::translate('General_PleaseSpecifyValue', array($name)));
              }
              $finalParameters[$name] = $requestValue;
          }
          return $finalParameters;
      }
code: private function getRequestParametersArray($requiredParameters, $parametersRequest)
      {
          $finalParameters = array();
          foreach ($requiredParameters as $name => $defaultValue) {
              try {
                  if ($defaultValue instanceof NoDefaultValue) {
                      $requestValue = Common::getRequestVar($name, null, null, $parametersRequest);
                  } else {
                      try {
                          if ($name == 'segment' && !empty($parametersRequest['segment'])) {
                              // segment parameter is an exception: we do not want to sanitize user input or it would break the segment encoding
                              $requestValue = ($parametersRequest['segment']);
                          } else {
                              $requestValue = Common::getRequestVar($name, $defaultValue, null, $parametersRequest);
                          }
                      } catch (Exception $e) {
                          // Special case: empty parameter in the URL, should return the empty string
                          if (isset($parametersRequest[$name])
                              && $parametersRequest[$name] === ''
                          ) {
                              $requestValue = '';
                          } else {
                              $requestValue = $defaultValue;
                          }
                      }
                  }
              } catch (Exception $e) {
                  throw new Exception(Piwik::translate('General_PleaseSpecifyValue', array($name)));
              }
              $finalParameters[$name] = $requestValue;
          }
          return $finalParameters;
      }
code_tokens: private function getRequestParametersArray ( $ requiredParameters , $ parametersRequest ) { $ finalParameters = array ( ) ; foreach ( $ requiredParameters as $ name => $ defaultValue ) { try { if ( $ defaultValue instanceof NoDefaultValue ) { $ requestValue = Common :: getRequestVar ( $ name , null , null , $ parametersRequest ) ; } else { try { if ( $ name == 'segment' && ! empty ( $ parametersRequest [ 'segment' ] ) ) { // segment parameter is an exception: we do not want to sanitize user input or it would break the segment encoding $ requestValue = ( $ parametersRequest [ 'segment' ] ) ; } else { $ requestValue = Common :: getRequestVar ( $ name , $ defaultValue , null , $ parametersRequest ) ; } } catch ( Exception $ e ) { // Special case: empty parameter in the URL, should return the empty string if ( isset ( $ parametersRequest [ $ name ] ) && $ parametersRequest [ $ name ] === '' ) { $ requestValue = '' ; } else { $ requestValue = $ defaultValue ; } } } } catch ( Exception $ e ) { throw new Exception ( Piwik :: translate ( 'General_PleaseSpecifyValue' , array ( $ name ) ) ) ; } $ finalParameters [ $ name ] = $ requestValue ; } return $ finalParameters ; }
docstring: Returns an array containing the values of the parameters to pass to the method to call
  
  @param array $requiredParameters array of (parameter name, default value)
  @param array $parametersRequest
  @throws Exception
  @return array values to pass to the function call
docstring_tokens: Returns an array containing the values of the parameters to pass to the method to call