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 $predicate; |
15
|
|
|
|
16
|
|
|
public $responseType = 'nothing'; |
17
|
|
|
|
18
|
|
|
public $data = []; |
19
|
|
|
|
20
|
|
|
private $beforeResponse = []; |
21
|
|
|
|
22
|
|
|
public function addRedirect($method, $params) |
23
|
|
|
{ |
24
|
93 |
|
$this->data[] = [$method, $params]; |
25
|
|
|
$this->responseType = 'redirect'; |
26
|
93 |
|
} |
27
|
93 |
|
|
28
|
93 |
|
public function addResponse($method, $params) |
29
|
93 |
|
{ |
30
|
93 |
|
$this->data[] = [$method, $params]; |
31
|
|
|
$this->responseType = 'response'; |
32
|
4 |
|
} |
33
|
|
|
|
34
|
4 |
|
public function addException(string $className, string $message) |
35
|
4 |
|
{ |
36
|
4 |
|
$this->data[] = ['class' => $className, 'message' => $message]; |
37
|
|
|
$this->responseType = 'exception'; |
38
|
2 |
|
} |
39
|
|
|
|
40
|
2 |
|
public function addAbort($code, string $message, array $headers) |
41
|
2 |
|
{ |
42
|
2 |
|
$this->data[] = [$code, $message, $headers]; |
43
|
|
|
$this->responseType = 'abort'; |
44
|
81 |
|
} |
45
|
|
|
|
46
|
81 |
|
public function addAfterCall($callback, $parameters) |
47
|
81 |
|
{ |
48
|
81 |
|
$this->beforeResponse[] = function () use ($callback, $parameters) { |
49
|
|
|
app()->call($callback, $parameters); |
50
|
2 |
|
}; |
51
|
|
|
} |
52
|
2 |
|
|
53
|
2 |
|
public function eventFire($event, array $payload, bool $halt) |
54
|
2 |
|
{ |
55
|
|
|
$this->beforeResponse[] = function () use ($event, $payload, $halt) { |
56
|
2 |
|
app('events')->dispatch($event, $payload, $halt); |
57
|
|
|
}; |
58
|
|
|
} |
59
|
2 |
|
|
60
|
1 |
|
public function addRespondFrom($callback, array $parameters) |
61
|
2 |
|
{ |
62
|
|
|
$this->data[] = [$callback, $parameters]; |
63
|
1 |
|
$this->responseType = 'respondFrom'; |
64
|
|
|
} |
65
|
|
|
|
66
|
1 |
|
public function submitChainConfig() |
67
|
1 |
|
{ |
68
|
1 |
|
$callbackListener = app(ReactionFactory::class)->make(); |
69
|
|
|
$this->eventManager->commitChain($callbackListener); |
70
|
1 |
|
} |
71
|
|
|
|
72
|
1 |
|
public function beforeResponse(): \Closure |
73
|
1 |
|
{ |
74
|
1 |
|
$calls = $this->beforeResponse; |
75
|
|
|
$this->beforeResponse = []; |
76
|
93 |
|
return function () use ($calls) { |
77
|
|
|
foreach ($calls as $call) { |
78
|
93 |
|
$call(); |
79
|
93 |
|
} |
80
|
93 |
|
}; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
} |
84
|
|
|
|
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