/** * Prepare the prc file. * * @return Prc The file that can be used to be saved/downloaded */ private function preparePRC() { if ($this->source === false) { throw new Exception('No data set'); } if ($this->prc !== false) { return $this->prc; } $data = $this->source; $len = strlen($data); $settings = new Settings($this->optional); $rec = new RecordFactory($settings); $dataRecords = $rec->createRecords($data); $nRecords = sizeof($dataRecords); $mobiHeader = new PalmRecord($settings, $dataRecords, $nRecords, $len, sizeof($this->images)); array_unshift($dataRecords, $mobiHeader); $dataRecords = array_merge($dataRecords, $this->images); $dataRecords[] = $rec->createFLISRecord(); $dataRecords[] = $rec->createFCISRecord($len); $dataRecords[] = $rec->createEOFRecord(); $this->prc = new Prc($settings, $dataRecords); return $this->prc; }