1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Imanghafoori\HeyMan\WatchingStrategies; |
4
|
|
|
|
5
|
|
|
use Imanghafoori\HeyMan\Normilizers\InputNormalizer; |
6
|
|
|
use Imanghafoori\HeyMan\Reactions\ReactionFactory; |
7
|
|
|
use Imanghafoori\HeyMan\Switching\HeyManSwitcher; |
8
|
|
|
|
9
|
|
|
class BaseManager |
10
|
|
|
{ |
11
|
|
|
use InputNormalizer; |
12
|
|
|
|
13
|
|
|
protected $watchedEntities = []; |
14
|
|
|
|
15
|
|
|
protected $event; |
16
|
|
|
|
17
|
|
|
public $manager; |
18
|
|
|
|
19
|
|
|
public $data = []; |
20
|
|
|
|
21
|
123 |
|
public function start() |
22
|
|
|
{ |
23
|
123 |
|
foreach ($this->data as $manager => $f) { |
24
|
43 |
|
if ($manager == RouterEventManager::class) { |
|
|
|
|
25
|
|
|
continue; |
26
|
|
|
} |
27
|
43 |
|
foreach ($f as $value => $callbacks) { |
28
|
39 |
|
foreach ($callbacks as $key => $cb) { |
29
|
43 |
|
resolve($manager)->register($value, $cb, $key); |
30
|
|
|
} |
31
|
|
|
} |
32
|
|
|
} |
33
|
123 |
|
} |
34
|
|
|
|
35
|
14 |
|
public function forgetAbout($manager, $models, $event = null) |
36
|
|
|
{ |
37
|
14 |
|
$models = $this->normalizeInput($models); |
38
|
|
|
|
39
|
14 |
|
foreach ($models as $model) { |
40
|
14 |
|
if ($event) { |
41
|
4 |
|
unset($this->data[$manager][$model][$event]); |
42
|
|
|
} else { |
43
|
14 |
|
unset($this->data[$manager][$model]); |
44
|
|
|
} |
45
|
|
|
} |
46
|
14 |
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* ViewEventManager constructor. |
50
|
|
|
* |
51
|
|
|
* @param $manager |
52
|
|
|
* @param array $values |
53
|
|
|
* @param string $param |
54
|
|
|
* |
55
|
|
|
* @return self |
56
|
|
|
*/ |
57
|
104 |
|
public function init($manager, array $values, string $param = 'default'): self |
58
|
|
|
{ |
59
|
104 |
|
$this->manager = $manager; |
60
|
104 |
|
$this->watchedEntities = $values; |
61
|
104 |
|
$this->event = $param; |
62
|
|
|
|
63
|
104 |
|
return $this; |
64
|
|
|
} |
65
|
|
|
|
66
|
96 |
|
public function commitChain() |
67
|
|
|
{ |
68
|
96 |
|
$callback = resolve(ReactionFactory::class)->make(); |
69
|
96 |
|
$switchableListener = resolve(HeyManSwitcher::class)->wrapForIgnorance($callback, $this->manager); |
70
|
|
|
|
71
|
96 |
|
foreach ($this->watchedEntities as $value) { |
72
|
96 |
|
$this->data[$this->manager][$value][$this->event][] = $switchableListener; |
73
|
|
|
} |
74
|
96 |
|
} |
75
|
|
|
} |
76
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths