src/Encoder.php
private function encodeDict(array $data = null)
    {
        $data = is_null($data) ? $this->data : $data;
        ksort($data); // bencode spec requires dicts to be sorted alphabetically

        $dict = "";
        foreach ($data as $key => $value) {
            $dict .= $this->encodeString($key) . $this->doEncode($value);
        }

        return "d{$dict}e";
    }
private function encodeDict(array $data = null)
    {
        $data = is_null($data) ? $this->data : $data;
        ksort($data); // bencode spec requires dicts to be sorted alphabetically

        $dict = "";
        foreach ($data as $key => $value) {
            $dict .= $this->encodeString($key) . $this->doEncode($value);
        }

        return "d{$dict}e";
    }
private function encodeDict ( array $ data = null ) { $ data = is_null ( $ data ) ? $ this -> data : $ data ; ksort ( $ data ) ; // bencode spec requires dicts to be sorted alphabetically $ dict = "" ; foreach ( $ data as $ key => $ value ) { $ dict .= $ this -> encodeString ( $ key ) . $ this -> doEncode ( $ value ) ; } return "d{$dict}e" ; }
Encode a dictionary

@param  array   $data The dictionary to be encoded.
@return string  Returns the bencode encoded dictionary.
Encode a dictionary