CouldNotRegisterComponent::invalidArgument()   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 0
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