Code Duplication    Length = 16-16 lines in 2 locations

src/CheckMaxLength.php 1 location

@@ 27-42 (lines=16) @@
24
 *
25
 * @author Michael Herold <[email protected]>
26
 */
27
class CheckMaxLength extends Check {
28
29
    protected $maxLength;
30
31
    public function __construct($maxLength) {
32
        $this->maxLength = $maxLength;
33
        $this->check = $this;
34
        $this->id = 'max_length';
35
        $this->message = 'The maximal length of ' . $maxLength . ' is exceeded.';
36
    }
37
38
    public function __invoke($value) {
39
        return strlen($value) <= $this->maxLength;
40
    }
41
42
}
43

src/CheckMinLength.php 1 location

@@ 27-42 (lines=16) @@
24
 *
25
 * @author Michael Herold <[email protected]>
26
 */
27
class CheckMinLength extends Check {
28
29
    protected $minLength;
30
31
    public function __construct($minLength) {
32
        $this->minLength = $minLength;
33
        $this->check = $this;
34
        $this->id = 'min_length';
35
        $this->message = 'The minimal length of ' . $minLength . ' is not reached.';
36
    }
37
38
    public function __invoke($value) {
39
        return strlen($value) >= $this->minLength;
40
    }
41
42
}
43