PostDto   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 44
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getId() 0 4 1
A getTitle() 0 4 1
A getPublishedAt() 0 4 1
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