Passed
Push — master ( 67229b...554f2e )
by Caen
03:21 queued 12s
created

HydeExtension::discoverFiles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hyde\Foundation\Concerns;
6
7
use Hyde\Foundation\FileCollection;
8
use Hyde\Foundation\PageCollection;
9
use Hyde\Foundation\RouteCollection;
10
11
/**
12
 * When creating a HydePHP extension, you should create a class that extends this one.
13
 *
14
 * After registering your implementation with the HydeKernel (usually in a service provider),
15
 * Hyde will be able to use the information within to integrate your plugin, and to allow you to
16
 * hook into various parts of the internal application lifecycle, and through that, all aspects of Hyde.
17
 *
18
 * Before creating your extension, it will certainly be helpful if you first become familiar
19
 * with the basic internal architecture of HydePHP, as well as how the auto-discovery system functions.
20
 *
21
 * @link https://hydephp.com/docs/master/architecture-concepts
22
 *
23
 * It's important that your class is registered before the HydeKernel boots.
24
 * An excellent place for this is the 'register' method of your extensions service provider,
25
 * where you call the 'registerExtension' method of the HydeKernel singleton instance,
26
 * which you can access via the Hyde\Hyde facade, or via the service container.
27
 *
28
 * @example ```php $this->app->make(HydeKernel::class)->registerExtension(MyExtension::class); ```
29
 *
30
 * @see \Hyde\Framework\Testing\Feature\HydeExtensionTest
31
 */
32
abstract class HydeExtension
33
{
34
    /**
35
     * If your extension adds new page classes, you should register them here.
36
     *
37
     * Hyde will then automatically discover source files for the new page class,
38
     * generate routes, and compile the pages during the build process.
39
     *
40
     * @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...
41
     */
42
    public static function getPageClasses(): array
43
    {
44
        return [];
45
    }
46
47
    /**
48
     * If your extension needs to hook into the file discovery process,
49
     * you can configure the following handler method. It will be called
50
     * at the end of the file discovery process. The collection instance
51
     * will be injected, so that you can interact with it directly.
52
     */
53
    public static 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

53
    public static 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...
54
    {
55
        //
56
    }
57
58
    /**
59
     * If your extension needs to hook into the page discovery process,
60
     * you can configure the following handler method. It will be called
61
     * at the end of the page discovery process. The collection instance
62
     * will be injected, so that you can interact with it directly.
63
     */
64
    public static 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

64
    public static 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...
65
    {
66
        //
67
    }
68
69
    /**
70
     * If your extension needs to hook into the route discovery process,
71
     * you can configure the following handler method. It will be called
72
     * at the end of the route discovery process. The collection instance
73
     * will be injected, so that you can interact with it directly.
74
     */
75
    public static 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

75
    public static 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...
76
    {
77
        //
78
    }
79
}
80