File::setUid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 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