1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Imanghafoori\HeyMan; |
4
|
|
|
|
5
|
|
|
use Imanghafoori\HeyMan\Normilizers\InputNormalizer; |
6
|
|
|
use Imanghafoori\HeyMan\WatchingStrategies\Events\EventListeners; |
7
|
|
|
use Imanghafoori\HeyMan\WatchingStrategies\Routes\RouteNormalizer; |
8
|
|
|
use Imanghafoori\HeyMan\WatchingStrategies\Views\ViewEventListener; |
9
|
|
|
use Imanghafoori\HeyMan\WatchingStrategies\Routes\RouteEventListener; |
10
|
|
|
use Imanghafoori\HeyMan\WatchingStrategies\EloquentModels\EloquentEventsListener; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class Forget. |
14
|
|
|
* |
15
|
|
|
* @method aboutRoute(array|string $routeName) |
16
|
|
|
* @method aboutAction(array|string $action) |
17
|
|
|
* @method aboutUrl(array|string $url) |
18
|
|
|
* @method aboutModel(array|string $model) |
19
|
|
|
* @method aboutDeleting(array|string $model) |
20
|
|
|
* @method aboutSaving(array|string $model) |
21
|
|
|
* @method aboutCreating(array|string $model) |
22
|
|
|
* @method aboutUpdating(array|string $model) |
23
|
|
|
* @method aboutFetching(array|string $model) |
24
|
|
|
*/ |
25
|
|
|
final class Forget |
26
|
|
|
{ |
27
|
|
|
use InputNormalizer; |
28
|
|
|
|
29
|
14 |
|
public function __call($method, $args) |
30
|
|
|
{ |
31
|
14 |
|
$args = $this->normalizeInput($args); |
32
|
|
|
|
33
|
14 |
|
if (in_array($method, ['aboutRoute', 'aboutAction', 'aboutUrl'])) { |
34
|
|
|
|
35
|
3 |
|
$args = resolve(RouteNormalizer::class)->{'normalize'.ltrim($method, 'about')}($args); |
36
|
|
|
|
37
|
3 |
|
return resolve('heyman.chains')->forgetAbout(RouteEventListener::class, $args); |
|
|
|
|
38
|
|
|
} |
39
|
|
|
|
40
|
11 |
|
if (in_array($method, ['aboutEvent'])) { |
41
|
2 |
|
resolve('heyman.chains')->forgetAbout(EventListeners::class, $args); |
42
|
|
|
} |
43
|
|
|
|
44
|
11 |
|
if (in_array($method, ['aboutView'])) { |
45
|
4 |
|
resolve('heyman.chains')->forgetAbout(ViewEventListener::class, $args); |
46
|
|
|
} |
47
|
|
|
|
48
|
11 |
|
if (in_array($method, ['aboutFetching', 'aboutSaving', 'aboutModel','aboutDeleting', 'aboutCreating', 'aboutUpdating'])) { |
49
|
5 |
|
$method = ltrim($method, 'about'); |
50
|
5 |
|
$method = str_replace('Fetching', 'retrieved', $method); |
51
|
5 |
|
$method = strtolower($method); |
52
|
5 |
|
$method = $method == 'model' ? null : $method; |
53
|
5 |
|
resolve('heyman.chains')->forgetAbout(EloquentEventsListener::class, $args, $method); |
54
|
|
|
} |
55
|
11 |
|
} |
56
|
|
|
} |
57
|
|
|
|
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.