| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | protected function readData():void{ |
||
| 21 | |||
| 22 | // get the root info block of the AARC file (4+4+4+4 = 16 bytes) |
||
| 23 | $rootInfo = \unpack( |
||
| 24 | 'a4ArchiveType/LVersion/LBlockcount/LIndex', |
||
| 25 | \fread($this->fh, $this->blocktable[$this->header['RootInfoIndex']]['Size']) |
||
| 26 | ); |
||
| 27 | |||
| 28 | if($rootInfo['ArchiveType'] !== "\x43\x52\x41\x41"){ // CRAA |
||
| 29 | throw new WSDBException('invalid AARC'); |
||
| 30 | } |
||
| 31 | |||
| 32 | // get the root data info block |
||
| 33 | $blockInfo = $this->blocktable[$rootInfo['Index']]; |
||
| 34 | |||
| 35 | \fseek($this->fh, $blockInfo['Offset']); |
||
| 36 | |||
| 37 | // read the data block info (4+20+8 = 32 bytes) |
||
| 38 | for($i = 0; $i < $rootInfo['Blockcount']; $i++){ |
||
| 39 | $data = unpack('LIndex/a20Hash/QSizeUncompressed', \fread($this->fh, 32)); |
||
| 40 | $hash = \bin2hex($data['Hash']); |
||
| 41 | unset($data['Hash']); |
||
| 42 | $this->data[$hash] = $data; |
||
| 43 | } |
||
| 48 |