CouldNotRegisterComponent   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 32
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A viewNotFound() 0 4 1
A viewPathNotFound() 0 4 1
A invalidArgument() 0 4 1
A viewModelNotFound() 0 4 1
A viewModelNotArrayable() 0 4 1
A viewDirectoryWithoutWildcard() 0 4 1
1
<?php
2
3
namespace Spatie\BladeX\Exceptions;
4
5
use Exception;
6
use Illuminate\Contracts\Support\Arrayable;
7
8
class CouldNotRegisterComponent extends Exception
9
{
10
    public static function viewNotFound(string $view, string $tag)
11
    {
12
        return new static("Could not register component `{$tag}` because view `{$view}` was not found.");
13
    }
14
15
    public static function viewPathNotFound(string $viewPath)
16
    {
17
        return new static("Could not register the components in view path `{$viewPath}`, because the directory does not exist.");
18
    }
19
20
    public static function invalidArgument()
21
    {
22
        return new static("You passed an invalid argument to `BladeX:component`. A valid argument is either a string, an array or an instance of  `Spatie\BladeX\Component`");
23
    }
24
25
    public static function viewModelNotFound(string $componentName, string $viewModelClass)
26
    {
27
        return new static("Could not register component `{$componentName}` because the view model class `{$viewModelClass}` was not found.");
28
    }
29
30
    public static function viewModelNotArrayable(string $componentName, string $viewModelClass)
31
    {
32
        return new static("Could not register component `{$componentName}` because the view model class `{$viewModelClass}` does not implement `".Arrayable::class.'`.');
33
    }
34
35
    public static function viewDirectoryWithoutWildcard(string $viewDirectory)
36
    {
37
        return new static("Could not register components because the view directory `{$viewDirectory}` does not end with a wildcard.");
38
    }
39
}
40