|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Imanghafoori\HeyMan; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Support\Arr; |
|
6
|
|
|
use Imanghafoori\HeyMan\Core\ConditionsFacade; |
|
7
|
|
|
use Imanghafoori\HeyMan\Core\Forget; |
|
8
|
|
|
use Imanghafoori\HeyMan\Core\Reaction; |
|
9
|
|
|
use Imanghafoori\HeyMan\Core\Situations; |
|
10
|
|
|
use Imanghafoori\HeyMan\Switching\Turn; |
|
11
|
|
|
|
|
12
|
|
|
class HeyMan |
|
13
|
|
|
{ |
|
14
|
|
|
use Turn; |
|
15
|
|
|
|
|
16
|
14 |
|
public function forget() |
|
17
|
|
|
{ |
|
18
|
14 |
|
return new Forget(); |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
117 |
|
public function __call($method, $args) |
|
22
|
|
|
{ |
|
23
|
117 |
|
resolve('heyman.chain')->startChain(); |
|
|
|
|
|
|
24
|
|
|
|
|
25
|
117 |
|
$this->writeDebugInfo(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2)[1]); |
|
26
|
|
|
|
|
27
|
117 |
|
return Situations::call($method, $args); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
2 |
|
public function checkPoint(string $pointName) |
|
31
|
|
|
{ |
|
32
|
2 |
|
event('heyman_checkpoint_'.$pointName); |
|
33
|
1 |
|
} |
|
34
|
|
|
|
|
35
|
2 |
|
public function aliasCondition(string $currentName, string $newName) |
|
36
|
|
|
{ |
|
37
|
2 |
|
resolve(ConditionsFacade::class)->alias($currentName, $newName); |
|
38
|
2 |
|
} |
|
39
|
|
|
|
|
40
|
121 |
|
public function aliasSituation(string $currentName, string $newName) |
|
41
|
|
|
{ |
|
42
|
121 |
|
Situations::aliasMethod($currentName, $newName); |
|
43
|
121 |
|
} |
|
44
|
|
|
|
|
45
|
2 |
|
public function aliasReaction(string $currentName, string $newName) |
|
46
|
|
|
{ |
|
47
|
2 |
|
resolve(Reaction::class)->alias($currentName, $newName); |
|
48
|
2 |
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function defineReaction($methodName, $callable) |
|
51
|
|
|
{ |
|
52
|
|
|
resolve(Reaction::class)->define($methodName, $callable); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
1 |
|
public function defineCondition($methodName, $callable) |
|
56
|
|
|
{ |
|
57
|
1 |
|
resolve(ConditionsFacade::class)->define($methodName, $callable); |
|
58
|
1 |
|
} |
|
59
|
|
|
|
|
60
|
1 |
|
public function condition($methodName, $callable) |
|
61
|
|
|
{ |
|
62
|
1 |
|
$this->defineCondition($methodName, $callable); |
|
63
|
1 |
|
} |
|
64
|
|
|
|
|
65
|
117 |
|
private function writeDebugInfo($debugTrace) |
|
66
|
|
|
{ |
|
67
|
117 |
|
if (config('app.debug') && ! app()->environment('production')) { |
|
|
|
|
|
|
68
|
|
|
$info = Arr::only($debugTrace, ['file', 'line', 'args']); |
|
69
|
|
|
resolve('heyman.chain')->set('debugInfo', $info); |
|
|
|
|
|
|
70
|
|
|
} |
|
71
|
117 |
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.