Total Complexity | 12 |
Total Lines | 78 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class Link |
||
8 | { |
||
9 | const METHOD_POST = 'post'; |
||
10 | const METHOD_PUT = 'put'; |
||
11 | const METHOD_PATCH = 'patch'; |
||
12 | const METHOD_DELETE = 'delete'; |
||
13 | |||
14 | private string $name; |
||
15 | |||
16 | private string $url; |
||
17 | |||
18 | private array $meta = []; |
||
19 | |||
20 | public function __construct(string $name, string $url) |
||
21 | { |
||
22 | $this->name = $name; |
||
23 | $this->url = $url; |
||
24 | } |
||
25 | |||
26 | public static function make(string $name, string $url): self |
||
29 | } |
||
30 | |||
31 | public function name(): string |
||
32 | { |
||
33 | return $this->name; |
||
34 | } |
||
35 | |||
36 | public function post(): self |
||
39 | } |
||
40 | |||
41 | public function put(): self |
||
42 | { |
||
43 | return $this->setMethod(self::METHOD_PUT); |
||
44 | } |
||
45 | |||
46 | public function patch(): self |
||
47 | { |
||
48 | return $this->setMethod(self::METHOD_PATCH); |
||
49 | } |
||
50 | |||
51 | public function delete(): self |
||
52 | { |
||
53 | return $this->setMethod(self::METHOD_DELETE); |
||
54 | } |
||
55 | |||
56 | private function setMethod(string $method): self |
||
57 | { |
||
58 | return $this->meta('method', $method); |
||
59 | } |
||
60 | |||
61 | public function meta(string $key, $value): self |
||
66 | } |
||
67 | |||
68 | public function setData(array $data): self |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * @return array|string |
||
75 | */ |
||
76 | public function data() |
||
88 |