Skip to content

Commit 1de0e62

Browse files
committed
feat: added Method constants
1 parent 45789fe commit 1de0e62

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/Builder/CacheBuilder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
namespace ProgrammatorDev\Api\Builder;
44

5+
use ProgrammatorDev\Api\Method;
56
use Psr\Cache\CacheItemPoolInterface;
67

78
class CacheBuilder
89
{
910
public function __construct(
1011
private CacheItemPoolInterface $pool,
1112
private ?int $ttl = 60,
12-
private array $methods = ['GET', 'HEAD'],
13+
private array $methods = [Method::GET, Method::HEAD],
1314
private array $responseCacheDirectives = ['no-cache', 'max-age']
1415
) {}
1516

src/Method.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace ProgrammatorDev\Api;
4+
5+
class Method
6+
{
7+
public const GET = 'GET';
8+
public const HEAD = 'HEAD';
9+
public const POST = 'POST';
10+
public const PUT = 'PUT';
11+
public const DELETE = 'DELETE';
12+
public const CONNECT = 'CONNECT';
13+
public const OPTIONS = 'OPTIONS';
14+
public const TRACE = 'TRACE';
15+
public const PATCH = 'PATCH';
16+
}

0 commit comments

Comments
 (0)