File   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 98
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 1
dl 0
loc 98
c 0
b 0
f 0
ccs 27
cts 27
cp 1
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getModified() 0 4 1
A setModified() 0 4 1
A getPath() 0 4 1
A setPath() 0 4 1
A getSize() 0 4 1
A setSize() 0 4 1
A getUid() 0 4 1
A setUid() 0 4 1
A __toString() 0 9 1
1
<?php
2
namespace AppBundle\Sync\Entity;
3
4
use DateTime;
5
6
/**
7
 * File entity
8
 *
9
 * @author Sergey Sadovoi <[email protected]>
10
 */
11
class File extends Entity
12
{
13
    /**
14
     * @var string  Unique id of the file
15
     */
16
    protected $uid;
17
    /**
18
     * @var string  File path
19
     */
20
    protected $path;
21
    /**
22
     * @var int  File size
23
     */
24
    protected $size;
25
    /**
26
     * @var DateTime Modification date
27
     */
28
    protected $modified;
29
30
    /**
31
     * @return DateTime
32
     */
33 2
    public function getModified()
34
    {
35 2
        return $this->modified;
36
    }
37
38
    /**
39
     * @param DateTime $modified
40
     */
41 3
    public function setModified(DateTime $modified)
42
    {
43 3
        $this->modified = $modified;
44 3
    }
45
46
    /**
47
     * @return string
48
     */
49 12
    public function getPath()
50
    {
51 12
        return $this->path;
52
    }
53
54
    /**
55
     * @param string $path
56
     */
57 6
    public function setPath($path)
58
    {
59 6
        $this->path = $path;
60 6
    }
61
62
    /**
63
     * @return int
64
     */
65 2
    public function getSize()
66
    {
67 2
        return $this->size;
68
    }
69
70
    /**
71
     * @param int $size
72
     */
73 3
    public function setSize($size)
74
    {
75 3
        $this->size = $size;
76 3
    }
77
78
    /**
79
     * @return string
80
     */
81 11
    public function getUid()
82
    {
83 11
        return $this->uid;
84
    }
85
86
    /**
87
     * @param string $uid
88
     */
89 5
    public function setUid($uid)
90
    {
91 5
        $this->uid = $uid;
92 5
    }
93
94
    /**
95
     * Serialize file to string
96
     *
97
     * @return string
98
     */
99 2
    public function __toString()
100
    {
101 2
        return sprintf(
102 2
            '%s, %sb, %s',
103 2
            $this->getPath(),
104 2
            number_format($this->getSize(), 0, '.', ' '),
105 2
            $this->getModified()->format('d.m.y H:i:s')
106 2
        );
107
    }
108
}
109