Code Duplication    Length = 4-4 lines in 3 locations

src/Parser/UriParser.php 3 locations

@@ 141-144 (lines=4) @@
138
     */
139
    public function validateIP($ipAddress = null)
140
    {
141
        if ($ipAddress === null) {
142
            $parsed = parse_url($this->uri);
143
            $ipAddress = isset($parsed['host']) ? $parsed['host'] : $parsed['path'];
144
        }
145
        return (
146
            filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ||
147
            filter_var(trim($ipAddress, '[]'), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)
@@ 161-164 (lines=4) @@
158
     */
159
    public function validateHost($host = null)
160
    {
161
        if ($host === null) {
162
            $parsed = parse_url($this->uri);
163
            $host = isset($parsed['host']) ? $parsed['host'] : $parsed['path'];
164
        }
165
        return (
166
            preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $host) //valid chars check
167
            && preg_match("/^.{1,253}$/", $host) //overall length check
@@ 181-184 (lines=4) @@
178
     */
179
    public function validateScheme($scheme = null)
180
    {
181
        if ($scheme === null) {
182
            $parsed = parse_url($this->uri);
183
            $scheme = isset($parsed['host']) ? $parsed['host'] : $parsed['path'];
184
        }
185
        return in_array($scheme, $this->schemes);
186
    }
187