| Total Complexity | 13 |
| Total Lines | 69 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 4 | trait RequestUrlTrait |
||
| 5 | { |
||
| 6 | public function getSuffix() |
||
| 7 | { |
||
| 8 | return $this->suffix; |
||
|
|
|||
| 9 | } |
||
| 10 | |||
| 11 | public function getTarget() |
||
| 12 | { |
||
| 13 | return $this->target; |
||
| 14 | } |
||
| 15 | |||
| 16 | public function getAppUrl() |
||
| 26 | } |
||
| 27 | |||
| 28 | public function getShortUrl() |
||
| 34 | } |
||
| 35 | |||
| 36 | public function getUrl($removeParameters = []) |
||
| 37 | { |
||
| 38 | $url = $this->getShortUrl(); |
||
| 39 | $query = $this->getQuery(); |
||
| 40 | foreach ($removeParameters as $item) { |
||
| 41 | if (array_key_exists($item, $query)) { |
||
| 42 | unset($query[$item]); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | $url .= $this->queryToString($query); |
||
| 46 | return $url; |
||
| 47 | } |
||
| 48 | |||
| 49 | public function getQuery() |
||
| 50 | { |
||
| 51 | return $this->query; |
||
| 52 | } |
||
| 53 | |||
| 54 | public function query($key, $defaultValue = false) |
||
| 55 | { |
||
| 56 | return \WebServCo\Framework\ArrayStorage::get( |
||
| 57 | $this->query, |
||
| 58 | $key, |
||
| 59 | $defaultValue |
||
| 60 | ); |
||
| 61 | } |
||
| 62 | |||
| 63 | public function queryToString($query = []) |
||
| 73 | } |
||
| 74 | } |
||
| 75 |