ErrorListener   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 29
ccs 8
cts 8
cp 1
rs 10
c 2
b 1
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 9 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