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   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 2 Features 0
Metric Value
eloc 12
c 3
b 2
f 0
dl 0
loc 37
ccs 11
cts 11
cp 1
rs 10
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 10 4
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