Paste   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 92
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 8
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 92
ccs 22
cts 22
cp 1
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getId() 0 4 1
A getTitle() 0 4 1
A setTitle() 0 4 1
A getCreatedAt() 0 4 1
A setCreatedAt() 0 4 1
A getFiles() 0 4 1
A addFile() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Nastoletni\Code\Domain;
6
7
use DateTime;
8
9
class Paste
10
{
11
    /**
12
     * @var Paste\Id
13
     */
14
    private $id;
15
16
    /**
17
     * @var null|string
18
     */
19
    private $title;
20
21
    /**
22
     * @var DateTime
23
     */
24
    private $createdAt;
25
26
    /**
27
     * @var File[]
28
     */
29
    private $files = [];
30
31
    /**
32
     * Paste constructor.
33
     *
34
     * @param Paste\Id    $id
35
     * @param null|string $title
36
     * @param DateTime    $createdAt
37
     */
38 14
    public function __construct(Paste\Id $id, ?string $title, DateTime $createdAt)
39
    {
40 14
        $this->id = $id;
41 14
        $this->title = $title;
42 14
        $this->createdAt = $createdAt;
43 14
    }
44
45
    /**
46
     * @return Paste\Id
47
     */
48 4
    public function getId(): Paste\Id
49
    {
50 4
        return $this->id;
51
    }
52
53
    /**
54
     * @return null|string
55
     */
56 8
    public function getTitle(): ?string
57
    {
58 8
        return $this->title;
59
    }
60
61
    /**
62
     * @param null|string $title
63
     */
64 3
    public function setTitle($title): void
65
    {
66 3
        $this->title = $title;
67 3
    }
68
69
    /**
70
     * @return DateTime
71
     */
72 7
    public function getCreatedAt(): DateTime
73
    {
74 7
        return $this->createdAt;
75
    }
76
77
    /**
78
     * @param DateTime $createdAt
79
     */
80 3
    public function setCreatedAt(DateTime $createdAt): void
81
    {
82 3
        $this->createdAt = $createdAt;
83 3
    }
84
85
    /**
86
     * @return File[]
87
     */
88 8
    public function getFiles(): array
89
    {
90 8
        return $this->files;
91
    }
92
93
    /**
94
     * @param File $file
95
     */
96 8
    public function addFile(File $file): void
97
    {
98 8
        $this->files[] = $file;
99 8
    }
100
}
101