Passed
Push — master ( 617e52...ff4e9f )
by Arthur
35:51
created

PublishInitialScriptRelease::failed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 2
dl 0
loc 2
ccs 0
cts 1
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Modules\Script\Listeners;
4
5
use Modules\Script\Contracts\ScriptServiceContract;
6
use Modules\Script\Entities\ScriptRelease;
7
use Modules\Script\Events\ScriptWasCreatedEvent;
8
use Foundation\Abstracts\Listeners\Listener;
9
use Modules\Script\Support\Version;
10
11
class PublishInitialScriptRelease extends Listener
12
{
13
    protected $service;
14
15
    /**
16
     * Create the event listener.
17
     *
18
     * @return void
19
     */
20 7
    public function __construct(ScriptServiceContract $service)
21
    {
22 7
        $this->service = $service;
23 7
    }
24
25
    /**
26
     * Handle the event.
27
     *
28
     * @param  ScriptWasCreatedEvent $event
29
     * @return void
30
     */
31 7
    public function handle(ScriptWasCreatedEvent $event): void
32
    {
33 7
        $this->service->releaseVersion($event->script,[
34 7
            ScriptRelease::TYPE => "MINOR",
35
            ScriptRelease::CHANGELOG => "Initial script release"
36
        ]);
37 7
    }
38
39
40
    /**
41
     * Handle the event.
42
     *
43
     * @param  ScriptWasCreatedEvent $event
44
     * @param  \Exception $exception
45
     * @return void
46
     */
47
    public function failed(ScriptWasCreatedEvent $event, $exception): void
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

47
    public function failed(/** @scrutinizer ignore-unused */ ScriptWasCreatedEvent $event, $exception): void

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...
Unused Code introduced by
The parameter $exception 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

47
    public function failed(ScriptWasCreatedEvent $event, /** @scrutinizer ignore-unused */ $exception): void

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...
48
    {
49
        //
50
    }
51
52
}
53