MissingAppKeySolutionProvider::getSolutions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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