Total Complexity | 9 |
Total Lines | 94 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
5 | class Search |
||
6 | { |
||
7 | protected string $url = 'iys/search'; |
||
8 | |||
9 | protected string $type; |
||
10 | |||
11 | protected string $recipient; |
||
12 | |||
13 | protected string $recipientType; |
||
14 | |||
15 | protected string $refId; |
||
16 | |||
17 | /** |
||
18 | * @param string $type |
||
19 | * @return $this |
||
20 | */ |
||
21 | public function setType(string $type): self |
||
22 | { |
||
23 | $this->type = $type; |
||
24 | |||
25 | return $this; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @param string $recipient |
||
30 | * @return $this |
||
31 | */ |
||
32 | public function setRecipient(string $recipient): self |
||
33 | { |
||
34 | $this->recipient = $recipient; |
||
35 | |||
36 | return $this; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @param string $recipientType |
||
41 | * @return $this |
||
42 | */ |
||
43 | public function setRecipientType(string $recipientType): self |
||
44 | { |
||
45 | $this->recipientType = $recipientType; |
||
46 | |||
47 | return $this; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @param string $refId |
||
52 | * @return $this |
||
53 | */ |
||
54 | public function setRefId(string $refId): self |
||
55 | { |
||
56 | $this->refId = $refId; |
||
57 | |||
58 | return $this; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @param array $defaults |
||
63 | * @return $this |
||
64 | */ |
||
65 | public function setDefaults(array $defaults): self |
||
66 | { |
||
67 | foreach ($defaults as $key => $value) { |
||
68 | if (method_exists($this, 'set'.ucfirst($key))) { |
||
69 | call_user_func([$this, 'set'.ucfirst($key)], $value); |
||
70 | } |
||
71 | } |
||
72 | |||
73 | return $this; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * Get request body. |
||
78 | * |
||
79 | * @return array |
||
80 | */ |
||
81 | public function body(): array |
||
88 | ]; |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * Get request url. |
||
93 | * |
||
94 | * @return string |
||
95 | */ |
||
96 | public function getUrl(): string |
||
99 | } |
||
100 | } |
||
101 |