FileContents::__unserialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
namespace MadWizard\WebAuthn\Remote;
4
5
use MadWizard\WebAuthn\Format\SerializableTrait;
6
use Serializable;
7
8
class FileContents implements Serializable
9
{
10
    use SerializableTrait;
11
12
    /**
13
     * @var string
14
     */
15
    private $data;
16
17
    /**
18
     * @var string
19
     */
20
    private $contentType;
21
22
    public function __construct(string $data, string $contentType)
23
    {
24
        $this->data = $data;
25
        $this->contentType = $contentType;
26
    }
27
28
    public function getData(): string
29
    {
30
        return $this->data;
31
    }
32
33
    public function getContentType(): string
34
    {
35
        return $this->contentType;
36
    }
37
38
    public function __serialize(): array
39
    {
40
        return [
41
            'contentType' => $this->contentType,
42
            'data' => $this->data,
43
        ];
44
    }
45
46
    public function __unserialize(array $serialized): void
47
    {
48
        $this->contentType = $serialized['contentType'];
49
        $this->data = $serialized['data'];
50
    }
51
}
52