[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/Requests/src/Utility/ -> Trim.php (source)

   1  <?php
   2  /**
   3   * Requests for PHP, an HTTP library.
   4   *
   5   * @copyright 2012-2023 Requests Contributors
   6   * @license   https://github.com/WordPress/Requests/blob/stable/LICENSE ISC
   7   * @link      https://github.com/WordPress/Requests
   8   */
   9  
  10  namespace WpOrg\Requests\Utility;
  11  
  12  /**
  13   * Poor person's (backed) enum with the PHP native trim `$characters` defaults to choose from.
  14   *
  15   * In PHP 8.6, the default value for the `$characters` parameter of the `[rl]trim()` function
  16   * changed to include the form feed character.
  17   *
  18   * This "enum" allows calls to `[rl]trim()` throughout the code to document and make it explicit
  19   * which characters should be trimmed from the text string in question.
  20   *
  21   * @link https://wiki.php.net/rfc/trim_form_feed
  22   *
  23   * ---------------------------------------------------------------------------------------------
  24   * This class is only intended for internal use by Requests and is not part of the public API.
  25   * This also means that it has no promise of backward compatibility. Use at your own risk.
  26   * ---------------------------------------------------------------------------------------------
  27   *
  28   * @internal
  29   * @package Requests\Utilities
  30   * @since   2.1.0
  31   */
  32  final class Trim {
  33  
  34      /**
  35       * The ASCII whitespace characters and the NUL byte, excluding the form feed character.
  36       *
  37       * This is the PHP native default in PHP < 8.6.
  38       *
  39       * @var string
  40       */
  41      const WHITESPACE_CHARS_NO_FF = " \n\r\t\v\x00";
  42  
  43      /**
  44       * The ASCII whitespace characters, including the form feed character, and the NUL byte.
  45       *
  46       * This is the PHP native default in PHP >= 8.6.
  47       *
  48       * @var string
  49       */
  50      const WHITESPACE_CHARS = " \f\n\r\t\v\x00";
  51  }


Generated : Fri Nov 13 08:20:01 2026 Cross-referenced by PHPXref