1 | <?php |
||
2 | |||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
3 | namespace BristolSU\AirTable; |
||
4 | |||
5 | use BristolSU\AirTable\Control\AirtableHandler as ControlAirTableHandler; |
||
6 | use BristolSU\AirTable\Progress\AirtableHandler as ProgressAirTableHandler; |
||
7 | use BristolSU\ControlDB\Export\Exporter; |
||
8 | use BristolSU\ControlDB\Export\ExportManager; |
||
9 | use BristolSU\Support\Progress\ProgressExport; |
||
10 | use Illuminate\Support\ServiceProvider; |
||
11 | |||
12 | class AirTableServiceProvider extends ServiceProvider |
||
0 ignored issues
–
show
|
|||
13 | { |
||
14 | |||
15 | public function boot() |
||
0 ignored issues
–
show
|
|||
16 | { |
||
17 | ProgressExport::extend('airtable', function($container, $config) { |
||
0 ignored issues
–
show
|
|||
18 | $missingKey = null; |
||
19 | if(!array_key_exists('apiKey', $config)) { |
||
0 ignored issues
–
show
|
|||
20 | $missingKey = 'apiKey'; |
||
21 | } |
||
22 | if(!array_key_exists('tableName', $config)) { |
||
0 ignored issues
–
show
|
|||
23 | $missingKey = 'tableName'; |
||
24 | } |
||
25 | if(!array_key_exists('baseId', $config)) { |
||
0 ignored issues
–
show
|
|||
26 | $missingKey = 'baseId'; |
||
27 | } |
||
28 | if($missingKey !== null) { |
||
0 ignored issues
–
show
|
|||
29 | throw new \Exception(sprintf('The [%s] field must be given', $missingKey)); |
||
30 | } |
||
31 | |||
32 | return new ProgressAirTableHandler( |
||
33 | $config['baseId'], |
||
34 | $config['tableName'], |
||
35 | $config['apiKey'], |
||
36 | (array_key_exists('debug', $config) ? (bool) $config['debug'] : false) |
||
37 | ); |
||
38 | }); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
39 | |||
40 | Exporter::extend('airtable', function($container, $config) { |
||
0 ignored issues
–
show
|
|||
41 | $missingKey = null; |
||
42 | if(!array_key_exists('apiKey', $config)) { |
||
0 ignored issues
–
show
|
|||
43 | $missingKey = 'apiKey'; |
||
44 | } |
||
45 | if(!array_key_exists('tableName', $config)) { |
||
0 ignored issues
–
show
|
|||
46 | $missingKey = 'tableName'; |
||
47 | } |
||
48 | if(!array_key_exists('baseId', $config)) { |
||
0 ignored issues
–
show
|
|||
49 | $missingKey = 'baseId'; |
||
50 | } |
||
51 | if($missingKey !== null) { |
||
0 ignored issues
–
show
|
|||
52 | throw new \Exception(sprintf('The [%s] field must be given', $missingKey)); |
||
53 | } |
||
54 | |||
55 | return new ControlAirTableHandler($config); |
||
56 | }); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
57 | } |
||
58 | |||
59 | } |