Code Duplication    Length = 9-9 lines in 2 locations

plugins/Field/src/Utility/DateToolbox.php 2 locations

@@ 163-171 (lines=9) @@
160
     * @param string $format Format to validate. e.g. yy:mm:ddQ (invalid)
161
     * @return bool
162
     */
163
    public static function validateDateFormat($format)
164
    {
165
        $format = str_replace(array_keys(static::$_map['date']), '', $format); // remove placeholders
166
        $format = preg_replace("/'(.*)'/", '', $format); // remove literals
167
        $format = preg_replace('/[^a-z]/i', '', $format);
168
        $format = trim($format);
169
170
        return empty($format);
171
    }
172
173
    /**
174
     * Validates a time format for jQuery's datepicker widget.
@@ 179-187 (lines=9) @@
176
     * @param string $format Format to validate. e.g. hh:mm:ssA (invalid)
177
     * @return bool
178
     */
179
    public static function validateTimeFormat($format)
180
    {
181
        $format = str_replace(array_keys(static::$_map['time']), '', $format); // remove placeholders
182
        $format = preg_replace("/'(.*)'/", '', $format); // remove literals
183
        $format = preg_replace('/[^a-z]/i', '', $format);
184
        $format = trim($format);
185
186
        return empty($format);
187
    }
188
189
    /**
190
     * Given a DateField instance, gets its PHP's date-format.