Code Duplication    Length = 11-12 lines in 2 locations

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

src/FormatMapping.php 1 location

@@ 83-93 (lines=11) @@
80
     * @param \DateTimeInterface|string|int|null $date
81
     * @return string
82
     */
83
    private function filterDate($date)
84
    {
85
        if (empty($date)) {
86
            $date = new \DateTime("now", new \DateTimeZone("Asia/Jakarta"));
87
        }
88
89
        if (is_string($date) || is_int($date)) {
90
            $date = new \DateTime($date);
91
        }
92
93
        return $this->formatDate($date);
94
    }
95
96
    /**