original_string: public function fromWidgetHtml($name, $defaultTimeWindow = 3600)
      {
          $post = $this->request->request;
  
          $s = $post->get($name . '_maxRequests');
          $maxRequests = (is_scalar($s) && is_numeric($s)) ? (int) $s : null;
          if ($maxRequests !== null && $maxRequests <= 0) {
              throw new UserMessageException(t('Please specify a positive integer for the maximum number of requests (or leave it empty)'));
          }
          try {
              $timeWindow = $this->joinTimeWindow($post->get($name . '_timeWindow_value'), $post->get($name . '_timeWindow_unit'), true);
          } catch (UserMessageException $x) {
              if ($maxRequests === null) {
                  $timeWindow = $defaultTimeWindow;
              } else {
                  throw $x;
              }
          }
  
          return [$maxRequests, $timeWindow];
      }
code: public function fromWidgetHtml($name, $defaultTimeWindow = 3600)
      {
          $post = $this->request->request;
  
          $s = $post->get($name . '_maxRequests');
          $maxRequests = (is_scalar($s) && is_numeric($s)) ? (int) $s : null;
          if ($maxRequests !== null && $maxRequests <= 0) {
              throw new UserMessageException(t('Please specify a positive integer for the maximum number of requests (or leave it empty)'));
          }
          try {
              $timeWindow = $this->joinTimeWindow($post->get($name . '_timeWindow_value'), $post->get($name . '_timeWindow_unit'), true);
          } catch (UserMessageException $x) {
              if ($maxRequests === null) {
                  $timeWindow = $defaultTimeWindow;
              } else {
                  throw $x;
              }
          }
  
          return [$maxRequests, $timeWindow];
      }
code_tokens: public function fromWidgetHtml ( $ name , $ defaultTimeWindow = 3600 ) { $ post = $ this -> request -> request ; $ s = $ post -> get ( $ name . '_maxRequests' ) ; $ maxRequests = ( is_scalar ( $ s ) && is_numeric ( $ s ) ) ? ( int ) $ s : null ; if ( $ maxRequests !== null && $ maxRequests <= 0 ) { throw new UserMessageException ( t ( 'Please specify a positive integer for the maximum number of requests (or leave it empty)' ) ) ; } try { $ timeWindow = $ this -> joinTimeWindow ( $ post -> get ( $ name . '_timeWindow_value' ) , $ post -> get ( $ name . '_timeWindow_unit' ) , true ) ; } catch ( UserMessageException $ x ) { if ( $ maxRequests === null ) { $ timeWindow = $ defaultTimeWindow ; } else { throw $ x ; } } return [ $ maxRequests , $ timeWindow ] ; }
docstring: Get the rate limit values from the values of the widget.
  
  @param string $name
  @param int $defaultTimeWindow the value of the time window if the max requests is empty and the received time window is invalid
  
  @throws UserMessageException
  
  @return array
docstring_tokens: Get the rate limit values from the values of the widget .