Passed
Branch master (4f2c04)
by Yaroslav
20:04
created

SensioExtraTest::serialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 *
5
 * (c) Yaroslav Honcharuk <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Yarhon\RouteGuardBundle\Security\Test;
12
13
/**
14
 * @author Yaroslav Honcharuk <[email protected]>
15
 */
16
class SensioExtraTest extends AbstractSymfonySecurityTest
17
{
18
    /**
19
     * @var array
20
     */
21
    private $metadata = [];
22
23
    /**
24
     * @param string $name
25
     * @param mixed  $value
26
     *
27
     * @return self
28
     */
29 5
    public function setMetadata($name, $value)
30
    {
31 5
        $this->metadata[$name] = $value;
32
33 5
        return $this;
34
    }
35
36
    /**
37
     * @param string $name
38
     *
39
     * @return mixed
40
     */
41 16
    public function getMetadata($name)
42
    {
43 16
        return isset($this->metadata[$name]) ? $this->metadata[$name] : null;
44
    }
45
46 10
    public function serialize()
47
    {
48 10
        return serialize([$this->attributes, $this->subject, $this->metadata]);
49
    }
50
51 8
    public function unserialize($data)
52
    {
53 8
        list($attributes, $subject, $metadata) = unserialize($data);
54 8
        $this->attributes = $attributes;
55 8
        $this->subject = $subject;
56 8
        $this->metadata = $metadata;
57 8
    }
58
}
59