Completed
Push — update-travis ( 67cde9...6f3c47 )
by Kevin
07:18 queued 03:01
created

SessionParamConverter::getObject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.037

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
ccs 2
cts 3
cp 0.6667
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1.037
1
<?php
2
3
namespace Zenstruck\ControllerUtil\ParamConverter;
4
5
use Symfony\Component\HttpFoundation\Request;
6
7
/**
8
 * @author Kevin Bond <[email protected]>
9
 */
10
class SessionParamConverter implements ParamConverter
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 1
    public function getObject(Request $request)
16
    {
17
        return $request->getSession();
18 1
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function supports($class)
24
    {
25
        return is_subclass_of($class, 'Symfony\\Component\\HttpFoundation\\Session\\SessionInterface') ||
26
            $class === 'Symfony\\Component\\HttpFoundation\\Session\\SessionInterface';
27
    }
28
}
29