src/Encoder.php
public static function encode($data)
    {
        if (is_object($data)) {
            if (method_exists($data, "toArray")) {
                $data = $data->toArray();
            } else {
                $data = (array) $data;
            }
        }

        $encoder = new self($data);
        $encoded = $encoder->doEncode();

        return $encoded;
    }
public static function encode($data)
    {
        if (is_object($data)) {
            if (method_exists($data, "toArray")) {
                $data = $data->toArray();
            } else {
                $data = (array) $data;
            }
        }

        $encoder = new self($data);
        $encoded = $encoder->doEncode();

        return $encoded;
    }
public static function encode ( $ data ) { if ( is_object ( $ data ) ) { if ( method_exists ( $ data , "toArray" ) ) { $ data = $ data -> toArray ( ) ; } else { $ data = ( array ) $ data ; } } $ encoder = new self ( $ data ) ; $ encoded = $ encoder -> doEncode ( ) ; return $ encoded ; }
Encode a value into a bencode encoded string

@param  mixed   $data The value to encode.
@return string  Returns the bencode encoded string.
Encode a value into a bencode encoded string