Beispiel #1
0
 /**
  * Reads all the names from the given stream.
  *
  * @param StreamInterface $stream The stream to read from.
  * @return string[]
  */
 private function readNames(StreamInterface $stream)
 {
     $names = array();
     foreach ($this->nameRecord as $record) {
         // When there is no language code, we can't read the record name:
         if ($record->getLanguageCode() === null) {
             continue;
         }
         $stringOffset = $this->baseOffset + $this->stringOffset + $record->getOffset();
         $stream->setPosition($stringOffset);
         if ($record->getPlatformID() == 3) {
             $name = $stream->readStringBytes($record->getLength(), 'UTF-16BE', 'UTF-8');
         } else {
             $name = $stream->readStringBytes($record->getLength(), 'MacRoman', 'UTF-8');
         }
         $names[$record->getNameID()][$record->getLanguageCode()] = $name;
     }
     return $names;
 }