Conditions | 5 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
40 | 8 | public function buildMethodUrl($code, $params = []) |
|
41 | { |
||
42 | 8 | $host = $this->makeUserHost($this->subdomain); |
|
43 | 8 | $path = $this->settings->getMethodPath($code); |
|
44 | |||
45 | 8 | if (!empty($params)) { |
|
46 | 2 | $query = '?'; |
|
47 | 2 | foreach ($params as $key => $param) { |
|
48 | 2 | $query .= $key . '=' . $param; |
|
49 | |||
50 | 2 | if ($param !== end($params)) { |
|
51 | 2 | $query .= '&'; |
|
52 | } |
||
53 | } |
||
54 | } |
||
55 | |||
56 | 8 | $result = isset($query) ? $host . $path . $query : $host . $path; |
|
57 | |||
58 | 8 | return $result; |
|
59 | } |
||
69 | } |