SessionBackend::getBackend()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Filoucrackeur\StorageFrameworkManager\Domain\Model\Dto;
5
6
use Filoucrackeur\StorageFrameworkManager\Type\Backend\Type;
7
use TYPO3\CMS\Core\Session\Backend\SessionBackendInterface;
8
use TYPO3\CMS\Core\Session\SessionManager;
9
use TYPO3\CMS\Core\Utility\GeneralUtility;
10
11
class SessionBackend extends AbstractBackendInterface
12
{
13
    /**
14
     * @var SessionBackendInterface
15
     */
16
    protected $backend;
17
18
    /**
19
     * @return string
20
     */
21
    public function getType(): string
22
    {
23
        return Type::SESSION;
24
    }
25
26
    public function getBackend()
27
    {
28
        /** @var SessionManager $cm */
29
        $sm = GeneralUtility::makeInstance(SessionManager::class);
30
        $backend = $sm->getSessionBackend($this->getIdentifier());
31
        return $backend;
32
    }
33
}
34