Completed
Push — dev ( 4e6f9a...6e9c7d )
by Yan
04:26 queued 02:24
created

UploadSubscriber::onSuccess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 2
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
     * @return void
11
     */
12
    public function onSuccess($model)
0 ignored issues
show
Unused Code introduced by
The parameter $model 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

12
    public function onSuccess(/** @scrutinizer ignore-unused */ $model)

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