Total Complexity | 6 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class HttpBuilderPrepare implements Stringable |
||
10 | { |
||
11 | use Makeable; |
||
12 | |||
13 | protected $of; |
||
14 | |||
15 | protected $prefix = ''; |
||
16 | |||
17 | protected $suffix = ''; |
||
18 | |||
19 | protected $default = ''; |
||
20 | |||
21 | 26 | public function __toString(): string |
|
22 | { |
||
23 | 26 | if (! empty($this->of)) { |
|
24 | 23 | return $this->prefixed(); |
|
25 | } |
||
26 | |||
27 | 21 | return $this->default; |
|
28 | } |
||
29 | |||
30 | 26 | public function of(?string $value): self |
|
31 | { |
||
32 | 26 | $this->of = $value; |
|
33 | |||
34 | 26 | return $this; |
|
35 | } |
||
36 | |||
37 | 26 | public function prefix(string $value): self |
|
38 | { |
||
39 | 26 | $this->prefix = $value; |
|
40 | |||
41 | 26 | return $this; |
|
42 | } |
||
43 | |||
44 | 26 | public function suffix(string $value): self |
|
49 | } |
||
50 | |||
51 | 23 | protected function prefixed(): ?string |
|
57 | } |
||
58 | } |
||
59 |