Code Duplication    Length = 10-10 lines in 2 locations

src/Common/DateTimeHelper.php 2 locations

@@ 12-21 (lines=10) @@
9
use RuntimeException;
10
11
abstract class DateTimeHelper {
12
	public static function create($init = null): DateTime {
13
		try {
14
			if($init instanceof DateTimeInterface) {
15
				return new DateTime($init->format('c'));
16
			}
17
			return new DateTime($init);
18
		} catch (Exception $e) {
19
			throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
20
		}
21
	}
22
	
23
	public static function createImmutable($init = null): DateTimeImmutable {
24
		try {
@@ 23-32 (lines=10) @@
20
		}
21
	}
22
	
23
	public static function createImmutable($init = null): DateTimeImmutable {
24
		try {
25
			if($init instanceof DateTimeInterface) {
26
				return new DateTimeImmutable($init->format('c'));
27
			}
28
			return new DateTimeImmutable($init);
29
		} catch (Exception $e) {
30
			throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
31
		}
32
	}
33
	
34
	/**
35
	 * @param string $interval