FileContents   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 42
ccs 0
cts 14
cp 0
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __serialize() 0 5 1
A __unserialize() 0 4 1
A getData() 0 3 1
A getContentType() 0 3 1
A __construct() 0 4 1
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