コード例 #1
0
ファイル: Box.php プロジェクト: rtdean93/therock
 /**
  * Returns the box raw data.
  *
  * @return string
  */
 public function __toString($data = "")
 {
   if ($this->isContainer())
     foreach ($this->getBoxes() as $name => $boxes)
       foreach ($boxes as $box)
         $data .= $box;
   $size = strlen($data) + 8;
   if ($size > 0xffffffff)
     $size += 8;
   if (strlen($this->_type) > 4)
     $size += 16;
   return ($size > 0xffffffff ?
            Transform::toUInt32BE(1) : Transform::toUInt32BE($size)) .
     (strlen($this->_type) > 4 ? "uuid" : $this->_type) .
     ($size > 0xffffffff ? Transform::toInt64BE($size) : "") . 
     (strlen($this->_type) > 4 ? Transform::toGUID($this->_type) : "") . $data;
 }