original_string: private static function isValidUriAuthority(?string $authority): bool
      {
          if ($authority === null || $authority === '') {
              return true;
          }
  
          // http://tools.ietf.org/html/rfc3986#section-3.2
          // authority = [ userinfo "@" ] host [ ":" port ]
          $pattern = '/\A(?:([^@]*)@)?(\[[^\]]*\]|[^:]*)(?::(?:\d*))?\z/';
          preg_match($pattern, $authority, $matches);
  
          if (!self::isValidAuthUser((isset($matches[1]) && $matches[1]) ? $matches[1] : null)) {
              return false;
          }
          if (!self::isValidAuthHost((isset($matches[2]) && $matches[2]) ? $matches[2] : '')) {
              return false;
          }
  
          return true;
      }
code: private static function isValidUriAuthority(?string $authority): bool
      {
          if ($authority === null || $authority === '') {
              return true;
          }
  
          // http://tools.ietf.org/html/rfc3986#section-3.2
          // authority = [ userinfo "@" ] host [ ":" port ]
          $pattern = '/\A(?:([^@]*)@)?(\[[^\]]*\]|[^:]*)(?::(?:\d*))?\z/';
          preg_match($pattern, $authority, $matches);
  
          if (!self::isValidAuthUser((isset($matches[1]) && $matches[1]) ? $matches[1] : null)) {
              return false;
          }
          if (!self::isValidAuthHost((isset($matches[2]) && $matches[2]) ? $matches[2] : '')) {
              return false;
          }
  
          return true;
      }
code_tokens: private static function isValidUriAuthority ( ? string $ authority ) : bool { if ( $ authority === null || $ authority === '' ) { return true ; } // http://tools.ietf.org/html/rfc3986#section-3.2 // authority = [ userinfo "@" ] host [ ":" port ] $ pattern = '/\A(?:([^@]*)@)?(\[[^\]]*\]|[^:]*)(?::(?:\d*))?\z/' ; preg_match ( $ pattern , $ authority , $ matches ) ; if ( ! self :: isValidAuthUser ( ( isset ( $ matches [ 1 ] ) && $ matches [ 1 ] ) ? $ matches [ 1 ] : null ) ) { return false ; } if ( ! self :: isValidAuthHost ( ( isset ( $ matches [ 2 ] ) && $ matches [ 2 ] ) ? $ matches [ 2 ] : '' ) ) { return false ; } return true ; }
docstring: Checks if a URI authority is valid
  
  @param string|null $authority The URI authority
  
  @return bool
docstring_tokens: Checks if a URI authority is valid