@@ -214,7 +214,7 @@ |
||
214 | 214 | |
215 | 215 | public function getIdsFromTable(): array |
216 | 216 | { |
217 | - $ids = []; |
|
217 | + $ids = []; |
|
218 | 218 | foreach($this->retrieveRecords() as $record) { |
219 | 219 | $ids[] = $record['id']; |
220 | 220 | } |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | { |
102 | 102 | $options = [ |
103 | 103 | 'headers' => [ |
104 | - 'Authorization' => 'Bearer ' . $this->apiKey |
|
104 | + 'Authorization' => 'Bearer '.$this->apiKey |
|
105 | 105 | ] |
106 | 106 | ]; |
107 | - if($data !== null) { |
|
108 | - if($method === 'get' || $method === 'delete') { |
|
107 | + if ($data !== null) { |
|
108 | + if ($method === 'get' || $method === 'delete') { |
|
109 | 109 | $options['query'] = $data; |
110 | 110 | } else { |
111 | 111 | $options['json'] = $data; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | try { |
123 | 123 | return $execution->call($this, $dataChunk); |
124 | 124 | } catch (\GuzzleHttp\Exception\ClientException $exception) { |
125 | - if($exception->getCode() === 429) { |
|
125 | + if ($exception->getCode() === 429) { |
|
126 | 126 | sleep(static::$rateLimitCooldown); |
127 | 127 | return $this->execute($dataChunk, $execution); |
128 | 128 | } else { |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | protected function chunkAndThrottle(array $data, \Closure $execution, int $delay = 1, int $chunkSize = 10) |
135 | 135 | { |
136 | 136 | $chunkedData = array_chunk($data, $chunkSize, false); |
137 | - foreach($chunkedData as $key => $dataChunk) { |
|
137 | + foreach ($chunkedData as $key => $dataChunk) { |
|
138 | 138 | $this->execute($dataChunk, $execution); |
139 | - if($key !== array_key_last($chunkedData)) { |
|
139 | + if ($key !== array_key_last($chunkedData)) { |
|
140 | 140 | sleep($delay); |
141 | 141 | } |
142 | 142 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | public function createRows(array $rows, bool $typecast = true) |
158 | 158 | { |
159 | 159 | $data = []; |
160 | - foreach($rows as $row) { |
|
160 | + foreach ($rows as $row) { |
|
161 | 161 | $data[] = ['fields' => $row]; |
162 | 162 | } |
163 | 163 | |
@@ -203,19 +203,19 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | $records = array_merge($records, $newRecords); |
206 | - if(array_key_exists('offset', $responseData)) { |
|
206 | + if (array_key_exists('offset', $responseData)) { |
|
207 | 207 | $offset = $responseData['offset']; |
208 | 208 | } else { |
209 | 209 | $offset = null; |
210 | 210 | } |
211 | - } while($offset !== null); |
|
211 | + } while ($offset !== null); |
|
212 | 212 | return $records; |
213 | 213 | } |
214 | 214 | |
215 | 215 | public function getIdsFromTable(): array |
216 | 216 | { |
217 | 217 | $ids = []; |
218 | - foreach($this->retrieveRecords() as $record) { |
|
218 | + foreach ($this->retrieveRecords() as $record) { |
|
219 | 219 | $ids[] = $record['id']; |
220 | 220 | } |
221 | 221 | return $ids; |
@@ -16,16 +16,16 @@ discard block |
||
16 | 16 | { |
17 | 17 | ProgressExport::extend('airtable', function($container, $config) { |
18 | 18 | $missingKey = null; |
19 | - if(!array_key_exists('apiKey', $config)) { |
|
19 | + if (!array_key_exists('apiKey', $config)) { |
|
20 | 20 | $missingKey = 'apiKey'; |
21 | 21 | } |
22 | - if(!array_key_exists('tableName', $config)) { |
|
22 | + if (!array_key_exists('tableName', $config)) { |
|
23 | 23 | $missingKey = 'tableName'; |
24 | 24 | } |
25 | - if(!array_key_exists('baseId', $config)) { |
|
25 | + if (!array_key_exists('baseId', $config)) { |
|
26 | 26 | $missingKey = 'baseId'; |
27 | 27 | } |
28 | - if($missingKey !== null) { |
|
28 | + if ($missingKey !== null) { |
|
29 | 29 | throw new \Exception(sprintf('The [%s] field must be given', $missingKey)); |
30 | 30 | } |
31 | 31 | |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | |
39 | 39 | Exporter::extend('airtable', function($container, $config) { |
40 | 40 | $missingKey = null; |
41 | - if(!array_key_exists('apiKey', $config)) { |
|
41 | + if (!array_key_exists('apiKey', $config)) { |
|
42 | 42 | $missingKey = 'apiKey'; |
43 | 43 | } |
44 | - if(!array_key_exists('tableName', $config)) { |
|
44 | + if (!array_key_exists('tableName', $config)) { |
|
45 | 45 | $missingKey = 'tableName'; |
46 | 46 | } |
47 | - if(!array_key_exists('baseId', $config)) { |
|
47 | + if (!array_key_exists('baseId', $config)) { |
|
48 | 48 | $missingKey = 'baseId'; |
49 | 49 | } |
50 | - if($missingKey !== null) { |
|
50 | + if ($missingKey !== null) { |
|
51 | 51 | throw new \Exception(sprintf('The [%s] field must be given', $missingKey)); |
52 | 52 | } |
53 | 53 |
@@ -22,12 +22,12 @@ |
||
22 | 22 | { |
23 | 23 | $creating = []; |
24 | 24 | |
25 | - foreach($items as $item) { |
|
25 | + foreach ($items as $item) { |
|
26 | 26 | $creating[] = $item->toArray(); |
27 | 27 | } |
28 | 28 | |
29 | 29 | $creatingJobs = []; |
30 | - foreach(array_chunk($creating, 10) as $data) { |
|
30 | + foreach (array_chunk($creating, 10) as $data) { |
|
31 | 31 | $creatingJobs[] = new CreateRecords( |
32 | 32 | $data, |
33 | 33 | $this->config('apiKey'), |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | protected function filterModules(\Closure $filter, Progress $progress, $moduleInstances) |
31 | 31 | { |
32 | 32 | return collect($progress->getModules()) |
33 | - ->filter($filter)->map(function (ModuleInstanceProgress $moduleInstanceProgress) use ($moduleInstances) { |
|
33 | + ->filter($filter)->map(function(ModuleInstanceProgress $moduleInstanceProgress) use ($moduleInstances) { |
|
34 | 34 | return $moduleInstances[$moduleInstanceProgress->getModuleInstanceId()]; |
35 | 35 | })->values()->toArray(); |
36 | 36 | } |
@@ -41,35 +41,35 @@ discard block |
||
41 | 41 | ->getById($progress->getActivityInstanceId()); |
42 | 42 | $moduleInstances = app(ModuleInstanceRepository::class) |
43 | 43 | ->allThroughActivity($activityInstance->activity) |
44 | - ->reduce(function ($carry, ModuleInstance $moduleInstance) { |
|
44 | + ->reduce(function($carry, ModuleInstance $moduleInstance) { |
|
45 | 45 | $carry[$moduleInstance->id()] = $moduleInstance->name; |
46 | 46 | return $carry; |
47 | 47 | }); |
48 | 48 | |
49 | 49 | return [ |
50 | 50 | 'Participant Name' => $activityInstance->participantName(), |
51 | - 'Mandatory Modules' => $this->filterModules(function (ModuleInstanceProgress $moduleInstanceProgress) { |
|
51 | + 'Mandatory Modules' => $this->filterModules(function(ModuleInstanceProgress $moduleInstanceProgress) { |
|
52 | 52 | return $moduleInstanceProgress->isMandatory(); |
53 | 53 | }, $progress, $moduleInstances), |
54 | - 'Optional Modules' => $this->filterModules(function (ModuleInstanceProgress $moduleInstanceProgress) { |
|
54 | + 'Optional Modules' => $this->filterModules(function(ModuleInstanceProgress $moduleInstanceProgress) { |
|
55 | 55 | return !$moduleInstanceProgress->isMandatory(); |
56 | 56 | }, $progress, $moduleInstances), |
57 | - 'Complete Modules' => $this->filterModules(function (ModuleInstanceProgress $moduleInstanceProgress) { |
|
57 | + 'Complete Modules' => $this->filterModules(function(ModuleInstanceProgress $moduleInstanceProgress) { |
|
58 | 58 | return $moduleInstanceProgress->isComplete(); |
59 | 59 | }, $progress, $moduleInstances), |
60 | - 'Incomplete Modules' => $this->filterModules(function (ModuleInstanceProgress $moduleInstanceProgress) { |
|
60 | + 'Incomplete Modules' => $this->filterModules(function(ModuleInstanceProgress $moduleInstanceProgress) { |
|
61 | 61 | return !$moduleInstanceProgress->isComplete(); |
62 | 62 | }, $progress, $moduleInstances), |
63 | - 'Active Modules' => $this->filterModules(function (ModuleInstanceProgress $moduleInstanceProgress) { |
|
63 | + 'Active Modules' => $this->filterModules(function(ModuleInstanceProgress $moduleInstanceProgress) { |
|
64 | 64 | return $moduleInstanceProgress->isActive(); |
65 | 65 | }, $progress, $moduleInstances), |
66 | - 'Inactive Modules' => $this->filterModules(function (ModuleInstanceProgress $moduleInstanceProgress) { |
|
66 | + 'Inactive Modules' => $this->filterModules(function(ModuleInstanceProgress $moduleInstanceProgress) { |
|
67 | 67 | return !$moduleInstanceProgress->isActive(); |
68 | 68 | }, $progress, $moduleInstances), |
69 | - 'Hidden Modules' => $this->filterModules(function (ModuleInstanceProgress $moduleInstanceProgress) { |
|
69 | + 'Hidden Modules' => $this->filterModules(function(ModuleInstanceProgress $moduleInstanceProgress) { |
|
70 | 70 | return !$moduleInstanceProgress->isVisible(); |
71 | 71 | }, $progress, $moduleInstances), |
72 | - 'Visible Modules' => $this->filterModules(function (ModuleInstanceProgress $moduleInstanceProgress) { |
|
72 | + 'Visible Modules' => $this->filterModules(function(ModuleInstanceProgress $moduleInstanceProgress) { |
|
73 | 73 | return $moduleInstanceProgress->isVisible(); |
74 | 74 | }, $progress, $moduleInstances), |
75 | 75 | '% Complete' => $progress->getPercentage(), |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | protected function createRecords(array $data) |
102 | 102 | { |
103 | 103 | $creatingJobs = []; |
104 | - foreach(array_chunk($data, 10) as $rows) { |
|
104 | + foreach (array_chunk($data, 10) as $rows) { |
|
105 | 105 | $creatingJobs[] = new CreateRecords( |
106 | 106 | $rows, |
107 | 107 | $this->apiKey, |