ErrorListener::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
c 1
b 1
f 0
cc 1
eloc 5
nc 1
nop 1
crap 1
1
<?php
2
3
namespace plunner\Listeners\Caldav;
4
5
use plunner\Events\Caldav\ErrorEvent;
6
7
class ErrorListener
8
{
9
    //TODO improvement -> perform this into a queue
10
11
    /**
12
     * Create the event listener.
13
     *
14
     */
15 6
    public function __construct()
16
    {
17
        //
18 6
    }
19
20
    /**
21
     * Handle the event.
22
     *
23
     * @param  ErrorEvent $event
24
     * @return void
25
     */
26 6
    public function handle(ErrorEvent $event)
27
    {
28
        //
29 6
        \Log::info('problems during caldav (calendar id = ' . $event->getCalendar()->calendar_id . ') sync: ' . $event->getError());
30 6
        $calendar = $event->getCalendar();
31
        //$calendar = $event->getCalendar()->fresh();
32 6
        $calendar->sync_errors = $event->getError();
33 6
        $calendar->save();
34 6
    }
35
}
36