1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Imanghafoori\HeyMan; |
4
|
|
|
|
5
|
|
|
use Imanghafoori\HeyMan\Switching\Turn; |
6
|
|
|
use Imanghafoori\HeyMan\Core\Situations; |
7
|
|
|
use Imanghafoori\HeyMan\Conditions\ConditionsFacade; |
8
|
|
|
|
9
|
|
|
class HeyMan |
10
|
|
|
{ |
11
|
|
|
use Turn; |
12
|
|
|
|
13
|
14 |
|
public function forget(): Forget |
14
|
|
|
{ |
15
|
14 |
|
return new Forget(); |
16
|
|
|
} |
17
|
|
|
|
18
|
111 |
|
public function __call($method, $args) |
19
|
|
|
{ |
20
|
111 |
|
resolve('heyman.chain')->startChain(); |
|
|
|
|
21
|
|
|
|
22
|
111 |
|
$this->writeDebugInfo(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2)[1]); |
23
|
|
|
|
24
|
111 |
|
return Situations::call($method, $args); |
25
|
|
|
} |
26
|
|
|
|
27
|
2 |
|
public function checkPoint(string $pointName) |
28
|
|
|
{ |
29
|
2 |
|
event('heyman_checkpoint_'.$pointName); |
30
|
1 |
|
} |
31
|
|
|
|
32
|
2 |
|
public function aliasCondition(string $currentName, string $newName) |
33
|
|
|
{ |
34
|
2 |
|
resolve(ConditionsFacade::class)->alias($currentName, $newName); |
35
|
2 |
|
} |
36
|
|
|
|
37
|
2 |
|
public function aliasSituation(string $currentName, string $newName) |
38
|
|
|
{ |
39
|
2 |
|
Situations::aliasMethod($currentName, $newName); |
40
|
2 |
|
} |
41
|
|
|
|
42
|
1 |
|
public function defineCondition(string $name, $callable) |
43
|
|
|
{ |
44
|
1 |
|
resolve(ConditionsFacade::class)->define($name, $callable); |
45
|
1 |
|
} |
46
|
|
|
|
47
|
1 |
|
public function condition(string $name, $callable) |
48
|
|
|
{ |
49
|
1 |
|
$this->defineCondition($name, $callable); |
50
|
1 |
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param $debugTrace |
54
|
|
|
*/ |
55
|
111 |
|
private function writeDebugInfo($debugTrace) |
56
|
|
|
{ |
57
|
111 |
|
if (config('app.debug') && ! app()->environment('production')) { |
|
|
|
|
58
|
|
|
$info = array_only($debugTrace, ['file', 'line', 'args']); |
59
|
|
|
resolve('heyman.chain')->set('debugInfo', $info); |
|
|
|
|
60
|
|
|
} |
61
|
111 |
|
} |
62
|
|
|
} |
63
|
|
|
|
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.