1 | <?php |
||
14 | class OnceSender implements SenderContract |
||
15 | { |
||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $notifications; |
||
20 | |||
21 | /** |
||
22 | * OnceSender constructor. |
||
23 | * |
||
24 | * @param array $notifications |
||
25 | */ |
||
26 | public function __construct(array $notifications) |
||
30 | |||
31 | /** |
||
32 | * Send the notification once. |
||
33 | * |
||
34 | * @param SenderManagerContract $sender |
||
35 | * @return bool |
||
36 | */ |
||
37 | public function send(SenderManagerContract $sender) |
||
38 | { |
||
39 | $success = true; |
||
40 | foreach ($this->notifications as $notification) { |
||
41 | $query = $this->getQuery($notification); |
||
42 | if (! $query->exists()) { |
||
|
|||
43 | $success = $sender->send([$notification]) ? $success : false; |
||
44 | continue; |
||
45 | } |
||
46 | $success = $query->firstOrFail()->resend() ? $success : false; |
||
47 | } |
||
48 | |||
49 | return $success; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Get the base query. |
||
54 | * |
||
55 | * @param Notification $notification |
||
56 | * @return \Illuminate\Database\Eloquent\Builder |
||
57 | */ |
||
58 | protected function getQuery(Notification $notification) |
||
77 | |||
78 | /** |
||
79 | * @return \Illuminate\Database\Eloquent\Builder |
||
80 | */ |
||
81 | protected function getQueryInstance() |
||
91 | } |
||
92 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.