UploadSubscriber::onFailure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Lincable\Eloquent\Subscribers;
4
5
class UploadSubscriber
6
{
7
    /**
8
     * Listen when the upload has been executed with success.
9
     *
10
     * @param  mixed $event
11
     * @return void
12
     */
13 15
    public function onSuccess($event)
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

13
    public function onSuccess(/** @scrutinizer ignore-unused */ $event)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
14
    {
15
        //
16 15
    }
17
18
    /**
19
     * Listen when the upload has failed.
20
     *
21
     * @param  mixed $event
22
     * @return void
23
     */
24 1
    public function onFailure($event)
25
    {
26
        // Delete the model from database once the file could not be stored.
27 1
        $event->model->delete();
28 1
    }
29
30
    /**
31
     * Register the listeners for the subscriber.
32
     *
33
     * @param  \Illuminate\Events\Dispatcher  $events
34
     * @return void
35
     */
36 93
    public function subscribe($events)
37
    {
38 93
        $events->listen(
39 93
            'Lincable\Eloquent\Events\UploadSuccess',
40 93
            'Lincable\Eloquent\Subscribers\UploadSubscriber@onSuccess'
41
        );
42
43 93
        $events->listen(
44 93
            'Lincable\Eloquent\Events\UploadFailure',
45 93
            'Lincable\Eloquent\Subscribers\UploadSubscriber@onFailure'
46
        );
47 93
    }
48
}
49