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 ( 698fd2...95f32c )
by Christian
10:54 queued 08:21
created

IndexHydrate::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Omatech\Enigma\Jobs;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Contracts\Queue\ShouldQueue;
7
use Illuminate\Foundation\Bus\Dispatchable;
8
use Illuminate\Queue\InteractsWithQueue;
9
use Illuminate\Queue\SerializesModels;
10
use Omatech\Enigma\Enigma;
11
12
class IndexHydrate implements ShouldQueue
13
{
14
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by Omatech\Enigma\Jobs\IndexHydrate: $id, $relations, $class, $keyBy
Loading history...
15
16
    private $modelClass;
17
    private $modelId;
18
19
    /**
20
     * Create a new job instance.
21
     *
22
     * @param string $modelClass
23
     * @param int $modelId
24
     */
25 52
    public function __construct(string $modelClass, int $modelId)
26
    {
27 52
        $this->modelClass = $modelClass;
28 52
        $this->modelId = $modelId;
29 52
    }
30
31
    /**
32
     * Execute the job.
33
     *
34
     * @param Enigma $enigma
35
     * @return void
36
     * @throws \ParagonIE\CipherSweet\Exception\BlindIndexNameCollisionException
37
     * @throws \ParagonIE\CipherSweet\Exception\CryptoOperationException
38
     */
39 48
    public function handle(Enigma $enigma)
40
    {
41 48
        $model = (new $this->modelClass)::find($this->modelId);
42 48
        $enigmaEncryptable = $model->getEnigmaEncryptable();
43
44 48
        foreach ($enigmaEncryptable as $column) {
45 44
            if ($model->{$column} !== null) {
46 44
                $enigma->hydrateAsModel($model, $column, $model->{$column});
47
            }
48
        }
49 48
    }
50
}
51