ResetSession::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 9
rs 10
1
<?php
2
3
namespace SwooleTW\Http\Server\Resetters;
4
5
use Illuminate\Contracts\Container\Container;
6
use SwooleTW\Http\Server\Sandbox;
7
8
class ResetSession implements ResetterContract
9
{
10
    /**
11
     * "handle" function for resetting app.
12
     *
13
     * @param \Illuminate\Contracts\Container\Container $app
14
     * @param \SwooleTW\Http\Server\Sandbox $sandbox
15
     *
16
     * @return \Illuminate\Contracts\Container\Container
17
     */
18
    public function handle(Container $app, Sandbox $sandbox)
19
    {
20
        if (isset($app['session'])) {
21
            $session = $app->make('session');
22
            $session->flush();
23
            $session->regenerate();
24
        }
25
26
        return $app;
27
    }
28
}
29