SessionPanel::getAttributes()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
nc 4
nop 0
dl 0
loc 19
ccs 0
cts 11
cp 0
crap 12
rs 9.6333
c 0
b 0
f 0
1
<?php
2
3
namespace Recca0120\LaravelTracy\Panels;
4
5
use Recca0120\LaravelTracy\Contracts\IAjaxPanel;
6
7
class SessionPanel extends AbstractPanel implements IAjaxPanel
8
{
9
    /**
10
     * getAttributes.
11
     *
12
     * @return array
13
     */
14
    protected function getAttributes()
15
    {
16
        $rows = [];
17
        if ($this->hasLaravel() === true) {
18
            $session = $this->laravel['session'];
19
            $rows = [
20
                'sessionId' => $session->getId(),
21
                'sessionConfig' => $session->getSessionConfig(),
22
                'laravelSession' => $session->all(),
23
            ];
24
        }
25
26
        if (session_status() === PHP_SESSION_ACTIVE) {
27
            $rows['nativeSessionId'] = session_id();
28
            $rows['nativeSession'] = $_SESSION;
29
        }
30
31
        return compact('rows');
32
    }
33
}
34