SessionCleaner::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
c 0
b 0
f 0
nc 2
nop 2
dl 0
loc 10
rs 10
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace Hhxsv5\LaravelS\Illuminate\Cleaners;
4
5
6
use Illuminate\Container\Container;
0 ignored issues
show
Bug introduced by
The type Illuminate\Container\Container was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Illuminate\Routing\Redirector;
0 ignored issues
show
Bug introduced by
The type Illuminate\Routing\Redirector was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Illuminate\Support\Facades\Facade;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\Facades\Facade was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
class SessionCleaner extends BaseCleaner
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class SessionCleaner
Loading history...
11
{
12
    private $drivers;
0 ignored issues
show
Coding Style introduced by
Private member variable "drivers" must be prefixed with an underscore
Loading history...
13
14
    public function __construct(Container $currentApp, Container $snapshotApp)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
15
    {
16
        parent::__construct($currentApp, $snapshotApp);
17
18
        if (!isset($this->currentApp['session'])) {
19
            return;
20
        }
21
        $ref = new \ReflectionObject($this->currentApp['session']);
22
        $this->drivers = $ref->getProperty('drivers');
23
        $this->drivers->setAccessible(true);
24
25
    }
26
27
    public function clean()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function clean()
Loading history...
28
    {
29
        if (!isset($this->currentApp['session'])) {
30
            return;
31
        }
32
33
        $this->drivers->setValue($this->currentApp['session'], []);
34
        $this->currentApp->forgetInstance('session.store');
35
        Facade::clearResolvedInstance('session.store');
36
37
        if (isset($this->currentApp['redirect'])) {
38
            /**@var Redirector $redirect */
0 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
39
            $redirect = $this->currentApp['redirect'];
40
            $redirect->setSession($this->currentApp->make('session.store'));
41
        }
42
    }
43
}