1 | <?php |
||
16 | class SenderManager implements SenderManagerContract |
||
17 | { |
||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $senders = []; |
||
22 | |||
23 | /** |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $callbacks = []; |
||
27 | |||
28 | /** |
||
29 | * @param array $notifications |
||
30 | * @return bool |
||
31 | */ |
||
32 | public function send(array $notifications) |
||
40 | |||
41 | /** |
||
42 | * @param string $name |
||
43 | * @return bool |
||
44 | */ |
||
45 | public function hasSender($name) |
||
49 | |||
50 | /** |
||
51 | * @param string $name |
||
52 | * @return Closure |
||
53 | */ |
||
54 | public function getSender($name) |
||
58 | |||
59 | /** |
||
60 | * @param string $name |
||
61 | * @param Closure $sender |
||
62 | * @return bool |
||
63 | */ |
||
64 | public function extend($name, Closure $sender) |
||
74 | |||
75 | /** |
||
76 | * @param string $class |
||
77 | * @param callable $callback |
||
78 | * @return bool |
||
79 | */ |
||
80 | public function setCallback($class, callable $callback) |
||
90 | |||
91 | /** |
||
92 | * @param string $class |
||
93 | * @return callable|null |
||
94 | */ |
||
95 | public function getCallback($class) |
||
99 | |||
100 | /** |
||
101 | * @param string $name |
||
102 | * @param array $notifications |
||
103 | * @return bool |
||
104 | * @throws BadFunctionCallException |
||
105 | * @throws BadMethodCallException |
||
106 | */ |
||
107 | public function sendWithCustomSender($name, array $notifications) |
||
118 | |||
119 | /** |
||
120 | * @param string $name |
||
121 | * @param array $arguments |
||
122 | * @return bool |
||
123 | * @throws BadMethodCallException |
||
124 | */ |
||
125 | public function __call($name, array $arguments) |
||
133 | } |
||
134 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: