Code Duplication    Length = 11-14 lines in 2 locations

PHPDaemon/Utils/Binary.php 1 location

@@ 70-80 (lines=11) @@
67
     * @param  boolean $l Little endian? Default is false
68
     * @return integer
69
     */
70
    public static function bytes2int($str, $l = false)
71
    {
72
        if ($l) {
73
            $str = strrev($str);
74
        }
75
        $dec = 0;
76
        $len = mb_orig_strlen($str);
77
        for ($i = 0; $i < $len; ++$i) {
78
            $dec += ord(mb_orig_substr($str, $i, 1)) * pow(0x100, $len - $i - 1);
79
        }
80
        return $dec;
81
    }
82
83
    /**

PHPDaemon/Clients/PostgreSQL/Connection.php 1 location

@@ 180-193 (lines=14) @@
177
     * @param  boolean $l Optional. Little endian. Default value - true.
178
     * @return integer      Resulting integer
179
     */
180
    public function bytes2int($str, $l = true)
181
    {
182
        if ($l) {
183
            $str = strrev($str);
184
        }
185
186
        $dec = 0;
187
        $len = mb_orig_strlen($str);
188
189
        for ($i = 0; $i < $len; ++$i) {
190
            $dec += ord(mb_orig_substr($str, $i, 1)) * pow(0x100, $len - $i - 1);
191
        }
192
193
        return $dec;
194
    }
195
196
    /**