( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ HEX
HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux mail.thebrand.ai 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64
User: www-data (33)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/tmpr/../tmpr/../tmpr/../tmpr/../tmpr/../n8nphp/src/Enums/RequestMethod.php
<?php

declare(strict_types=1);

namespace KayedSpace\N8n\Enums;

use InvalidArgumentException;

enum RequestMethod: string
{
    case Get = 'get';
    case Post = 'post';
    case Put = 'put';
    case Delete = 'delete';
    case Patch = 'patch';
    case Head = 'head';

    /**
     * True when the given value refers to **this** method.
     */
    public function is(string|self $value): bool
    {
        return $this === self::parse($value);
    }

    public static function parse(string|self $value): self
    {
        if ($value instanceof self) {
            return $value;
        }

        $value = strtolower($value);

        return self::tryFrom($value)
            ?? throw new InvalidArgumentException("Unsupported HTTP method [{$value}]");
    }
}