1 | <?php |
||
7 | class ErrorListener |
||
8 | { |
||
9 | /** |
||
10 | * Create the event listener. |
||
11 | * |
||
12 | * @return void |
||
|
|||
13 | */ |
||
14 | public function __construct() |
||
15 | { |
||
16 | // |
||
17 | } |
||
18 | |||
19 | /** |
||
20 | * Handle the event. |
||
21 | * |
||
22 | * @param ErrorEvent $event |
||
23 | * @return void |
||
24 | */ |
||
25 | public function handle(ErrorEvent $event) |
||
26 | { |
||
27 | // |
||
28 | \Log::error('problems during optimise (company id = ' . $event->getCompany()->id . '): ' . $event->getError()); |
||
29 | $company = $event->getCompany(); |
||
30 | //$company = $event->getCompany()->fresh(); |
||
31 | self::sendEmail($company->email, $event->getError()); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param string $email |
||
36 | * @param string $error |
||
37 | */ |
||
38 | static private function sendEmail($email, $error) |
||
45 | } |
||
46 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.