Does a decode from an array of bytes passed by reference.

@param array $bytes Byte array.
@return mixed Decoded value.
@throws CborException If the byte array is not valid.
970451
private static function recursiveDecode(&$bytes)
    {
        // Grab the first byte
        $first = array_shift($bytes);

        // Get the major type
        $major = $first & MajorType::BIT_MASK;
        $additional = $first & AdditionalType::BIT_MASK;

        switch($major)
        {
            case MajorType::POSITIVE_INT:
                return self::decodeIntValue($additional, $bytes);

            case MajorType::NEGATIVE_INT:
                $decoded = self::decodeIntValue($additional, $bytes);

                // Apply negative number logic
                $decoded += 1;
                $decoded *= -1;

                return $decoded;

            case MajorType::BYTE_STRING:
                return self::decodeByteString($additional, $bytes);

            case MajorType::UTF8_STRING:
                return self::decodeString($additional, $bytes);

            case MajorType::SEQUENCE:
                return self::decodeSequence($additional, $bytes);

            case MajorType::MAP:
                return self::decodeMap($additional, $bytes);

            case MajorType::SIMPLE_AND_FLOAT:
                return self::decodeSimple($additional, $bytes);

            default:
                return self::decodeTag($additional, $bytes);
        }
    }
344055
public static function decode($string)
    {
        if (!$string) {
            return new ArrayObject();
        }

        try {
            $array = unserialize($string);
        } catch (\Exception $e) {
            throw new PhpException("Serialize Error: " . $e->getMessage());
        }

        if (!is_array($array)) {
            $array = [];
        }

        return ArrayObject::make($array);
    }
1000962
public static function ord($char, &$bytes = null)
    {
        // Get the first byte from char
        $firstByte = substr($char, 0, 1);
        $firstByteCode = ord($firstByte);

        $bytes = 0;

        while ($firstByteCode >> 7 & 0x01) {
            $bytes++;
            $firstByteCode <<= 1;
        }

        if ($bytes === 0) {
            // 0b0xxxxxxx
            return ord($firstByte);
        }

        // Create a unicode ord
        $unicodeOrd = ((ord($firstByte) << ($bytes + 1)) & 0xFF) >> ($bytes + 1);

        for ($i = 1; $i < $bytes; $i++) {
            // Shift unicode byte to left on 6 position (0b10xxxxxx)
            $unicodeOrd <<= 6;
            $byte = ord(substr($char, $i, 1)) & 0b00111111;
            $unicodeOrd |= $byte;
        }

        return $unicodeOrd;
    }
1040607
public function bytes($bytes, $precision = 2)
    {
        $bytes = \round($bytes);
        $units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB'];
        foreach ($units as $unit) {
            if (\abs($bytes) < 1024 || $unit === \end($units)) {
                break;
            }
            $bytes = $bytes / 1024;
        }

        return \round($bytes, $precision) . ' ' . $unit;
    }
18143
function decodeBER($encoded)
    {
        if (is_object($encoded) && strtolower(get_class($encoded)) == 'file_asn1_element') {
            $encoded = $encoded->element;
        }

        $this->encoded = $encoded;
        // encapsulate in an array for BC with the old decodeBER
        return array($this->_decode_ber($encoded));
    }
7535
protected function skipbytes($bytes)
    {
        if ($this->comptype === Archive::COMPRESS_GZIP) {
            @gzseek($this->fh, $bytes, SEEK_CUR);
        } elseif ($this->comptype === Archive::COMPRESS_BZIP) {
            // there is no seek in bzip2, we simply read on
            // bzread allows to read a max of 8kb at once
            while($bytes) {
                $toread = min(8192, $bytes);
                @bzread($this->fh, $toread);
                $bytes -= $toread;
            }
        } else {
            @fseek($this->fh, $bytes, SEEK_CUR);
        }
    }
226350
public function fromBytes($bytes)
    {
        for ($i=0; $bytes >= 1024 && $i < 8; $i++) {
            $bytes /= 1024;
        }
        return round($bytes, 2) . $this->units[$i];
    }
1352163
@Override
	public T decode(byte[] bytes) throws IOException {
		if (bytes == null) {
			throw new IOException("byte array is null.");
		}
		CodedInputStream input = CodedInputStream.newInstance(bytes, 0, bytes.length);

		return readFrom(input);
	}
1282535
protected function readBinaryArray($length)
    {
        $ary = new CFArray();

      // first: read object refs
        if ($length != 0) {
            if (strlen($buff = substr($this->content, $this->pos, $length * $this->objectRefSize)) != $length * $this->objectRefSize) {
                throw IOException::readError("");
            }
            $this->pos += $length * $this->objectRefSize;

            $objects = self::unpackWithSize($this->objectRefSize, $buff);

          // now: read objects
            for ($i=0; $i<$length; ++$i) {
                $object = $this->readBinaryObjectAt($objects[$i+1]+1);
                $ary->add($object);
            }
        }

        return $ary;
    }
460294
public function readBytes(int $bytes): string
	{
		if ($this->connected() === false)
		{
			throw new \Exception('Not connected');
		}

		$response = fread($this->connection, $bytes);

		if ($response === false)
		{
			throw new \Exception('Nothing to read');
		}

		return $response;
	}
944788
private function parity($byte) {
		$parity = 0;
		for($i=7; $i>=0; $i--) {
			$parity ^= ($byte >> $i) & 1;
		}
		return (bool) $parity;
	}
1053977
public static function bytesToString($bytes) {
    $units = array_map('t', ['bytes', 'KB', 'MB', 'GB', 'TB']);

    while ($bytes > 1024) {
      $bytes /= 1024;
      array_shift($units);
    }
    return $bytes . ' ' . reset($units);
  }
221564
public Map<String, String> decode(byte[] bytes) throws DeserializationException {
        Map<String, String> map = new HashMap<String, String>();
        if (bytes == null || bytes.length == 0) {
            return map;
        }

        UnsafeByteArrayInputStream in = new UnsafeByteArrayInputStream(bytes);
        try {
            while (in.available() > 0) {
                String key = readString(in);
                String value = readString(in);
                map.put(key, value);
            }
            return map;
        } catch (IOException ex) {
            throw new DeserializationException(ex.getMessage(), ex);
        }
    }
204417
private function formatBytes($bytes)
    {
        if ($bytes === 0) {
            return 0;
        }

        $units = [ 'B', 'KB', 'MB', 'GB', 'TB' ];
        $base  = log($bytes, 1024);
        $floor = floor($base);
        $unit  = $units[$floor];
        $size  = round(pow(1024, ($base - $floor)), 2);

        $locale = localeconv();
        $size   = number_format($size, 2, $locale['decimal_point'], $locale['thousands_sep']);

        return rtrim($size, '.0').' '.$unit;
    }
1220548
private function decodeArray($array) {

        $return_value = array();

        foreach ( $array->data->value as $value ) {

            $return_value[] = $this->decodeValue($value);

        }

        return $return_value;

    }
544296
public function write(string $bytes): int
    {
        $isAcceptable = $this->predicate;
        if ($isAcceptable($bytes)) {
            return $this->outputStream->write($bytes);
        }

        return 0;
    }
97929
protected <T> T decode(byte[] bytes) {
    return bytes != null ? userSerializer.decode(bytes) : null;
  }