@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function pipe($options = []) |
| 14 | 14 | { |
| 15 | - return function ($inputData) use ($options) { |
|
| 15 | + return function($inputData) use ($options) { |
|
| 16 | 16 | return Arr::get($inputData, Arr::get($options, 'key')); |
| 17 | 17 | }; |
| 18 | 18 | } |
@@ -33,8 +33,8 @@ |
||
| 33 | 33 | $header = array_shift($data); |
| 34 | 34 | |
| 35 | 35 | if ($this->config['useHeaderAsIndex']) { |
| 36 | - $data = collect($data)->map(function ($row) use ($header) { |
|
| 37 | - return collect($row)->mapWithKeys(function ($column, $index) use ($header) { |
|
| 36 | + $data = collect($data)->map(function($row) use ($header) { |
|
| 37 | + return collect($row)->mapWithKeys(function($column, $index) use ($header) { |
|
| 38 | 38 | return [$header[$index] => $column]; |
| 39 | 39 | }); |
| 40 | 40 | })->toArray(); |
@@ -59,9 +59,9 @@ |
||
| 59 | 59 | private function parseMoney($value) |
| 60 | 60 | { |
| 61 | 61 | $isNegative = str_contains($value, '-'); |
| 62 | - $valueToParse = str_replace([' ','+','-'], '', $value); |
|
| 62 | + $valueToParse = str_replace([' ', '+', '-'], '', $value); |
|
| 63 | 63 | |
| 64 | - try{ |
|
| 64 | + try { |
|
| 65 | 65 | /** @var \Money\Money $money */ |
| 66 | 66 | $money = $this->moneyParser->parse($valueToParse); |
| 67 | 67 | $value = [ |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | private function parseDate($value) |
| 40 | 40 | { |
| 41 | - try{ |
|
| 41 | + try { |
|
| 42 | 42 | $value = (new Carbon($value, $this->config['timezone']))->toIso8601String(); |
| 43 | 43 | } catch (\Exception $e) { |
| 44 | 44 | } |
@@ -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 |
@@ -37,15 +37,15 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | public function toArray() |
| 39 | 39 | { |
| 40 | - $crawler = new Crawler((string)$this->getData()); |
|
| 40 | + $crawler = new Crawler((string) $this->getData()); |
|
| 41 | 41 | |
| 42 | - return $crawler->filter($this->getConfig()['selector'])->each(function ($table) { |
|
| 42 | + return $crawler->filter($this->getConfig()['selector'])->each(function($table) { |
|
| 43 | 43 | $rows = []; |
| 44 | 44 | try { |
| 45 | 45 | /** @var Crawler $table */ |
| 46 | - $rows = $table->filter('tr')->each(function ($row) { |
|
| 46 | + $rows = $table->filter('tr')->each(function($row) { |
|
| 47 | 47 | /** @var Crawler $row */ |
| 48 | - return $row->filter('th,td')->each(function ($column) { |
|
| 48 | + return $row->filter('th,td')->each(function($column) { |
|
| 49 | 49 | /** @var Crawler $column */ |
| 50 | 50 | return trim($column->text()); |
| 51 | 51 | }); |
@@ -31,9 +31,9 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function toArray() |
| 33 | 33 | { |
| 34 | - $crawler = new Crawler((string)$this->getData()); |
|
| 34 | + $crawler = new Crawler((string) $this->getData()); |
|
| 35 | 35 | |
| 36 | - return $crawler->filter($this->getConfig()['selector'])->each(function ($element) { |
|
| 36 | + return $crawler->filter($this->getConfig()['selector'])->each(function($element) { |
|
| 37 | 37 | /** @var Crawler $element */ |
| 38 | 38 | return $this->domNodeToArray($element->getNode(0)); |
| 39 | 39 | }); |
@@ -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 | } |