Code Duplication    Length = 33-40 lines in 2 locations

src/Event/EventEvent.php 1 location

@@ 10-42 (lines=33) @@
7
8
use Broadway\Serializer\SerializableInterface;
9
10
abstract class EventEvent implements SerializableInterface
11
{
12
    protected $eventId;
13
14
    /**
15
     * @param string $eventId
16
     */
17
    public function __construct($eventId)
18
    {
19
        if (!is_string($eventId)) {
20
            throw new \InvalidArgumentException(
21
                'Expected eventId to be a string, received ' . gettype($eventId)
22
            );
23
        }
24
25
        $this->eventId = $eventId;
26
    }
27
28
    public function getEventId()
29
    {
30
        return $this->eventId;
31
    }
32
33
    /**
34
     * @return array
35
     */
36
    public function serialize()
37
    {
38
        return array(
39
            'event_id' => $this->eventId,
40
        );
41
    }
42
}
43

src/Offer/Events/AbstractEvent.php 1 location

@@ 7-46 (lines=40) @@
4
5
use Broadway\Serializer\SerializableInterface;
6
7
abstract class AbstractEvent implements SerializableInterface
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $itemId;
13
14
    /**
15
     * @param $itemId
16
     *  The id of the item that is the subject of the event.
17
     */
18
    public function __construct($itemId)
19
    {
20
        if (!is_string($itemId)) {
21
            throw new \InvalidArgumentException(
22
                'Expected itemId to be a string, received ' . gettype($itemId)
23
            );
24
        }
25
26
        $this->itemId = $itemId;
27
    }
28
29
    /**
30
     * @return string
31
     */
32
    public function getItemId()
33
    {
34
        return $this->itemId;
35
    }
36
37
    /**
38
     * @return array
39
     */
40
    public function serialize()
41
    {
42
        return array(
43
            'item_id' => $this->itemId,
44
        );
45
    }
46
}
47