MissingAppKeySolutionProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 16
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A canSolve() 0 8 2
A getSolutions() 0 4 1
1
<?php
2
3
namespace Facade\Ignition\SolutionProviders;
4
5
use Facade\Ignition\Solutions\GenerateAppKeySolution;
6
use Facade\IgnitionContracts\HasSolutionsForThrowable;
7
use RuntimeException;
8
use Throwable;
9
10
class MissingAppKeySolutionProvider implements HasSolutionsForThrowable
11
{
12
    public function canSolve(Throwable $throwable): bool
13
    {
14
        if (! $throwable instanceof RuntimeException) {
15
            return false;
16
        }
17
18
        return $throwable->getMessage() === 'No application encryption key has been specified.';
19
    }
20
21
    public function getSolutions(Throwable $throwable): array
22
    {
23
        return [new GenerateAppKeySolution()];
24
    }
25
}
26