Code Duplication    Length = 19-19 lines in 3 locations

src/Charcoal/Cms/AbstractNews.php 1 location

@@ 227-245 (lines=19) @@
224
     * @throws InvalidArgumentException If the timestamp is invalid.
225
     * @return self
226
     */
227
    public function setNewsDate($newsDate)
228
    {
229
        if ($newsDate === null || $newsDate === '') {
230
            $this->newsDate = null;
231
232
            return $this;
233
        }
234
        if (is_string($newsDate)) {
235
            $newsDate = new DateTime($newsDate);
236
        }
237
        if (!($newsDate instanceof DateTimeInterface)) {
238
            throw new InvalidArgumentException(
239
                'Invalid "Revision Date" value. Must be a date/time string or a DateTimeInterface object.'
240
            );
241
        }
242
        $this->newsDate = $newsDate;
243
244
        return $this;
245
    }
246
247
    /**
248
     * Set the object's keywords.

src/Charcoal/Cms/AbstractEvent.php 2 locations

@@ 254-272 (lines=19) @@
251
     * @throws InvalidArgumentException If the timestamp is invalid.
252
     * @return self
253
     */
254
    public function setStartDate($startDate)
255
    {
256
        if ($startDate === null || $startDate === '') {
257
            $this->startDate = null;
258
259
            return $this;
260
        }
261
        if (is_string($startDate)) {
262
            $startDate = new DateTime($startDate);
263
        }
264
        if (!($startDate instanceof DateTimeInterface)) {
265
            throw new InvalidArgumentException(
266
                'Invalid "Start Date" value. Must be a date/time string or a DateTime object.'
267
            );
268
        }
269
        $this->startDate = $startDate;
270
271
        return $this;
272
    }
273
274
    /**
275
     * @return DateTimeInterface|null
@@ 287-305 (lines=19) @@
284
     * @throws InvalidArgumentException If the timestamp is invalid.
285
     * @return self
286
     */
287
    public function setEndDate($endDate)
288
    {
289
        if ($endDate === null || $endDate === '') {
290
            $this->endDate = null;
291
292
            return $this;
293
        }
294
        if (is_string($endDate)) {
295
            $endDate = new DateTime($endDate);
296
        }
297
        if (!($endDate instanceof DateTimeInterface)) {
298
            throw new InvalidArgumentException(
299
                'Invalid "End Date" value. Must be a date/time string or a DateTime object.'
300
            );
301
        }
302
        $this->endDate = $endDate;
303
304
        return $this;
305
    }
306
307
    /**
308
     * @return DateTimeInterface|null