blitz-php /
framework
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * This file is part of Blitz PHP framework. |
||
| 5 | * |
||
| 6 | * (c) 2022 Dimitri Sitchet Tomkeu <[email protected]> |
||
| 7 | * |
||
| 8 | * For the full copyright and license information, please view |
||
| 9 | * the LICENSE file that was distributed with this source code. |
||
| 10 | */ |
||
| 11 | |||
| 12 | namespace BlitzPHP\Enums; |
||
| 13 | |||
| 14 | use InvalidArgumentException; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Liste des methodes http |
||
| 18 | */ |
||
| 19 | abstract class Method |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * Sûr : Non |
||
| 23 | * Idempotent : Non |
||
| 24 | * Cacheable : Non |
||
| 25 | * |
||
| 26 | * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT |
||
| 27 | */ |
||
| 28 | public const CONNECT = 'CONNECT'; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Sûr : Non |
||
| 32 | * Idempotent : Oui |
||
| 33 | * Cacheable : Non |
||
| 34 | * |
||
| 35 | * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE |
||
| 36 | */ |
||
| 37 | public const DELETE = 'DELETE'; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Sûr : Oui |
||
| 41 | * Idempotent : Oui |
||
| 42 | * Cacheable : Oui |
||
| 43 | * |
||
| 44 | * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET |
||
| 45 | */ |
||
| 46 | public const GET = 'GET'; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Sûr : Oui |
||
| 50 | * Idempotent : Oui |
||
| 51 | * Cacheable : Oui |
||
| 52 | * |
||
| 53 | * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD |
||
| 54 | */ |
||
| 55 | public const HEAD = 'HEAD'; |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Sûr : Oui |
||
| 59 | * Idempotent : Oui |
||
| 60 | * Cacheable : Non |
||
| 61 | * |
||
| 62 | * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS |
||
| 63 | */ |
||
| 64 | public const OPTIONS = 'OPTIONS'; |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Sûr : Non |
||
| 68 | * Idempotent : Non |
||
| 69 | * Cacheable: Seulement si l'information sur la fraîcheur est incluse |
||
| 70 | * |
||
| 71 | * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH |
||
| 72 | */ |
||
| 73 | public const PATCH = 'PATCH'; |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Sûr : Non |
||
| 77 | * Idempotent : Non |
||
| 78 | * Cacheable: Seulement si l'information sur la fraîcheur est incluse |
||
| 79 | * |
||
| 80 | * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST |
||
| 81 | */ |
||
| 82 | public const POST = 'POST'; |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Sûr : Non |
||
| 86 | * Idempotent : Oui |
||
| 87 | * Cacheable : Non |
||
| 88 | * |
||
| 89 | * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT |
||
| 90 | */ |
||
| 91 | public const PUT = 'PUT'; |
||
| 92 | |||
| 93 | /** |
||
| 94 | * Sûr : Oui |
||
| 95 | * Idempotent : Oui |
||
| 96 | * Cacheable : Non |
||
| 97 | * |
||
| 98 | * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/TRACE |
||
| 99 | */ |
||
| 100 | public const TRACE = 'TRACE'; |
||
| 101 | |||
| 102 | public static function fromName(string $name): string |
||
| 103 | { |
||
| 104 | return match (strtolower($name)) { |
||
| 105 | 'connect' => self::CONNECT, |
||
| 106 | 'delete' => self::DELETE, |
||
| 107 | 'get' => self::GET, |
||
| 108 | 'head' => self::HEAD, |
||
| 109 | 'options' => self::OPTIONS, |
||
| 110 | 'patch' => self::PATCH, |
||
| 111 | 'post' => self::POST, |
||
| 112 | 'put' => self::PUT, |
||
| 113 | 'trace' => self::TRACE, |
||
| 114 | default => throw new InvalidArgumentException('Nom de methode inconnu') |
||
| 115 | }; |
||
| 116 | } |
||
| 117 | |||
| 118 | /** |
||
| 119 | * Renvoie la liste de toutes les methodes HTTP. |
||
| 120 | * |
||
| 121 | * @return list<string> |
||
|
0 ignored issues
–
show
|
|||
| 122 | */ |
||
| 123 | public static function all(): array |
||
| 124 | { |
||
| 125 | return [ |
||
|
0 ignored issues
–
show
|
|||
| 126 | self::CONNECT, |
||
| 127 | self::DELETE, |
||
| 128 | self::GET, |
||
| 129 | self::HEAD, |
||
| 130 | self::OPTIONS, |
||
| 131 | self::PATCH, |
||
| 132 | self::POST, |
||
| 133 | self::PUT, |
||
| 134 | self::TRACE, |
||
| 135 | ]; |
||
| 136 | } |
||
| 137 | } |
||
| 138 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths