Code Duplication    Length = 18-18 lines in 2 locations

src/Anshar/Http/Uri.php 1 location

@@ 607-624 (lines=18) @@
604
     * @return mixed[]              An array with named keys containing the component parts of the supplied
605
     *                              authority
606
     */
607
    private function explodeAuthority($authority)
608
    {
609
        $reg_start      = '/^';
610
        $user_info_part = '(?:(?\'user_info\'.+)@)?';
611
        $host_part      = '(?\'host\'\[.+\]|.[^:]+)';
612
        $port_part      = '(?::(?\'port\'[0-9]+))?';
613
        $reg_end        = '/';
614
615
        $authority_syntax = $reg_start . $user_info_part . $host_part . $port_part . $reg_end;
616
617
        preg_match($authority_syntax, $authority, $authority_parts);
618
619
        if (isset($authority_parts["port"])) {
620
            $authority_parts["port"] = (int) $authority_parts["port"];
621
        }
622
623
        return $authority_parts;
624
    }
625
626
    /**
627
     * Sanitizes the URI component array by removing redundant key/value pairs

src/Anshar/Http/UriParts/Authority.php 1 location

@@ 138-155 (lines=18) @@
135
     * @return mixed[]              An array with named keys containing the component parts of the supplied
136
     *                              authority
137
     */
138
    protected function explodeAuthority($authority)
139
    {
140
        $reg_start      = '/^';
141
        $user_info_part = '(?:(?\'user_info\'.+)@)?';
142
        $host_part      = '(?\'host\'\[.+\]|.[^:]+)';
143
        $port_part      = '(?::(?\'port\'[0-9]+))?';
144
        $reg_end        = '/';
145
146
        $authority_syntax = $reg_start . $user_info_part . $host_part . $port_part . $reg_end;
147
148
        preg_match($authority_syntax, $authority, $authority_parts);
149
150
        if (isset($authority_parts["port"])) {
151
            $authority_parts["port"] = (int) $authority_parts["port"];
152
        }
153
154
        return $authority_parts;
155
    }
156
}
157