CommentifyPlugin::register()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
c 2
b 0
f 0
nc 2
nop 1
dl 0
loc 14
rs 10
1
<?php
2
3
namespace Usamamuneerchaudhary\Commentify\Filament;
4
5
use Filament\Contracts\Plugin;
0 ignored issues
show
Bug introduced by
The type Filament\Contracts\Plugin was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Filament\Facades\Filament;
0 ignored issues
show
Bug introduced by
The type Filament\Facades\Filament was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Filament\Panel;
0 ignored issues
show
Bug introduced by
The type Filament\Panel was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Usamamuneerchaudhary\Commentify\Filament\Pages\CommentifySettings;
9
use Usamamuneerchaudhary\Commentify\Filament\Resources\CommentReportResource;
10
use Usamamuneerchaudhary\Commentify\Filament\Resources\CommentResource;
11
12
class CommentifyPlugin implements Plugin
13
{
14
    public function getId(): string
15
    {
16
        return 'commentify';
17
    }
18
19
    public function register(Panel $panel): void
20
    {
21
        // Check if Filament is installed
22
        if (!class_exists(Filament::class)) {
23
            return;
24
        }
25
26
        $panel
27
            ->resources([
28
                CommentResource::class,
29
                CommentReportResource::class,
30
            ])
31
            ->pages([
32
                CommentifySettings::class,
33
            ]);
34
    }
35
36
    public function boot(Panel $panel): void
37
    {
38
        //
39
    }
40
41
    public static function make(): static
42
    {
43
        return app(static::class);
44
    }
45
46
    public static function get(): static
47
    {
48
        return filament(app(static::class)->getId());
0 ignored issues
show
Bug introduced by
The function filament was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

48
        return /** @scrutinizer ignore-call */ filament(app(static::class)->getId());
Loading history...
49
    }
50
}
51
52