src/Encoder.php
private function doEncode($data = null)
    {
        $data = is_null($data) ? $this->data : $data;

        if (is_array($data) && (isset ($data[0]) || empty ($data))) {
            return $this->encodeList($data);
        } elseif (is_array($data)) {
            return $this->encodeDict($data);
        } elseif (is_integer($data) || is_float($data)) {
            $data = sprintf("%.0f", round($data, 0));
            return $this->encodeInteger($data);
        } else {
            return $this->encodeString($data);
        }
    }
private function doEncode($data = null)
    {
        $data = is_null($data) ? $this->data : $data;

        if (is_array($data) && (isset ($data[0]) || empty ($data))) {
            return $this->encodeList($data);
        } elseif (is_array($data)) {
            return $this->encodeDict($data);
        } elseif (is_integer($data) || is_float($data)) {
            $data = sprintf("%.0f", round($data, 0));
            return $this->encodeInteger($data);
        } else {
            return $this->encodeString($data);
        }
    }
private function doEncode ( $ data = null ) { $ data = is_null ( $ data ) ? $ this -> data : $ data ; if ( is_array ( $ data ) && ( isset ( $ data [ 0 ] ) || empty ( $ data ) ) ) { return $ this -> encodeList ( $ data ) ; } elseif ( is_array ( $ data ) ) { return $ this -> encodeDict ( $ data ) ; } elseif ( is_integer ( $ data ) || is_float ( $ data ) ) { $ data = sprintf ( "%.0f" , round ( $ data , 0 ) ) ; return $ this -> encodeInteger ( $ data ) ; } else { return $ this -> encodeString ( $ data ) ; } }
Iterate over values and encode them

@param  mixed   $data The value to encode.
@return string  Returns the bencode encoded string.
Iterate over values and encode them