ComponentRegistrar::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 10
rs 10
1
<?php
2
3
namespace KielD01\LaravelMaterialDashboardPro\View\Components;
4
5
use Illuminate\Support\Facades\Blade;
6
use Illuminate\Support\Str;
7
use KielD01\LaravelMaterialDashboardPro\View\Components\Widgets\CardWidget;
8
9
final class ComponentRegistrar
10
{
11
    private array $components = [
12
        CardWidget::class
13
    ];
14
15
    public function register(): void
16
    {
17
        array_map(
18
            fn(string $class) => Blade::component(
19
                forward_static_call(
20
                    sprintf('%s::getComponentName', $class)
21
                ) ?? Str::camel($class),
22
                $class
23
            ),
24
            $this->components
25
        );
26
    }
27
}