Torrent::encode_array PHP 메소드

encode_array() 개인적인 정적인 메소드

Encode torrent dictionary or list
private static encode_array ( $array ) : string
리턴 string encoded dictionary or list
    private static function encode_array($array)
    {
        if (self::is_list($array)) {
            $return = 'l';
            foreach ($array as $value) {
                $return .= self::encode($value);
            }
        } else {
            ksort($array, SORT_STRING);
            $return = 'd';
            foreach ($array as $key => $value) {
                $return .= self::encode(strval($key)) . self::encode($value);
            }
        }
        return $return . 'e';
    }