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

@@ 113-130 (lines=18) @@
110
     * @return mixed[]              An array with named keys containing the component parts of the supplied
111
     *                              authority
112
     */
113
    private function explodeAuthority($authority)
114
    {
115
        $reg_start      = '/^';
116
        $user_info_part = '(?:(?\'user_info\'.+)@)?';
117
        $host_part      = '(?\'host\'\[.+\]|.[^:]+)';
118
        $port_part      = '(?::(?\'port\'[0-9]+))?';
119
        $reg_end        = '/';
120
121
        $authority_syntax = $reg_start . $user_info_part . $host_part . $port_part . $reg_end;
122
123
        preg_match($authority_syntax, $authority, $authority_parts);
124
125
        if (isset($authority_parts["port"])) {
126
            $authority_parts["port"] = (int) $authority_parts["port"];
127
        }
128
129
        return $authority_parts;
130
    }
131
}
132