Completed
Pull Request — master (#200)
by Travis
01:28
created

MissingMixManifestSolutionProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 22
loc 22
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A canSolve() 8 8 2
A getSolutions() 10 10 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Facade\Ignition\SolutionProviders;
4
5
use Facade\Ignition\Exceptions\ViewException;
6
use Illuminate\Support\Str;
7
use Throwable;
8
use Facade\IgnitionContracts\BaseSolution;
9
use Facade\IgnitionContracts\HasSolutionsForThrowable;
10
11 View Code Duplication
class MissingMixManifestSolutionProvider implements HasSolutionsForThrowable
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    public function canSolve(Throwable $throwable): bool
14
    {
15
        if (! $throwable instanceof ViewException) {
16
            return false;
17
        }
18
19
        return Str::startsWith($throwable->getMessage(), 'The Mix manifest does not exist');
20
    }
21
22
    public function getSolutions(Throwable $throwable): array
23
    {
24
        return [
25
            BaseSolution::create('')
26
                ->setSolutionDescription('You should regenerate your assets')
27
                ->setDocumentationLinks([
28
                    'Running Mix' => 'https://laravel.com/docs/master/mix#running-mix'
29
                ])
30
        ];
31
    }
32
}
33