GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AirTableServiceProvider::boot()   B
last analyzed

Complexity

Conditions 10
Paths 1

Size

Total Lines 41
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 110

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 10
eloc 26
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 41
ccs 0
cts 26
cp 0
crap 110
rs 7.6666

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
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
Coding Style introduced by
Missing doc comment for class AirTableServiceProvider
Loading history...
13
{
14
15
    public function boot()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function boot()
Loading history...
16
    {
17
        ProgressExport::extend('airtable', function($container, $config) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
18
            $missingKey = null;
19
            if(!array_key_exists('apiKey', $config)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
20
                $missingKey = 'apiKey';
21
            }
22
            if(!array_key_exists('tableName', $config)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
23
                $missingKey = 'tableName';
24
            }
25
            if(!array_key_exists('baseId', $config)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
26
                $missingKey = 'baseId';
27
            }
28
            if($missingKey !== null) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
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
Coding Style introduced by
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.
Loading history...
39
40
        Exporter::extend('airtable', function($container, $config) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
41
            $missingKey = null;
42
            if(!array_key_exists('apiKey', $config)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
43
                $missingKey = 'apiKey';
44
            }
45
            if(!array_key_exists('tableName', $config)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
46
                $missingKey = 'tableName';
47
            }
48
            if(!array_key_exists('baseId', $config)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
49
                $missingKey = 'baseId';
50
            }
51
            if($missingKey !== null) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
52
                throw new \Exception(sprintf('The [%s] field must be given', $missingKey));
53
            }
54
55
            return new ControlAirTableHandler($config);
56
        });
0 ignored issues
show
Coding Style introduced by
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.
Loading history...
57
    }
58
    
59
}