| Total Complexity | 7 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | final class Subscription implements ContainsRecordedEventsInterface |
||
| 20 | { |
||
| 21 | use EventRecorder; |
||
| 22 | |||
| 23 | private $identity; |
||
| 24 | private $user; |
||
| 25 | private $name; |
||
| 26 | private $location; |
||
| 27 | |||
| 28 | 5 | private function __construct( |
|
| 29 | Identity $identity, |
||
| 30 | User $user, |
||
| 31 | Name $name, |
||
| 32 | UrlInterface $location |
||
| 33 | ) { |
||
| 34 | 5 | $this->identity = $identity; |
|
| 35 | 5 | $this->user = $user; |
|
| 36 | 5 | $this->name = $name; |
|
| 37 | 5 | $this->location = $location; |
|
| 38 | 5 | } |
|
| 39 | |||
| 40 | 5 | public static function add( |
|
| 41 | Identity $identity, |
||
| 42 | User $user, |
||
| 43 | Name $name, |
||
| 44 | UrlInterface $location |
||
| 45 | ): self { |
||
| 46 | 5 | $self = new self($identity, $user, $name, $location); |
|
| 47 | 5 | $self->record(new SubscriptionWasAdded($identity, $user, $name, $location)); |
|
| 48 | |||
| 49 | 5 | return $self; |
|
| 50 | } |
||
| 51 | |||
| 52 | 3 | public function identity(): Identity |
|
| 53 | { |
||
| 54 | 3 | return $this->identity; |
|
| 55 | } |
||
| 56 | |||
| 57 | 2 | public function user(): User |
|
| 58 | { |
||
| 59 | 2 | return $this->user; |
|
| 60 | } |
||
| 61 | |||
| 62 | 2 | public function name(): Name |
|
| 63 | { |
||
| 64 | 2 | return $this->name; |
|
| 65 | } |
||
| 66 | |||
| 67 | 3 | public function location(): UrlInterface |
|
| 70 | } |
||
| 71 | |||
| 72 | 2 | public function remove(): void |
|
| 75 | 2 | } |
|
| 76 | } |
||
| 77 | |||
| 78 |