decode(); // Calculate remaining data based on decoder position $position = $decoder->getPosition(); $remainder = substr($data, $position); return [$value, $remainder]; } /** * Decode complete CBOR data. * * @param string $data Binary CBOR data * @return mixed Decoded value */ public static function decode(string $data): mixed { $decoder = new Decoder($data); return $decoder->decode(); } /** * Decode all CBOR items from data. * * @param string $data Binary CBOR data * @return array All decoded values */ public static function decodeAll(string $data): array { $decoder = new Decoder($data); $items = []; while ($decoder->hasMore()) { $items[] = $decoder->decode(); } return $items; } }