ConfigFile   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A onUpdate() 0 16 6
1
<?php
2
namespace PHPDaemon\Config\Entry;
3
4
use PHPDaemon\Core\Daemon;
5
use PHPDaemon\Thread\Master;
6
7
/**
8
 * ConfigFile config entry
9
 *
10
 * @package    Core
11
 * @subpackage Config
12
 *
13
 * @author     Vasily Zorin <[email protected]>
14
 */
15
class ConfigFile extends Generic
16
{
17
18
    /**
19
     * Called when entry is updated
20
     * @param $old
21
     * @return void
22
     */
23
    public function onUpdate($old)
24
    {
25
        if (!Daemon::$process instanceof Master || (Daemon::$config->autoreload->value === 0) || !$old) {
26
            return;
27
        }
28
29
        $e = explode(';', $old);
30
        foreach ($e as $path) {
31
            Daemon::$process->fileWatcher->rmWatch($path, [Daemon::$process, 'sighup']);
0 ignored issues
show
Bug introduced by
The property fileWatcher does not seem to exist in PHPDaemon\Thread\Master.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
32
        }
33
34
        $e = explode(';', $this->value);
35
        foreach ($e as $path) {
36
            Daemon::$process->fileWatcher->addWatch($path, [Daemon::$process, 'sighup']);
37
        }
38
    }
39
}
40