Code Duplication    Length = 18-18 lines in 2 locations

src/Infrastructure/Persistence/InMemoryEventStoreRepository.php 1 location

@@ 64-81 (lines=18) @@
61
     *
62
     * @return array
63
     */
64
    private function buildEventAggregateAsArray(AggregateUuid $uuid)
65
    {
66
        $returnArray = [];
67
68
        /** @var Event $event */
69
        foreach ($this->events[(string) $uuid] as $event) {
70
            $returnArray[] = [
71
                'uuid' => $event->uuid(),
72
                'version' => $event->version(),
73
                'payload' => $event->payload(),
74
                'type' => $event->type(),
75
                'body' => $event->body(),
76
                'occurred_on' => $event->occurredOn(),
77
            ];
78
        }
79
80
        return $returnArray;
81
    }
82
83
    /**
84
     * @param AggregateUuid $uuid

src/Infrastructure/Persistence/RedisEventStoreRepository.php 1 location

@@ 82-99 (lines=18) @@
79
     *
80
     * @return array
81
     */
82
    private function buildEventAggregateAsArray(array $events)
83
    {
84
        $returnArray = [];
85
86
        /** @var Event $event */
87
        foreach ($events as $event) {
88
            $returnArray[] = [
89
                'uuid' => (string) $event->uuid(),
90
                'version' => $event->version(),
91
                'payload' => $event->payload(),
92
                'type' => $event->type(),
93
                'body' => $event->body(),
94
                'occurred_on' => $event->occurredOn()->format('Y-m-d H:i:s.u')
95
            ];
96
        }
97
98
        return $returnArray;
99
    }
100
101
    /**
102
     * @param array $events