File   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 126
Duplicated Lines 0 %

Test Coverage

Coverage 38.46%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 11
eloc 38
c 2
b 0
f 0
dl 0
loc 126
ccs 15
cts 39
cp 0.3846
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A getBucketId() 0 3 1
A getName() 0 3 1
A getInfo() 0 3 1
A getType() 0 3 1
A jsonSerialize() 0 12 1
A getSize() 0 3 1
A getUploadTimestamp() 0 3 1
A getAction() 0 3 1
A getHash() 0 3 1
A getId() 0 3 1
1
<?php
2
3
namespace BackblazeB2;
4
5
class File implements \JsonSerializable
6
{
7
    protected $id;
8
    protected $name;
9
    protected $hash;
10
    protected $size;
11
    protected $type;
12
    protected $info;
13
    protected $bucketId;
14
    protected $action;
15
    protected $uploadTimestamp;
16
17
    /**
18
     * File constructor.
19
     *
20
     * @param $id
21
     * @param $name
22
     * @param $hash
23
     * @param $size
24
     * @param $type
25
     * @param $info
26
     * @param $bucketId
27
     * @param $action
28
     * @param $uploadTimestamp
29
     */
30 8
    public function __construct($id, $name, $hash = null, $size = null, $type = null, $info = null, $bucketId = null, $action = null, $uploadTimestamp = null)
31
    {
32 8
        $this->id = $id;
33 8
        $this->name = $name;
34 8
        $this->hash = $hash;
35 8
        $this->size = $size;
36 8
        $this->type = $type;
37 8
        $this->info = $info;
38 8
        $this->bucketId = $bucketId;
39 8
        $this->action = $action;
40 8
        $this->uploadTimestamp = $uploadTimestamp;
41 8
    }
42
43
    /**
44
     * @return array
45
     * */
46
    public function jsonSerialize(): mixed
47
    {
48
        return [
49
            'id'              => $this->getId(),
50
            'name'            => $this->getName(),
51
            'hash'            => $this->getHash(),
52
            'size'            => $this->getSize(),
53
            'type'            => $this->getType(),
54
            'info'            => $this->getInfo(),
55
            'bucketId'        => $this->getBucketId(),
56
            'action'          => $this->getAction(),
57
            'uploadTimestamp' => $this->getUploadTimestamp(),
58
        ];
59
    }
60
61
    /**
62
     * @return string
63
     */
64 1
    public function getId()
65
    {
66 1
        return $this->id;
67
    }
68
69
    /**
70
     * @return string
71
     */
72 2
    public function getName()
73
    {
74 2
        return $this->name;
75
    }
76
77
    /**
78
     * @return string
79
     */
80
    public function getHash()
81
    {
82
        return $this->hash;
83
    }
84
85
    /**
86
     * @return int
87
     */
88
    public function getSize()
89
    {
90
        return $this->size;
91
    }
92
93
    /**
94
     * @return string
95
     */
96
    public function getType()
97
    {
98
        return $this->type;
99
    }
100
101
    /**
102
     * @return array
103
     */
104
    public function getInfo()
105
    {
106
        return $this->info;
107
    }
108
109
    /**
110
     * @return string
111
     */
112
    public function getBucketId()
113
    {
114
        return $this->bucketId;
115
    }
116
117
    /**
118
     * @return string
119
     */
120
    public function getAction()
121
    {
122
        return $this->action;
123
    }
124
125
    /**
126
     * @return string
127
     */
128
    public function getUploadTimestamp()
129
    {
130
        return $this->uploadTimestamp;
131
    }
132
}
133