[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/php-ai-client/src/Providers/Http/Enums/ -> HttpMethodEnum.php (source)

   1  <?php
   2  
   3  declare (strict_types=1);
   4  namespace WordPress\AiClient\Providers\Http\Enums;
   5  
   6  use WordPress\AiClient\Common\AbstractEnum;
   7  /**
   8   * Represents HTTP request methods.
   9   *
  10   * @since 0.1.0
  11   *
  12   * @method static self GET()
  13   * @method static self POST()
  14   * @method static self PUT()
  15   * @method static self PATCH()
  16   * @method static self DELETE()
  17   * @method static self HEAD()
  18   * @method static self OPTIONS()
  19   * @method static self CONNECT()
  20   * @method static self TRACE()
  21   *
  22   * @method bool isGet()
  23   * @method bool isPost()
  24   * @method bool isPut()
  25   * @method bool isPatch()
  26   * @method bool isDelete()
  27   * @method bool isHead()
  28   * @method bool isOptions()
  29   * @method bool isConnect()
  30   * @method bool isTrace()
  31   */
  32  final class HttpMethodEnum extends AbstractEnum
  33  {
  34      /**
  35       * GET method for retrieving resources.
  36       *
  37       * @var string
  38       */
  39      public const GET = 'GET';
  40      /**
  41       * POST method for creating resources.
  42       *
  43       * @var string
  44       */
  45      public const POST = 'POST';
  46      /**
  47       * PUT method for updating/replacing resources.
  48       *
  49       * @var string
  50       */
  51      public const PUT = 'PUT';
  52      /**
  53       * PATCH method for partially updating resources.
  54       *
  55       * @var string
  56       */
  57      public const PATCH = 'PATCH';
  58      /**
  59       * DELETE method for removing resources.
  60       *
  61       * @var string
  62       */
  63      public const DELETE = 'DELETE';
  64      /**
  65       * HEAD method for retrieving headers only.
  66       *
  67       * @var string
  68       */
  69      public const HEAD = 'HEAD';
  70      /**
  71       * OPTIONS method for retrieving allowed methods.
  72       *
  73       * @var string
  74       */
  75      public const OPTIONS = 'OPTIONS';
  76      /**
  77       * CONNECT method for establishing tunnel.
  78       *
  79       * @var string
  80       */
  81      public const CONNECT = 'CONNECT';
  82      /**
  83       * TRACE method for diagnostic purposes.
  84       *
  85       * @var string
  86       */
  87      public const TRACE = 'TRACE';
  88      /**
  89       * Checks if this method is idempotent.
  90       *
  91       * @since 0.1.0
  92       *
  93       * @return bool True if the method is idempotent, false otherwise.
  94       */
  95      public function isIdempotent(): bool
  96      {
  97          return in_array($this->value, [self::GET, self::HEAD, self::OPTIONS, self::TRACE, self::PUT, self::DELETE], \true);
  98      }
  99      /**
 100       * Checks if this method typically has a request body.
 101       *
 102       * @since 0.1.0
 103       *
 104       * @return bool True if the method typically has a body, false otherwise.
 105       */
 106      public function hasBody(): bool
 107      {
 108          return in_array($this->value, [self::POST, self::PUT, self::PATCH], \true);
 109      }
 110  }


Generated : Sat Jun 13 09:38:55 2026 Cross-referenced by PHPXref