original_string: public static function verifyNonce($id, $cnonce)
      {
          $ns = new SessionNamespace($id);
          $nonce = $ns->nonce;
  
          // validate token
          if (empty($cnonce) || $cnonce !== $nonce) {
              return false;
          }
  
          // validate referrer
          $referrer = Url::getReferrer();
          if (!empty($referrer) && !Url::isLocalUrl($referrer)) {
              return false;
          }
  
          // validate origin
          $origin = self::getOrigin();
          if (!empty($origin) &&
              ($origin == 'null'
                  || !in_array($origin, self::getAcceptableOrigins()))
          ) {
              return false;
          }
  
          return true;
      }
code: public static function verifyNonce($id, $cnonce)
      {
          $ns = new SessionNamespace($id);
          $nonce = $ns->nonce;
  
          // validate token
          if (empty($cnonce) || $cnonce !== $nonce) {
              return false;
          }
  
          // validate referrer
          $referrer = Url::getReferrer();
          if (!empty($referrer) && !Url::isLocalUrl($referrer)) {
              return false;
          }
  
          // validate origin
          $origin = self::getOrigin();
          if (!empty($origin) &&
              ($origin == 'null'
                  || !in_array($origin, self::getAcceptableOrigins()))
          ) {
              return false;
          }
  
          return true;
      }
code_tokens: public static function verifyNonce ( $ id , $ cnonce ) { $ ns = new SessionNamespace ( $ id ) ; $ nonce = $ ns -> nonce ; // validate token if ( empty ( $ cnonce ) || $ cnonce !== $ nonce ) { return false ; } // validate referrer $ referrer = Url :: getReferrer ( ) ; if ( ! empty ( $ referrer ) && ! Url :: isLocalUrl ( $ referrer ) ) { return false ; } // validate origin $ origin = self :: getOrigin ( ) ; if ( ! empty ( $ origin ) && ( $ origin == 'null' || ! in_array ( $ origin , self :: getAcceptableOrigins ( ) ) ) ) { return false ; } return true ; }
docstring: Returns if a nonce is valid and comes from a valid request.
  
  A nonce is valid if it matches the current nonce and if the current nonce
  has not expired.
  
  The request is valid if the referrer is a local URL (see {@link Url::isLocalUrl()})
  and if the HTTP origin is valid (see {@link getAcceptableOrigins()}).
  
  @param string $id The nonce's unique ID. See {@link getNonce()}.
  @param string $cnonce Nonce sent from client.
  @return bool `true` if valid; `false` otherwise.
docstring_tokens: Returns if a nonce is valid and comes from a valid request .