PostDto::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Explicit Architecture POC,
7
 * which is created on top of the Symfony Demo application.
8
 *
9
 * (c) Herberto Graça <[email protected]>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace Acme\App\Core\Component\Blog\Application\Query;
16
17
use Acme\App\Core\Component\Blog\Domain\Post\PostId;
18
use Acme\PhpExtension\ConstructableFromArrayInterface;
19
use Acme\PhpExtension\ConstructableFromArrayTrait;
20
use DateTimeInterface;
21
22
/**
23
 * This is just a DTO, it only has getters, theres no logic to test, so we ignore it for code coverage purposes.
24
 *
25
 * @codeCoverageIgnore
26
 */
27
final class PostDto implements ConstructableFromArrayInterface
28
{
29
    use ConstructableFromArrayTrait;
30
31
    /**
32
     * @var PostId
33
     */
34
    private $postId;
35
36
    /**
37
     * @var string
38
     */
39
    private $title;
40
41
    /**
42
     * @var DateTimeInterface
43
     */
44
    private $publishedAt;
45
46
    public function __construct(
47
        PostId $id,
48
        string $title,
49
        DateTimeInterface $publishedAt
50
    ) {
51
        $this->postId = $id;
52
        $this->title = $title;
53
        $this->publishedAt = $publishedAt;
54
    }
55
56
    public function getId(): PostId
57
    {
58
        return $this->postId;
59
    }
60
61
    public function getTitle(): string
62
    {
63
        return $this->title;
64
    }
65
66
    public function getPublishedAt(): DateTimeInterface
67
    {
68
        return $this->publishedAt;
69
    }
70
}
71