Exemple #1
0
 /**
  * @param ByteBuffer $bb
  * @param string $ident
  * @return bool
  * @throws \ArgumentException
  */
 protected static function __has_identifier($bb, $ident)
 {
     if (strlen($ident) != self::FILE_IDENTIFIER_LENGTH) {
         throw new \ArgumentException("FlatBuffers: file identifier must be length " . self::FILE_IDENTIFIER_LENGTH);
     }
     for ($i = 0; $i < 4; $i++) {
         if ($ident[$i] != $bb->get($bb->getPosition() + self::SIZEOF_INT + $i)) {
             return false;
         }
     }
     return true;
 }