1 | <?php |
||||
2 | |||||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||||
3 | namespace BristolSU\AirTable\Control; |
||||
4 | |||||
5 | use BristolSU\AirTable\Jobs\CreateRecords; |
||||
6 | use BristolSU\AirTable\Jobs\FlushRows; |
||||
7 | use BristolSU\ControlDB\Export\FormattedItem; |
||||
8 | use BristolSU\ControlDB\Export\Handler\Handler; |
||||
9 | use Carbon\Carbon; |
||||
10 | use Illuminate\Support\Collection; |
||||
11 | use Illuminate\Support\Facades\Log; |
||||
12 | |||||
13 | class AirtableHandler extends Handler |
||||
0 ignored issues
–
show
|
|||||
14 | { |
||||
15 | |||||
16 | /** |
||||
17 | * Save each item to AirTable |
||||
18 | * |
||||
19 | * @param FormattedItem[] $items |
||||
0 ignored issues
–
show
|
|||||
20 | * @return mixed|void |
||||
0 ignored issues
–
show
|
|||||
21 | */ |
||||
22 | 1 | protected function save(array $items) |
|||
23 | { |
||||
24 | 1 | $creating = []; |
|||
25 | |||||
26 | 1 | foreach($items as $item) { |
|||
0 ignored issues
–
show
|
|||||
27 | 1 | $creating[] = $item->toArray(); |
|||
28 | } |
||||
29 | |||||
30 | 1 | $this->log('Flushing rows'); |
|||
31 | |||||
32 | 1 | dispatch_now( |
|||
33 | 1 | (new FlushRows( |
|||
34 | 1 | $this->config('apiKey'), |
|||
0 ignored issues
–
show
It seems like
$this->config('apiKey') can also be of type null ; however, parameter $apiKey of BristolSU\AirTable\Jobs\FlushRows::__construct() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
35 | 1 | $this->config('baseId'), |
|||
0 ignored issues
–
show
It seems like
$this->config('baseId') can also be of type null ; however, parameter $baseId of BristolSU\AirTable\Jobs\FlushRows::__construct() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
36 | 1 | $this->config('tableName') |
|||
0 ignored issues
–
show
It seems like
$this->config('tableName') can also be of type null ; however, parameter $tableName of BristolSU\AirTable\Jobs\FlushRows::__construct() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
37 | 1 | ))->withDebug($this->config('debug', false)) |
|||
0 ignored issues
–
show
It seems like
$this->config('debug', false) can also be of type null ; however, parameter $debug of BristolSU\AirTable\Jobs\FlushRows::withDebug() does only seem to accept boolean , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
38 | ); |
||||
39 | |||||
40 | 1 | $this->log('Flushed rows. Creating records'); |
|||
41 | |||||
42 | |||||
43 | 1 | foreach(array_chunk($creating, 10) as $data) { |
|||
0 ignored issues
–
show
|
|||||
44 | 1 | dispatch((new CreateRecords( |
|||
0 ignored issues
–
show
|
|||||
45 | 1 | $data, |
|||
46 | 1 | $this->config('apiKey'), |
|||
0 ignored issues
–
show
It seems like
$this->config('apiKey') can also be of type null ; however, parameter $apiKey of BristolSU\AirTable\Jobs\...eRecords::__construct() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
47 | 1 | $this->config('baseId'), |
|||
0 ignored issues
–
show
It seems like
$this->config('baseId') can also be of type null ; however, parameter $baseId of BristolSU\AirTable\Jobs\...eRecords::__construct() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
48 | 1 | $this->config('tableName') |
|||
0 ignored issues
–
show
It seems like
$this->config('tableName') can also be of type null ; however, parameter $tableName of BristolSU\AirTable\Jobs\...eRecords::__construct() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
49 | 1 | ))->withDebug($this->config('debug', false))); |
|||
0 ignored issues
–
show
It seems like
$this->config('debug', false) can also be of type null ; however, parameter $debug of BristolSU\AirTable\Jobs\CreateRecords::withDebug() does only seem to accept boolean , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() 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.
![]() |
|||||
50 | } |
||||
51 | |||||
52 | 1 | $this->log('Created Records'); |
|||
53 | |||||
54 | 1 | } |
|||
55 | |||||
56 | 1 | private function log(string $string) |
|||
0 ignored issues
–
show
|
|||||
57 | { |
||||
58 | 1 | if($this->config('debug', false)) { |
|||
0 ignored issues
–
show
|
|||||
59 | Log::debug($string); |
||||
60 | } |
||||
61 | 1 | } |
|||
62 | } |
||||
63 |