/**
  * Decode a bencode encoded string
  *
  * @param  string $source The string to decode.
  * @param  string $decodeType Flag used to indicate whether the decoded
  *   value should be returned as an object or an array.
  * @return mixed   Returns the appropriate data type for the decoded data.
  * @throws RuntimeException
  */
 public static function decode($source, $decodeType = Bencode::TYPE_ARRAY)
 {
     if (!is_string($source)) {
         throw new RuntimeException("Argument expected to be a string; Got " . gettype($source));
     }
     $decoder = new self($source, $decodeType);
     $decoded = $decoder->doDecode();
     if ($decoder->offset != $decoder->sourceLength) {
         throw new RuntimeException("Found multiple entities outside list or dict definitions");
     }
     return $decoded;
 }