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\Notification\NewComment; |
16
|
|
|
|
17
|
|
|
use Acme\App\Core\Component\Blog\Domain\Post\PostId; |
18
|
|
|
use Acme\App\Core\Port\Notification\Client\Email\EmailAddress; |
19
|
|
|
use Acme\App\Core\Port\Notification\NotificationInterface; |
20
|
|
|
use Acme\App\Core\SharedKernel\Component\Blog\Domain\Post\Comment\CommentId; |
21
|
|
|
use Acme\App\Core\SharedKernel\Component\User\Domain\User\UserId; |
22
|
|
|
|
23
|
|
|
final class NewCommentNotification implements NotificationInterface |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* @var UserId |
27
|
|
|
*/ |
28
|
|
|
private $postAuthorId; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
private $postAuthorMobile; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var \Acme\App\Core\SharedKernel\Component\Blog\Domain\Post\Comment\CommentId |
37
|
|
|
*/ |
38
|
|
|
private $commentId; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var EmailAddress |
42
|
|
|
*/ |
43
|
|
|
private $emailAddress; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var PostId |
47
|
|
|
*/ |
48
|
|
|
private $postId; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var string |
52
|
|
|
*/ |
53
|
|
|
private $postTitle; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var string |
57
|
|
|
*/ |
58
|
|
|
private $postSlug; |
59
|
|
|
|
60
|
|
|
public function __construct( |
61
|
|
|
UserId $postAuthorId, |
62
|
|
|
string $postAuthorMobile, |
63
|
|
|
CommentId $commentId, |
64
|
|
|
EmailAddress $emailAddress, |
65
|
|
|
PostId $postId, |
66
|
|
|
string $postTitle, |
67
|
|
|
string $postSlug |
68
|
|
|
) { |
69
|
|
|
$this->postAuthorId = $postAuthorId; |
70
|
|
|
$this->postAuthorMobile = $postAuthorMobile; |
71
|
|
|
$this->commentId = $commentId; |
72
|
|
|
$this->emailAddress = $emailAddress; |
73
|
|
|
$this->postId = $postId; |
74
|
|
|
$this->postTitle = $postTitle; |
75
|
|
|
$this->postSlug = $postSlug; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getDestinationUserId(): UserId |
79
|
|
|
{ |
80
|
|
|
return $this->postAuthorId; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function getPostAuthorMobile(): string |
84
|
|
|
{ |
85
|
|
|
return $this->postAuthorMobile; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function getCommentId(): CommentId |
89
|
|
|
{ |
90
|
|
|
return $this->commentId; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function getPostAuthorEmail(): EmailAddress |
94
|
|
|
{ |
95
|
|
|
return $this->emailAddress; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getPostId(): PostId |
99
|
|
|
{ |
100
|
|
|
return $this->postId; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function getPostTitle(): string |
104
|
|
|
{ |
105
|
|
|
return $this->postTitle; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function getPostSlug(): string |
109
|
|
|
{ |
110
|
|
|
return $this->postSlug; |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
|