MarkedAsDuplicate::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace CultuurNet\UDB3\Place\Events;
4
5
use CultuurNet\UDB3\Place\PlaceEvent;
6
7 View Code Duplication
final class MarkedAsDuplicate extends PlaceEvent
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 string
11
     */
12
    private $duplicateOf;
13
14
    public function __construct(string $placeId, string $duplicateOf)
15
    {
16
        parent::__construct($placeId);
17
        $this->duplicateOf = $duplicateOf;
18
    }
19
20
    public function getDuplicateOf(): string
21
    {
22
        return $this->duplicateOf;
23
    }
24
25
    public function serialize(): array
26
    {
27
        return parent::serialize() + [
28
                'duplicate_of' => $this->duplicateOf,
29
            ];
30
    }
31
32
    public static function deserialize(array $data): MarkedAsDuplicate
33
    {
34
        return new static($data['place_id'], ($data['duplicate_of']));
35
    }
36
}
37