Code Duplication    Length = 12-12 lines in 2 locations

src/Validator.php 2 locations

@@ 151-162 (lines=12) @@
148
        return in_array(Str::upper($value), $this->getStateAbbreviations($country));
149
    }
150
151
    protected function getStateAbbreviations($country = null)
152
    {
153
        $x = [];
154
        foreach ($this->states as $c => $states) {
155
            if ($country === null || $c === $country) {
156
                foreach ($states as $state) {
157
                    $x[] = $state['abbr'];
158
                }
159
            }
160
        }
161
        return $x;
162
    }
163
164
    protected function getStateNames($country = null)
165
    {
@@ 164-175 (lines=12) @@
161
        return $x;
162
    }
163
164
    protected function getStateNames($country = null)
165
    {
166
        $x = [];
167
        foreach ($this->states as $c => $states) {
168
            if ($country === null || $c === $country) {
169
                foreach ($states as $state) {
170
                    $x[] = $state['name'];
171
                }
172
            }
173
        }
174
        return $x;
175
    }
176
}
177