Code Duplication    Length = 4-4 lines in 4 locations

src/Service/Game.php 4 locations

@@ 152-155 (lines=4) @@
149
150
        // I must switch from original format to the Y-m-d format because
151
        // this is the only one accepted by new DateTime($value)
152
        if (isset($data['publicationDate']) && $data['publicationDate']) {
153
            $tmpDate = \DateTime::createFromFormat('d/m/Y H:i:s', $data['publicationDate']);
154
            $data['publicationDate'] = $tmpDate->format('Y-m-d H:i:s');
155
        }
156
        if (isset($data['startDate']) && $data['startDate']) {
157
            $tmpDate = \DateTime::createFromFormat('d/m/Y H:i:s', $data['startDate']);
158
            $data['startDate'] = $tmpDate->format('Y-m-d H:i:s');
@@ 156-159 (lines=4) @@
153
            $tmpDate = \DateTime::createFromFormat('d/m/Y H:i:s', $data['publicationDate']);
154
            $data['publicationDate'] = $tmpDate->format('Y-m-d H:i:s');
155
        }
156
        if (isset($data['startDate']) && $data['startDate']) {
157
            $tmpDate = \DateTime::createFromFormat('d/m/Y H:i:s', $data['startDate']);
158
            $data['startDate'] = $tmpDate->format('Y-m-d H:i:s');
159
        }
160
        if (isset($data['endDate']) && $data['endDate']) {
161
            $tmpDate = \DateTime::createFromFormat('d/m/Y H:i:s', $data['endDate']);
162
            $data['endDate'] = $tmpDate->format('Y-m-d H:i:s');
@@ 160-163 (lines=4) @@
157
            $tmpDate = \DateTime::createFromFormat('d/m/Y H:i:s', $data['startDate']);
158
            $data['startDate'] = $tmpDate->format('Y-m-d H:i:s');
159
        }
160
        if (isset($data['endDate']) && $data['endDate']) {
161
            $tmpDate = \DateTime::createFromFormat('d/m/Y H:i:s', $data['endDate']);
162
            $data['endDate'] = $tmpDate->format('Y-m-d H:i:s');
163
        }
164
        if (isset($data['closeDate']) && $data['closeDate']) {
165
            $tmpDate = \DateTime::createFromFormat('d/m/Y H:i:s', $data['closeDate']);
166
            $data['closeDate'] = $tmpDate->format('Y-m-d H:i:s');
@@ 164-167 (lines=4) @@
161
            $tmpDate = \DateTime::createFromFormat('d/m/Y H:i:s', $data['endDate']);
162
            $data['endDate'] = $tmpDate->format('Y-m-d H:i:s');
163
        }
164
        if (isset($data['closeDate']) && $data['closeDate']) {
165
            $tmpDate = \DateTime::createFromFormat('d/m/Y H:i:s', $data['closeDate']);
166
            $data['closeDate'] = $tmpDate->format('Y-m-d H:i:s');
167
        }
168
169
        // If publicationDate is null, I update it with the startDate if not null neither
170
        if ((! isset($data['publicationDate']) || $data['publicationDate'] == '') &&