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.

IndexHydrate::handle()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 4

Importance

Changes 3
Bugs 2 Features 0
Metric Value
cc 4
eloc 6
c 3
b 2
f 0
nc 4
nop 1
dl 0
loc 10
ccs 7
cts 7
cp 1
crap 4
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 Omatech\Enigma\Enigma;
10
11
class IndexHydrate implements ShouldQueue
12
{
13
    use Dispatchable, InteractsWithQueue, Queueable;
14
15
    private $modelClass;
16
    private $modelId;
17
18
    /**
19
     * Create a new job instance.
20
     *
21
     * @param string $modelClass
22
     * @param int $modelId
23
     */
24 48
    public function __construct(string $modelClass, int $modelId)
25
    {
26 48
        $this->modelClass = $modelClass;
27 48
        $this->modelId = $modelId;
28 48
    }
29
30
    /**
31
     * Execute the job.
32
     *
33
     * @param Enigma $enigma
34
     * @return void
35
     * @throws \ParagonIE\CipherSweet\Exception\BlindIndexNameCollisionException
36
     * @throws \ParagonIE\CipherSweet\Exception\CryptoOperationException
37
     */
38 44
    public function handle(Enigma $enigma)
39
    {
40 44
        $model = (new $this->modelClass)::find($this->modelId);
41
42 44
        if (null !== $model) {
43 44
            $enigmaEncryptable = $model->getEnigmaEncryptable();
44
45 44
            foreach ($enigmaEncryptable as $column) {
46 44
                if ($model->{$column} !== null) {
47 44
                    $enigma->hydrateAsModel($model, $column, $model->{$column});
48
                }
49
            }
50
        }
51 44
    }
52
}
53