1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Imanghafoori\HeyMan; |
4
|
|
|
|
5
|
|
|
use Imanghafoori\HeyMan\Normilizers\{InputNormalizer, RouteNormalizer}; |
6
|
|
|
use Imanghafoori\HeyMan\WatchingStrategies\{EloquentEventsManager, EventManager, RouterEventManager, ViewEventManager}; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class Forget |
10
|
|
|
* |
11
|
|
|
* @method aboutRoute(array|string $routeName) |
12
|
|
|
* @method aboutAction(array|string $action) |
13
|
|
|
* @method aboutUrl(array|string $url) |
14
|
|
|
* @method aboutModel(array|string $model) |
15
|
|
|
* @method aboutDeleting(array|string $model) |
16
|
|
|
* @method aboutSaving(array|string $model) |
17
|
|
|
* @method aboutCreating(array|string $model) |
18
|
|
|
* @method aboutUpdating(array|string $model) |
19
|
14 |
|
* @method aboutFetching(array|string $model) |
20
|
|
|
* |
21
|
14 |
|
*/ |
22
|
|
|
class Forget |
23
|
4 |
|
{ |
24
|
|
|
use InputNormalizer; |
25
|
4 |
|
|
26
|
4 |
|
public function aboutView(...$view) |
27
|
|
|
{ |
28
|
1 |
|
resolve(ViewEventManager::class)->forgetAbout($view); |
29
|
|
|
} |
30
|
1 |
|
|
31
|
1 |
|
public function aboutEvent(...$events) |
32
|
|
|
{ |
33
|
2 |
|
resolve(EventManager::class)->forgetAbout($events); |
34
|
|
|
} |
35
|
2 |
|
|
36
|
2 |
|
public function __call($method, $args) |
37
|
|
|
{ |
38
|
1 |
|
$args = $this->normalizeInput($args); |
39
|
|
|
|
40
|
1 |
|
$method = ltrim($method, 'about'); |
41
|
1 |
|
|
42
|
|
|
if (in_array($method, ['Route', 'Action', 'Url'])) { |
43
|
|
|
$args = resolve(RouteNormalizer::class)->{'normalize'.$method}($args); |
44
|
|
|
return resolve(RouterEventManager::class)->forgetAbout($args); |
|
|
|
|
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
$method = str_replace('Fetching', 'retrieved', $method); |
48
|
|
|
$method = strtolower($method); |
49
|
|
|
$method = $method == 'model' ? null : $method; |
50
|
|
|
resolve(EloquentEventsManager::class)->forgetAbout($args, $method); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.