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

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