Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
AbstractModule
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
4
100.00% covered (success)
100.00%
1 / 1
 application
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isRegistered
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
3
 register
n/a
0 / 0
n/a
0 / 0
0
1<?php
2/**
3 * Pop PHP Framework (http://www.popphp.org/)
4 *
5 * @link       https://github.com/popphp/popphp-framework
6 * @author     Nick Sagona, III <dev@nolainteractive.com>
7 * @copyright  Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)
8 * @license    http://www.popphp.org/license     New BSD License
9 */
10
11/**
12 * @namespace
13 */
14namespace Pop\Module;
15
16use Pop\Application;
17use Pop\AbstractApplication;
18
19/**
20 * Abstract module class
21 *
22 * @category   Pop
23 * @package    Pop
24 * @author     Nick Sagona, III <dev@nolainteractive.com>
25 * @copyright  Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)
26 * @license    http://www.popphp.org/license     New BSD License
27 * @version    4.2.0
28 */
29abstract 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}