@@ -22,8 +22,9 @@ |
||
| 22 | 22 | public function transform($data) |
| 23 | 23 | { |
| 24 | 24 | return collect($data)->mapWithKeys(function($value, $key) { |
| 25 | - if (!count($this->config['properties']) || (count($this->config['properties']) && in_array($key, $this->config['properties']))) |
|
| 26 | - return [preg_replace($this->config['pattern'], $this->config['replacement'], $key) => !is_array($value) ? $value : $this->transform($value)]; |
|
| 25 | + if (!count($this->config['properties']) || (count($this->config['properties']) && in_array($key, $this->config['properties']))) { |
|
| 26 | + return [preg_replace($this->config['pattern'], $this->config['replacement'], $key) => !is_array($value) ? $value : $this->transform($value)]; |
|
| 27 | + } |
|
| 27 | 28 | })->toArray(); |
| 28 | 29 | } |
| 29 | 30 | } |
| 30 | 31 | \ No newline at end of file |
@@ -19,7 +19,9 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | protected function boot() |
| 21 | 21 | { |
| 22 | - if (!$this->config->has('client')) $this->config->set('client', []); |
|
| 22 | + if (!$this->config->has('client')) { |
|
| 23 | + $this->config->set('client', []); |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | 26 | $this->setClient(new Client($this->config->get('client'))); |
| 25 | 27 | } |
@@ -62,7 +64,9 @@ discard block |
||
| 62 | 64 | */ |
| 63 | 65 | public function create($uri, $data = null, $options = []) |
| 64 | 66 | { |
| 65 | - if ($data) $options['form_params'] = $data; |
|
| 67 | + if ($data) { |
|
| 68 | + $options['form_params'] = $data; |
|
| 69 | + } |
|
| 66 | 70 | |
| 67 | 71 | return new HttpResponse($this->client->request('POST', $uri, $options)); |
| 68 | 72 | } |
@@ -75,7 +79,9 @@ discard block |
||
| 75 | 79 | */ |
| 76 | 80 | public function update($uri, $data = null, $options = []) |
| 77 | 81 | { |
| 78 | - if ($data) $options['form_params'] = $data; |
|
| 82 | + if ($data) { |
|
| 83 | + $options['form_params'] = $data; |
|
| 84 | + } |
|
| 79 | 85 | |
| 80 | 86 | return new HttpResponse($this->client->request('PATCH', $uri, $options)); |
| 81 | 87 | } |
@@ -88,7 +94,9 @@ discard block |
||
| 88 | 94 | */ |
| 89 | 95 | public function replace($uri, $data = null, $options = []) |
| 90 | 96 | { |
| 91 | - if ($data) $options['form_params'] = $data; |
|
| 97 | + if ($data) { |
|
| 98 | + $options['form_params'] = $data; |
|
| 99 | + } |
|
| 92 | 100 | |
| 93 | 101 | return new HttpResponse($this->client->request('PUT', $uri, $options)); |
| 94 | 102 | } |