| Total Complexity | 13 |
| Total Lines | 124 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class Request |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | protected $path; |
||
| 16 | /** |
||
| 17 | * @var string |
||
| 18 | */ |
||
| 19 | protected $method; |
||
| 20 | /** |
||
| 21 | * @var array|string |
||
| 22 | */ |
||
| 23 | protected $body; |
||
| 24 | /** |
||
| 25 | * @var string |
||
| 26 | */ |
||
| 27 | protected $query; |
||
| 28 | /** |
||
| 29 | * @var string |
||
| 30 | */ |
||
| 31 | protected $content_type; |
||
| 32 | |||
| 33 | public function __construct($params = []) |
||
| 34 | { |
||
| 35 | if (count($params)>0) { |
||
| 36 | $this->setBody($params['body'] ?? []); |
||
| 37 | $this->setQuery($params['query'] ?? []); |
||
| 38 | $this->setContentType($params['content_type'] ?? 'application/json'); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @return mixed |
||
| 44 | */ |
||
| 45 | public function getPath() |
||
| 46 | { |
||
| 47 | return $this->path; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @param mixed $path |
||
| 52 | */ |
||
| 53 | public function setPath($path) |
||
| 54 | { |
||
| 55 | $this->path = $path; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return mixed |
||
| 60 | */ |
||
| 61 | public function getBody() |
||
| 62 | { |
||
| 63 | return $this->body; |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param mixed $body |
||
| 68 | */ |
||
| 69 | |||
| 70 | public function setBody($body = null) |
||
| 71 | { |
||
| 72 | $this->body = $body; |
||
| 73 | return $this; |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @return mixed |
||
| 78 | */ |
||
| 79 | public function getMethod() |
||
| 80 | { |
||
| 81 | return $this->method; |
||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @param mixed $method |
||
| 86 | */ |
||
| 87 | public function setMethod($method) |
||
| 88 | { |
||
| 89 | $this->method = $method; |
||
| 90 | } |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @return mixed |
||
| 94 | */ |
||
| 95 | public function getContentType() |
||
| 96 | { |
||
| 97 | return $this->content_type; |
||
| 98 | } |
||
| 99 | |||
| 100 | /** |
||
| 101 | * @param mixed $content_type |
||
| 102 | */ |
||
| 103 | public function setContentType($content_type) |
||
| 104 | { |
||
| 105 | $this->content_type = $content_type; |
||
| 106 | } |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @return mixed |
||
| 110 | */ |
||
| 111 | public function getQuery() |
||
| 112 | { |
||
| 113 | return $this->query; |
||
| 114 | } |
||
| 115 | |||
| 116 | /** |
||
| 117 | * @param mixed $query |
||
| 118 | */ |
||
| 119 | public function setQuery($query) |
||
| 122 | } |
||
| 123 | /* |
||
| 124 | * #return string |
||
| 125 | */ |
||
| 126 | public function toArray() |
||
| 134 | ]; |
||
| 135 | } |
||
| 136 | } |
||
| 137 |