Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
AbstractModule | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
1 / 1 |
application | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
isRegistered | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
3 | |||
register | n/a |
0 / 0 |
n/a |
0 / 0 |
0 |
1 | <?php |
2 | /** |
3 | * Pop PHP Framework (https://www.popphp.org/) |
4 | * |
5 | * @link https://github.com/popphp/popphp-framework |
6 | * @author Nick Sagona, III <dev@noladev.com> |
7 | * @copyright Copyright (c) 2009-2025 NOLA Interactive, LLC. |
8 | * @license https://www.popphp.org/license New BSD License |
9 | */ |
10 | |
11 | /** |
12 | * @namespace |
13 | */ |
14 | namespace Pop\Module; |
15 | |
16 | use Pop\Application; |
17 | use Pop\AbstractApplication; |
18 | |
19 | /** |
20 | * Abstract module class |
21 | * |
22 | * @category Pop |
23 | * @package Pop |
24 | * @author Nick Sagona, III <dev@noladev.com> |
25 | * @copyright Copyright (c) 2009-2025 NOLA Interactive, LLC. |
26 | * @license https://www.popphp.org/license New BSD License |
27 | * @version 4.3.5 |
28 | */ |
29 | abstract class AbstractModule extends AbstractApplication implements ModuleInterface |
30 | { |
31 | |
32 | /** |
33 | * Application |
34 | * @var ?Application |
35 | */ |
36 | protected ?Application $application = null; |
37 | |
38 | /** |
39 | * Get application |
40 | * |
41 | * @return Application |
42 | */ |
43 | public function application(): Application |
44 | { |
45 | return $this->application; |
46 | } |
47 | |
48 | /** |
49 | * Determine if the module has been registered with an application object |
50 | * |
51 | * @return bool |
52 | */ |
53 | public function isRegistered(): bool |
54 | { |
55 | return (($this->application !== null) && |
56 | ($this->application->modules() !== null) && ($this->application->modules()->hasModule($this))); |
57 | } |
58 | |
59 | /** |
60 | * Register module |
61 | * |
62 | * @param Application $application |
63 | * @return AbstractModule |
64 | */ |
65 | abstract public function register(Application $application): AbstractModule; |
66 | |
67 | } |