Completed
Push — master ( 9792a6...aaaf86 )
by recca
10:22
created

SessionPanel::getAttributes()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
nc 4
nop 0
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
ccs 11
cts 11
cp 1
crap 3
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 1
    protected function getAttributes()
15
    {
16 1
        $rows = [];
17 1
        if ($this->hasLaravel() === true) {
18 1
            $session = $this->laravel['session'];
19
            $rows = [
20 1
                'sessionId' => $session->getId(),
21 1
                'sessionConfig' => $session->getSessionConfig(),
22 1
                'laravelSession' => $session->all(),
23
            ];
24
        }
25
26 1
        if (session_status() === PHP_SESSION_ACTIVE) {
27 1
            $rows['nativeSessionId'] = session_id();
28 1
            $rows['nativeSession'] = $_SESSION;
29
        }
30
31 1
        return compact('rows');
32
    }
33
}
34