WebsiteUpdated::getWebsite()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace CultuurNet\UDB3\Organizer\Events;
4
5
use ValueObjects\Web\Url;
6
7 View Code Duplication
final class WebsiteUpdated extends OrganizerEvent
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    /**
10
     * @var Url
11
     */
12
    private $website;
13
14
    public function __construct(
15
        string $organizerId,
16
        Url $website
17
    ) {
18
        parent::__construct($organizerId);
19
        $this->website = $website;
20
    }
21
22
    public function getWebsite(): Url
23
    {
24
        return $this->website;
25
    }
26
27
    public function serialize(): array
28
    {
29
        return parent::serialize() + [
30
            'website' => (string) $this->getWebsite(),
31
        ];
32
    }
33
34
    public static function deserialize(array $data): WebsiteUpdated
35
    {
36
        return new static(
37
            $data['organizer_id'],
38
            Url::fromNative($data['website'])
39
        );
40
    }
41
}
42