Code Duplication    Length = 12-12 lines in 4 locations

src/Charcoal/Property/DateTimeProperty.php 2 locations

@@ 278-289 (lines=12) @@
275
    /**
276
     * @return boolean
277
     */
278
    public function validateMin()
279
    {
280
        $min = $this->min();
281
        if (!$min) {
282
            return true;
283
        }
284
        $valid = ($this->val() >= $min);
285
        if ($valid === false) {
286
            $this->validator()->error('The date is smaller than the minimum value', 'min');
287
        }
288
        return $valid;
289
    }
290
291
    /**
292
     * @return boolean
@@ 294-305 (lines=12) @@
291
    /**
292
     * @return boolean
293
     */
294
    public function validateMax()
295
    {
296
        $max = $this->max();
297
        if (!$max) {
298
            return true;
299
        }
300
        $valid = ($this->val() <= $max);
301
        if ($valid === false) {
302
            $this->validator()->error('The date is bigger than the maximum value', 'max');
303
        }
304
        return $valid;
305
    }
306
307
    /**
308
     * @see StorablePropertyTrait::sqlType()

src/Charcoal/Property/NumberProperty.php 2 locations

@@ 117-128 (lines=12) @@
114
    /**
115
     * @return boolean
116
     */
117
    public function validateMin()
118
    {
119
        $min = $this->min();
120
        if (!$min) {
121
            return true;
122
        }
123
        $valid = ($this->val() >= $min);
124
        if ($valid === false) {
125
            $this->validator()->error('The number is smaller than the minimum value', 'min');
126
        }
127
        return $valid;
128
    }
129
130
    /**
131
     * @return boolean
@@ 133-144 (lines=12) @@
130
    /**
131
     * @return boolean
132
     */
133
    public function validateMax()
134
    {
135
        $max = $this->max();
136
        if (!$max) {
137
            return true;
138
        }
139
        $valid = ($this->val() <= $max);
140
        if ($valid === false) {
141
            $this->validator()->error('The number is bigger than the maximum value', 'max');
142
        }
143
        return $valid;
144
    }
145
146
    /**
147
     * Get the SQL type (Storage format)