| Total Complexity | 5 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 5 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 7 | trait SendsParameters |
||
| 8 | { |
||
| 9 | |||
| 10 | /** |
||
| 11 | * Adds values to the property which is used to send additional parameters in the request. |
||
| 12 | * |
||
| 13 | * @param $query |
||
| 14 | * @param string $column |
||
| 15 | * @param bool $encode |
||
| 16 | */ |
||
| 17 | public function add($query, $column = 'q', $encode = true) |
||
| 18 | { |
||
| 19 | $query = $encode ? urlencode($query) : $query; |
||
| 20 | |||
| 21 | if (isset($this->params[$column])) { |
||
| 22 | if ($column === 'pageToken') { |
||
| 23 | $this->params[$column] = $query; |
||
|
|
|||
| 24 | } else { |
||
| 25 | $this->params[$column] = "{$this->params[$column]} $query"; |
||
| 26 | } |
||
| 27 | } else { |
||
| 28 | $this->params = Arr::add($this->params, $column, $query); |
||
| 29 | } |
||
| 30 | |||
| 31 | } |
||
| 32 | |||
| 33 | public function addPageToken($token) |
||
| 36 | } |
||
| 37 | } |
||
| 38 |