src/CFPropertyList/CFBinaryPropertyList.php
protected function readBinaryDict($length)
    {
        $dict = new CFDictionary();

        // first: read keys
        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;
            $keys = self::unpackWithSize($this->objectRefSize, $buff);

            // second: read object refs
            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);

            // read real keys and objects
            for ($i=0; $i<$length; ++$i) {
                $key = $this->readBinaryObjectAt($keys[$i+1]+1);
                $object = $this->readBinaryObjectAt($objects[$i+1]+1);
                $dict->add($key->getValue(), $object);
            }
        }

        return $dict;
    }
protected function readBinaryDict($length)
    {
        $dict = new CFDictionary();

        // first: read keys
        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;
            $keys = self::unpackWithSize($this->objectRefSize, $buff);

            // second: read object refs
            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);

            // read real keys and objects
            for ($i=0; $i<$length; ++$i) {
                $key = $this->readBinaryObjectAt($keys[$i+1]+1);
                $object = $this->readBinaryObjectAt($objects[$i+1]+1);
                $dict->add($key->getValue(), $object);
            }
        }

        return $dict;
    }
protected function readBinaryDict ( $ length ) { $ dict = new CFDictionary ( ) ; // first: read keys 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 ; $ keys = self :: unpackWithSize ( $ this -> objectRefSize , $ buff ) ; // second: read object refs 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 ) ; // read real keys and objects for ( $ i = 0 ; $ i < $ length ; ++ $ i ) { $ key = $ this -> readBinaryObjectAt ( $ keys [ $ i + 1 ] + 1 ) ; $ object = $ this -> readBinaryObjectAt ( $ objects [ $ i + 1 ] + 1 ) ; $ dict -> add ( $ key -> getValue ( ) , $ object ) ; } } return $ dict ; }
Read a dictionary value, including contained objects
@param integer $length The number of contained objects
@return CFDictionary The dictionary value, including the objects
@throws IOException if read error occurs
Read a dictionary value including contained objects