Issues (2884)

src/App/Config/ConfigEventManager.php (2 issues)

Checks function comment missing param tag

Coding Style Informational
1
<?php
2
3
namespace Jaxon\App\Config;
4
5
/**
6
 * ConfigEventManager.php
7
 *
8
 * Call listeners on config changes.
9
 *
10
 * @package jaxon-core
11
 * @author Thierry Feuzeu <[email protected]>
12
 * @copyright 2022 Thierry Feuzeu <[email protected]>
13
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
14
 * @link https://github.com/jaxon-php/jaxon-core
15
 */
16
17
use Jaxon\Di\Container;
18
use Jaxon\Utils\Config\Config;
19
20
class ConfigEventManager implements ConfigListenerInterface
21
{
22
    /**
23
     * @var Container
24
     */
25
    protected $di;
26
27
    /**
28
     * @var string[]
29
     */
30
    protected $aListeners = [];
31
32
    /**
33
     * The constructor
34
     *
35
     * @param Container $di
36
     */
37
    public function __construct(Container $di)
38
    {
39
        $this->di = $di;
40
    }
41
42
    /**
43
     * Add a listener
44
     *
45
     * @param string $sClassName
46
     *
47
     * @return void
48
     */
49
    public function addListener(string $sClassName)
50
    {
51
        $this->aListeners[] = $sClassName;
52
    }
53
54
    /**
0 ignored issues
show
Parameter $xConfig should have a doc-comment as per coding-style.
Loading history...
Parameter $sName should have a doc-comment as per coding-style.
Loading history...
55
     * @inheritDoc
56
     */
57
    public function onChange(Config $xConfig, string $sName)
58
    {
59
        foreach($this->aListeners as $sListener)
60
        {
61
            $this->di->g($sListener)->onChange($xConfig, $sName);
62
        }
63
    }
64
}
65