PhpAmqpLib\Wire\GenericContent::load_properties PHP Method

load_properties() public method

Given the raw bytes containing the property-flags and property-list from a content-frame-header, parse and insert into a dictionary stored in this object as an attribute named 'properties'.
public load_properties ( PhpAmqpLib\Wire\AMQPReader $reader )
$reader PhpAmqpLib\Wire\AMQPReader NOTE: do not mutate $reader
    public function load_properties(AMQPReader $reader)
    {
        // Read 16-bit shorts until we get one with a low bit set to zero
        $flags = array();
        while (true) {
            $flag_bits = $reader->read_short();
            $flags[] = $flag_bits;
            if (($flag_bits & 1) === 0) {
                break;
            }
        }
        $shift = 0;
        $data = array();
        foreach ($this->prop_types as $key => $proptype) {
            if ($shift === 0) {
                if (!$flags) {
                    break;
                }
                $flag_bits = array_shift($flags);
                $shift = 15;
            }
            if ($flag_bits & 1 << $shift) {
                $data[$key] = $reader->{'read_' . $proptype}();
            }
            $shift -= 1;
        }
        $this->properties = $data;
        return $this;
    }