HydeExtension   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 66
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A discoverPages() 0 2 1
A booted() 0 2 1
A getPageClasses() 0 3 1
A discoverFiles() 0 2 1
A booting() 0 2 1
A discoverRoutes() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hyde\Foundation\Concerns;
6
7
use Hyde\Foundation\HydeKernel;
8
use Hyde\Foundation\Kernel\FileCollection;
9
use Hyde\Foundation\Kernel\PageCollection;
10
use Hyde\Foundation\Kernel\RouteCollection;
11
12
/**
13
 * When creating a HydePHP extension, you should create a class that extends this one.
14
 *
15
 * After registering your implementation with the HydeKernel (usually in a service provider),
16
 * Hyde will be able to use the information within to integrate your plugin, and to allow you to
17
 * hook into various parts of the internal application lifecycle, and through that, all aspects of Hyde.
18
 *
19
 * Before creating your extension, it will certainly be helpful if you first become familiar
20
 * with the basic internal architecture of HydePHP, as well as how the auto-discovery system functions.
21
 *
22
 * @link https://hydephp.com/docs/1.x/core-concepts
23
 *
24
 * It's important that your class is registered before the HydeKernel boots.
25
 * An excellent place for this is the 'register' method of your extensions service provider,
26
 * where you call the 'registerExtension' method of the HydeKernel singleton instance,
27
 * which you can access via the Hyde\Hyde facade, or via the service container.
28
 *
29
 * @example `$this->app->make(HydeKernel::class)->registerExtension(MyExtension::class);`
30
 */
31
abstract class HydeExtension
32
{
33
    /**
34
     * If your extension adds new discoverable page classes, you should register them here.
35
     *
36
     * Hyde will then automatically discover source files for the new page class,
37
     * generate routes, and compile the pages during the build process.
38
     *
39
     * If your page classes require more complex logic to discover their source files,
40
     * use the discovery handler methods found below for full process control.
41
     *
42
     * @return array<class-string<\Hyde\Pages\Concerns\HydePage>>
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<class-string<\Hyde...ges\Concerns\HydePage>> at position 2 could not be parsed: Unknown type name 'class-string' at position 2 in array<class-string<\Hyde\Pages\Concerns\HydePage>>.
Loading history...
43
     */
44
    public static function getPageClasses(): array
45
    {
46
        return [];
47
    }
48
49
    /**
50
     * If your extension needs to hook into the file discovery process,
51
     * you can configure the following handler method. It will be called
52
     * at the end of the file discovery process. The collection instance
53
     * will be injected, so that you can interact with it directly.
54
     */
55
    public function discoverFiles(FileCollection $collection): void
0 ignored issues
show
Unused Code introduced by
The parameter $collection is not used and could be removed. ( Ignorable by Annotation )

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

55
    public function discoverFiles(/** @scrutinizer ignore-unused */ FileCollection $collection): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
56
    {
57
        //
58
    }
59
60
    /**
61
     * If your extension needs to hook into the page discovery process,
62
     * you can configure the following handler method. It will be called
63
     * at the end of the page discovery process. The collection instance
64
     * will be injected, so that you can interact with it directly.
65
     */
66
    public function discoverPages(PageCollection $collection): void
0 ignored issues
show
Unused Code introduced by
The parameter $collection is not used and could be removed. ( Ignorable by Annotation )

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

66
    public function discoverPages(/** @scrutinizer ignore-unused */ PageCollection $collection): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
67
    {
68
        //
69
    }
70
71
    /**
72
     * If your extension needs to hook into the route discovery process,
73
     * you can configure the following handler method. It will be called
74
     * at the end of the route discovery process. The collection instance
75
     * will be injected, so that you can interact with it directly.
76
     */
77
    public function discoverRoutes(RouteCollection $collection): void
0 ignored issues
show
Unused Code introduced by
The parameter $collection is not used and could be removed. ( Ignorable by Annotation )

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

77
    public function discoverRoutes(/** @scrutinizer ignore-unused */ RouteCollection $collection): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
78
    {
79
        //
80
    }
81
82
    /**
83
     * Register a callback to be run before the kernel is booted,
84
     * which is before any file/page/route discovery has begun.
85
     */
86
    public function booting(HydeKernel $kernel): void
0 ignored issues
show
Unused Code introduced by
The parameter $kernel is not used and could be removed. ( Ignorable by Annotation )

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

86
    public function booting(/** @scrutinizer ignore-unused */ HydeKernel $kernel): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
87
    {
88
        //
89
    }
90
91
    /**
92
     * Register a callback to be run after the kernel is booted,
93
     * which is after file/page/route discovery has completed.
94
     */
95
    public function booted(HydeKernel $kernel): void
0 ignored issues
show
Unused Code introduced by
The parameter $kernel is not used and could be removed. ( Ignorable by Annotation )

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

95
    public function booted(/** @scrutinizer ignore-unused */ HydeKernel $kernel): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
96
    {
97
        //
98
    }
99
}
100