1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Imanghafoori\HeyMan; |
4
|
|
|
|
5
|
|
|
use Imanghafoori\HeyMan\Reactions\ReactionFactory; |
6
|
|
|
|
7
|
|
|
class Chain |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @var \Imanghafoori\HeyMan\ListenerApplier |
|
|
|
|
11
|
|
|
*/ |
12
|
|
|
public $eventManager; |
13
|
|
|
|
14
|
|
|
public $debugInfo; |
15
|
|
|
|
16
|
|
|
public $condition; |
17
|
|
|
|
18
|
|
|
public $responseType = 'nothing'; |
19
|
|
|
|
20
|
|
|
public $data = []; |
21
|
|
|
|
22
|
|
|
private $beforeReaction = []; |
23
|
|
|
|
24
|
|
|
private $termination; |
25
|
|
|
|
26
|
2 |
|
public function addCallbackBeforeReaction($callback, $parameters) |
27
|
2 |
|
{ |
28
|
1 |
|
$this->beforeReaction[] = function () use ($callback, $parameters) { |
29
|
2 |
|
app()->call($callback, $parameters); |
30
|
|
|
}; |
31
|
|
|
} |
32
|
|
|
|
33
|
1 |
|
public function addEventBeforeReaction($event, array $payload, bool $halt) |
34
|
1 |
|
{ |
35
|
1 |
|
$this->beforeReaction[] = function () use ($event, $payload, $halt) { |
36
|
1 |
|
resolve('events')->dispatch($event, $payload, $halt); |
37
|
|
|
}; |
38
|
96 |
|
} |
39
|
|
|
|
40
|
96 |
|
public function addTerminationCallback($callback) |
41
|
96 |
|
{ |
42
|
96 |
|
$this->termination = $callback; |
43
|
|
|
} |
44
|
96 |
|
|
45
|
|
|
public function submitChainConfig() |
46
|
96 |
|
{ |
47
|
96 |
|
$callbackListener = resolve(ReactionFactory::class)->make(); |
48
|
|
|
$this->eventManager->commitChain($callbackListener); |
49
|
96 |
|
} |
50
|
56 |
|
|
51
|
3 |
|
public function beforeReaction(): \Closure |
52
|
|
|
{ |
53
|
96 |
|
$tasks = $this->beforeReaction; |
54
|
|
|
$this->beforeReaction = []; |
55
|
|
|
|
56
|
90 |
|
return function () use ($tasks) { |
57
|
|
|
foreach ($tasks as $task) { |
58
|
90 |
|
$task(); |
59
|
90 |
|
} |
60
|
90 |
|
}; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function commitCalledMethod($args, $methodName) |
64
|
|
|
{ |
65
|
105 |
|
$this->data[] = $args; |
66
|
|
|
$this->responseType = $methodName; |
67
|
105 |
|
} |
68
|
105 |
|
|
69
|
|
|
/** |
70
|
|
|
* @param $d |
71
|
|
|
*/ |
72
|
|
|
public function writeDebugInfo($d) |
73
|
|
|
{ |
74
|
|
|
$this->debugInfo = array_only($d[1], ['file', 'line', 'args']); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function getTermination() |
78
|
|
|
{ |
79
|
|
|
$r = $this->termination; |
80
|
|
|
$this->termination = null; |
81
|
|
|
|
82
|
|
|
return $r; |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|
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