Test Failed
Pull Request — master (#34)
by
unknown
01:49
created

File::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1.2963

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 12
ccs 1
cts 3
cp 0.3333
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1.2963
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 7
    public function __construct($id, $name, $hash = null, $size = null, $type = null, $info = null, $bucketId = null, $action = null, $uploadTimestamp = null)
31
    {
32 7
        $this->id = $id;
33 7
        $this->name = $name;
34 7
        $this->hash = $hash;
35 7
        $this->size = $size;
36 7
        $this->type = $type;
37 7
        $this->info = $info;
38 7
        $this->bucketId = $bucketId;
39 7
        $this->action = $action;
40 7
        $this->uploadTimestamp = $uploadTimestamp;
41 7
    }
42
43
44
	public function jsonSerialize() 
45
	{
46
        return [
47
            'id' => $this->getId(),
48
            'name' => $this->getName(),
49
            'hash' => $this->getHash(),
50
            'size' => $this->getSize(),
51
            'type' => $this->getType(),
52
            'info' => $this->getInfo(),
53
            'bucketId' => $this->getBucketId(),
54 2
            'action' => $this->getAction(),
55
            'uploadTimestamp' => $this->getUploadTimestamp(),
56 2
        ];
57
	}
58
    /**
59
     * @return string
60
     */
61
    public function getId()
62
    {
63
        return $this->id;
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    public function getName()
70
    {
71
        return $this->name;
72
    }
73
74
    /**
75
     * @return string
76
     */
77
    public function getHash()
78
    {
79
        return $this->hash;
80
    }
81
82
    /**
83
     * @return int
84
     */
85
    public function getSize()
86
    {
87
        return $this->size;
88
    }
89
90
    /**
91
     * @return string
92
     */
93
    public function getType()
94
    {
95
        return $this->type;
96
    }
97
98
    /**
99
     * @return array
100
     */
101
    public function getInfo()
102
    {
103
        return $this->info;
104
    }
105
106
    /**
107
     * @return string
108
     */
109
    public function getBucketId()
110
    {
111
        return $this->bucketId;
112
    }
113
114
    /**
115
     * @return string
116
     */
117
    public function getAction()
118
    {
119
        return $this->action;
120
    }
121
122
    /**
123
     * @return string
124
     */
125
    public function getUploadTimestamp()
126
    {
127
        return $this->uploadTimestamp;
128
    }
129
}
130