Completed
Push — master ( 16b7cb...b112db )
by Vladimir
07:44
created

TerminateKernel::handle()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 21
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
eloc 5
nc 4
nop 1
dl 0
loc 21
ccs 0
cts 6
cp 0
crap 12
rs 9.3142
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Foundation\Commands;
6
7
use FondBot\Foundation\Kernel;
8
use Illuminate\Foundation\Bus\Dispatchable;
9
10
class TerminateKernel
11
{
12
    use Dispatchable;
13
14
    public function handle(Kernel $kernel): void
15
    {
16
        // TODO
17
18
        // Close session if conversation has not been transitioned
19
        // Otherwise, save session state
0 ignored issues
show
Unused Code Comprehensibility introduced by
48% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
20
//        if (!$this->transitioned) {
21
//            kernel()->closeSession();
22
//            kernel()->clearContext();
23
//        }
24
25
        // Save session if exists
26
        if ($session = $kernel->getSession()) {
27
            SaveSession::dispatch($session);
28
        }
29
30
        // Save context if exists
31
        if ($context = $kernel->getContext()) {
32
            SaveContext::dispatch($context);
33
        }
34
    }
35
}
36