Code Duplication    Length = 98-98 lines in 2 locations

src/Presentation/Web/Core/Component/Blog/Admin/Post/GetViewModel.php 1 location

@@ 23-120 (lines=98) @@
20
use Acme\PhpExtension\ConstructableFromArrayTrait;
21
use DateTimeInterface;
22
23
final class GetViewModel implements TemplateViewModelInterface, ConstructableFromArrayInterface
24
{
25
    use ConstructableFromArrayTrait;
26
27
    /**
28
     * @var PostId
29
     */
30
    private $postId;
31
32
    /**
33
     * @var string
34
     */
35
    private $postTitle;
36
37
    /**
38
     * @var DateTimeInterface
39
     */
40
    private $postPublishedAt;
41
42
    /**
43
     * @var string
44
     */
45
    private $postAuthorFullName;
46
47
    /**
48
     * @var string
49
     */
50
    private $postSummary;
51
52
    /**
53
     * @var string
54
     */
55
    private $postContent;
56
57
    /**
58
     * @var string[]
59
     */
60
    private $postTagList;
61
62
    /**
63
     * The view model constructor depends on the most raw elements possible.
64
     */
65
    public function __construct(
66
        PostId $id,
67
        string $title,
68
        DateTimeInterface $publishedAt,
69
        string $authorFullName,
70
        string $summary,
71
        string $content,
72
        string ...$tagList
73
    ) {
74
        $this->postId = $id;
75
        $this->postTitle = $title;
76
        $this->postPublishedAt = $publishedAt;
77
        $this->postAuthorFullName = $authorFullName;
78
        $this->postSummary = $summary;
79
        $this->postContent = $content;
80
        $this->postTagList = $tagList;
81
    }
82
83
    public function getPostId(): PostId
84
    {
85
        return $this->postId;
86
    }
87
88
    public function getPostTitle(): string
89
    {
90
        return $this->postTitle;
91
    }
92
93
    public function getPostPublishedAt(): DateTimeInterface
94
    {
95
        return $this->postPublishedAt;
96
    }
97
98
    public function getPostAuthorFullName(): string
99
    {
100
        return $this->postAuthorFullName;
101
    }
102
103
    public function getPostSummary(): string
104
    {
105
        return $this->postSummary;
106
    }
107
108
    public function getPostContent(): string
109
    {
110
        return $this->postContent;
111
    }
112
113
    /**
114
     * @return string[]
115
     */
116
    public function getPostTagList(): array
117
    {
118
        return $this->postTagList;
119
    }
120
}
121

src/Presentation/Web/Core/Component/Blog/Anonymous/Post/GetViewModel.php 1 location

@@ 23-120 (lines=98) @@
20
use Acme\PhpExtension\ConstructableFromArrayTrait;
21
use DateTimeInterface;
22
23
final class GetViewModel implements TemplateViewModelInterface, ConstructableFromArrayInterface
24
{
25
    use ConstructableFromArrayTrait;
26
27
    /**
28
     * @var PostId
29
     */
30
    private $postId;
31
32
    /**
33
     * @var string
34
     */
35
    private $postTitle;
36
37
    /**
38
     * @var DateTimeInterface
39
     */
40
    private $postPublishedAt;
41
42
    /**
43
     * @var string
44
     */
45
    private $postAuthorFullName;
46
47
    /**
48
     * @var string
49
     */
50
    private $postContent;
51
52
    /**
53
     * @var string[]
54
     */
55
    private $postTagList;
56
57
    /**
58
     * @var string[][]
59
     */
60
    private $postCommentList;
61
62
    /**
63
     * The view model constructor depends on the most raw elements possible.
64
     */
65
    public function __construct(
66
        PostId $id,
67
        string $title,
68
        DateTimeInterface $publishedAt,
69
        string $authorFullName,
70
        string $content,
71
        array $tagList,
72
        array $commentList
73
    ) {
74
        $this->postId = $id;
75
        $this->postTitle = $title;
76
        $this->postPublishedAt = $publishedAt;
77
        $this->postAuthorFullName = $authorFullName;
78
        $this->postContent = $content;
79
        $this->postTagList = $tagList;
80
        $this->postCommentList = $commentList;
81
    }
82
83
    public function getPostId(): PostId
84
    {
85
        return $this->postId;
86
    }
87
88
    public function getPostTitle(): string
89
    {
90
        return $this->postTitle;
91
    }
92
93
    public function getPostPublishedAt(): DateTimeInterface
94
    {
95
        return $this->postPublishedAt;
96
    }
97
98
    public function getPostAuthorFullName(): string
99
    {
100
        return $this->postAuthorFullName;
101
    }
102
103
    public function getPostContent(): string
104
    {
105
        return $this->postContent;
106
    }
107
108
    /**
109
     * @return string[]
110
     */
111
    public function getPostCommentList(): array
112
    {
113
        return $this->postCommentList;
114
    }
115
116
    public function getPostTagList(): array
117
    {
118
        return $this->postTagList;
119
    }
120
}
121