File   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 127
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 12
lcom 1
cbo 0
dl 0
loc 127
ccs 28
cts 28
cp 1
rs 10
c 0
b 0
f 0

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getPath() 0 4 1
A setPath() 0 5 1
A getTimestamp() 0 4 1
A setTimestamp() 0 5 1
A getMimetype() 0 4 1
A setMimetype() 0 5 1
A getSize() 0 4 1
A setSize() 0 5 1
A getFilePath() 0 4 1
A getName() 0 4 1
A getFileName() 0 4 1
A getExtension() 0 4 1
1
<?php
2
3
namespace WSW\SimpleUpload\Entities;
4
5
use DateTime;
6
7
/**
8
 * Class File
9
 * @package WSW\SimpleUpload\Entities
10
 */
11
class File
12
{
13
    /**
14
     * @var string
15
     */
16
    private $path;
17
18
    /**
19
     * @var DateTime
20
     */
21
    private $timestamp;
22
23
    /**
24
     * @var string
25
     */
26
    private $mimetype;
27
28
    /**
29
     * @var int
30
     */
31
    private $size;
32
33
    /**
34
     * @return string
35
     */
36 1
    public function getPath()
37
    {
38 1
        return $this->path;
39
    }
40
41
    /**
42
     * @param string $path
43
     * @return self
44
     */
45 5
    public function setPath($path)
46
    {
47 5
        $this->path = $path;
48 5
        return $this;
49
    }
50
51
    /**
52
     * @return DateTime
53
     */
54 1
    public function getTimestamp()
55
    {
56 1
        return $this->timestamp;
57
    }
58
59
    /**
60
     * @param int $timestamp
61
     * @return self
62
     */
63 5
    public function setTimestamp($timestamp)
64
    {
65 5
        $this->timestamp = (new DateTime())->setTimestamp($timestamp);
66 5
        return $this;
67
    }
68
69
    /**
70
     * @return string
71
     */
72 1
    public function getMimetype()
73
    {
74 1
        return $this->mimetype;
75
    }
76
77
    /**
78
     * @param string $mimetype
79
     *
80
     * @return self
81
     */
82 5
    public function setMimetype($mimetype)
83
    {
84 5
        $this->mimetype = $mimetype;
85 5
        return $this;
86
    }
87
88
    /**
89
     * @return int
90
     */
91 1
    public function getSize()
92
    {
93 1
        return $this->size;
94
    }
95
96
    /**
97
     * @param int $size
98
     * @return self
99
     */
100 5
    public function setSize($size)
101
    {
102 5
        $this->size = $size;
103 5
        return $this;
104
    }
105
106
    /**
107
     * @return string
108
     */
109 1
    public function getFilePath()
110
    {
111 1
        return dirname($this->getPath());
112
    }
113
114
    /**
115
     * @return string
116
     */
117 1
    public function getName()
118
    {
119 1
        return pathinfo($this->getPath(), PATHINFO_FILENAME);
120
    }
121
122
    /**
123
     * @return string
124
     */
125 1
    public function getFileName()
126
    {
127 1
        return basename($this->getPath());
128
    }
129
130
    /**
131
     * @return string
132
     */
133 1
    public function getExtension()
134
    {
135 1
        return strtolower(pathinfo($this->getPath(), PATHINFO_EXTENSION));
136
    }
137
}
138