Code Duplication    Length = 8-8 lines in 7 locations

lib/Support/Validator.php 7 locations

@@ 71-78 (lines=8) @@
68
     * Checks the minimum length requirement.
69
     * @throws ValidationException
70
     */
71
    public function checkMinimumLength()
72
    {
73
        if ($this->configuration->rules()->get(Plexity::RULE_LENGTH_MIN) > 0) {
74
            if (!$this->validateLengthMin()) {
75
                throw new ValidationException('The length does not meet the minimum length requirements.');
76
            }
77
        }
78
    }
79
80
    /**
81
     * Checks the minimum maximum length requirement.
@@ 84-91 (lines=8) @@
81
     * Checks the minimum maximum length requirement.
82
     * @throws ValidationException
83
     */
84
    public function checkMaximumLength()
85
    {
86
        if ($this->configuration->rules()->get(Plexity::RULE_LENGTH_MAX) > 0) {
87
            if (!$this->validateLengthMax()) {
88
                throw new ValidationException('The length exceeds the maximum length requirements.');
89
            }
90
        }
91
    }
92
93
    /**
94
     * Checks the lowercase character(s) requirement.
@@ 97-104 (lines=8) @@
94
     * Checks the lowercase character(s) requirement.
95
     * @throws ValidationException
96
     */
97
    public function checkLowerCase()
98
    {
99
        if ($this->configuration->rules()->get(Plexity::RULE_LOWER) > 0) {
100
            if (!$this->validateLowerCase()) {
101
                throw new ValidationException('The string failed to meet the lower case requirements.');
102
            }
103
        }
104
    }
105
106
    /**
107
     * Checks the upper case character(s) requirement.
@@ 110-117 (lines=8) @@
107
     * Checks the upper case character(s) requirement.
108
     * @throws ValidationException
109
     */
110
    public function checkUpperCase()
111
    {
112
        if ($this->configuration->rules()->get(Plexity::RULE_UPPER) > 0) {
113
            if (!$this->validateUpperCase()) {
114
                throw new ValidationException('The string failed to meet the upper case requirements.');
115
            }
116
        }
117
    }
118
119
    /**
120
     * Checks the numeric character(s) requirement.
@@ 123-130 (lines=8) @@
120
     * Checks the numeric character(s) requirement.
121
     * @throws ValidationException
122
     */
123
    public function checkNumericCharacters()
124
    {
125
        if ($this->configuration->rules()->get(Plexity::RULE_NUMERIC) > 0) {
126
            if (!$this->validateNumericCharacters()) {
127
                throw new ValidationException('The string failed to meet the numeric character requirements.');
128
            }
129
        }
130
    }
131
132
    /**
133
     * Checks the special character(s) requirement.
@@ 136-143 (lines=8) @@
133
     * Checks the special character(s) requirement.
134
     * @throws ValidationException
135
     */
136
    public function checkSpecialCharacters()
137
    {
138
        if ($this->configuration->rules()->get(Plexity::RULE_SPECIAL) > 0) {
139
            if (!$this->validateSpecialCharacters()) {
140
                throw new ValidationException('The string failed to meet the special character requirements.');
141
            }
142
        }
143
    }
144
145
    /**
146
     * Validates if a string is not in a array (password history database).
@@ 149-156 (lines=8) @@
146
     * Validates if a string is not in a array (password history database).
147
     * @throws ValidationException
148
     */
149
    public function checkNotIn()
150
    {
151
        if (count($this->configuration->rules()->get(Plexity::RULE_NOT_IN)) > 0) {
152
            if (!$this->validateNotIn()) {
153
                throw new ValidationException('The string exists in the list of disallowed values requirements.');
154
            }
155
        }
156
    }
157
158
    /**
159
     * Validates the upper case requirements.