Code Duplication    Length = 11-12 lines in 2 locations

src/FormatMapping.php 1 location

@@ 79-89 (lines=11) @@
76
	 * @param \DateTimeInterface|string|int|null $date
77
	 * @return string
78
	 */
79
	private function filterDate($date) {
80
		if (empty($date)) {
81
			$date = new \DateTime("now", new \DateTimeZone("Asia/Jakarta"));
82
		}
83
84
		if (is_string($date) || is_int($date)) {
85
			$date = new \DateTime($date);
86
		}
87
88
		return $this->formatDate($date);
89
	}
90
91
	/**
92
	 * Get value of array based on attributes(keys)

src/Model/Model.php 1 location

@@ 78-89 (lines=12) @@
75
     * @param \DateTimeInterface|string|int|null $date
76
     * @return string
77
     */
78
    protected function filterDateInstance($date)
79
    {
80
        if (empty($date)) {
81
            $date = new \DateTime("now", new \DateTimeZone("Asia/Jakarta"));
82
        }
83
84
        if (is_string($date) || is_int($date)) {
85
            $date = new \DateTime($date);
86
        }
87
88
        return $this->formatDate($date);
89
    }
90
91
    /**
92
     * format date into required format