dacastro4 /
laravel-gmail
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Dacastro4\LaravelGmail\Traits; |
||
| 4 | |||
| 5 | use Illuminate\Support\Arr; |
||
| 6 | |||
| 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; |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 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) |
||
| 34 | { |
||
| 35 | $this->params['pageToken'] = $token; |
||
|
0 ignored issues
–
show
|
|||
| 36 | } |
||
| 37 | } |
||
| 38 |