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.
Passed
Push — master ( 729ed9...157ece )
by Toby
05:11
created

CreateRecords   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 65.52%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 28
c 2
b 0
f 0
dl 0
loc 54
ccs 19
cts 29
cp 0.6552
rs 10
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A retryUntil() 0 3 1
A handle() 0 8 1
A middleware() 0 9 1
A __construct() 0 6 1
A log() 0 4 2
A withDebug() 0 4 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\AirTable\Jobs;
4
5
use BristolSU\AirTable\AirTable;
6
use Illuminate\Bus\Queueable;
7
use Illuminate\Contracts\Queue\ShouldQueue;
8
use Illuminate\Foundation\Bus\Dispatchable;
9
use Illuminate\Queue\InteractsWithQueue;
10
use Illuminate\Support\Facades\Log;
11
use Spatie\RateLimitedMiddleware\RateLimited;
12
13
class CreateRecords implements ShouldQueue
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class CreateRecords
Loading history...
14
{
15
    use Dispatchable, Queueable, InteractsWithQueue;
16
17
    private array $data;
0 ignored issues
show
Coding Style introduced by
Private member variable "data" must be prefixed with an underscore
Loading history...
18
    private string $apiKey;
0 ignored issues
show
Coding Style introduced by
Private member variable "apiKey" must be prefixed with an underscore
Loading history...
19
    private string $baseId;
0 ignored issues
show
Coding Style introduced by
Private member variable "baseId" must be prefixed with an underscore
Loading history...
20
    private string $tableName;
0 ignored issues
show
Coding Style introduced by
Private member variable "tableName" must be prefixed with an underscore
Loading history...
21
    private bool $debug = false;
0 ignored issues
show
Coding Style introduced by
Private member variable "debug" must be prefixed with an underscore
Loading history...
22
23 5
    public function __construct(array $data, string $apiKey, string $baseId, string $tableName)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
24
    {
25 5
        $this->data = $data;
26 5
        $this->apiKey = $apiKey;
27 5
        $this->baseId = $baseId;
28 5
        $this->tableName = $tableName;
29 5
    }
30
31
    public function middleware()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function middleware()
Loading history...
32
    {
33
        $rateLimitedMiddleware = (new RateLimited())
34
            ->key('airtable')
35
            ->allow(1)
36
            ->everySeconds(1)
37
            ->releaseAfterSeconds(3);
38
39
        return [$rateLimitedMiddleware];
40
    }
41
    
42 1
    public function handle(AirTable $airTable)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function handle()
Loading history...
43
    {
44 1
        $airTable->setApiKey($this->apiKey);
45 1
        $airTable->setBaseId($this->baseId);
46 1
        $airTable->setTableName($this->tableName);
47 1
        $this->log('Creating Rows');
48 1
        $airTable->createRows($this->data, true);
49 1
        $this->log('Created Rows');
50 1
    }
51
52 4
    public function withDebug(bool $debug)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function withDebug()
Loading history...
53
    {
54 4
        $this->debug = $debug;
55 4
        return $this;
56
    }
57
58
    public function retryUntil() :  \DateTime
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function retryUntil()
Loading history...
59
    {
60
        return now()->addHours(5);
61
    }
62
63 1
    private function log(string $string)
0 ignored issues
show
Coding Style introduced by
Private method name "CreateRecords::log" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Missing doc comment for function log()
Loading history...
64
    {
65 1
        if($this->debug) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
66
            Log::debug($string);
67
        }
68 1
    }
69
70
}