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

DeleteRows   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Test Coverage

Coverage 65.52%

Importance

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

6 Methods

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