| Conditions | 4 |
| Paths | 3 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | protected function loadSource(string $sourceId, bool $fromCache = true): string |
||
| 39 | { |
||
| 40 | if (! isset($this->sources[$sourceId])) { |
||
| 41 | throw new RuntimeError("Source `{$sourceId}` doesn't exist"); |
||
| 42 | } |
||
| 43 | |||
| 44 | $cachePath = $this->tempDir.'/'.$sourceId.'.rdfa'; |
||
| 45 | |||
| 46 | if ($fromCache && file_exists($cachePath)) { |
||
| 47 | return file_get_contents($cachePath); |
||
| 48 | } |
||
| 49 | |||
| 50 | $rdfa = file_get_contents($this->sources[$sourceId]); |
||
| 51 | |||
| 52 | file_put_contents($cachePath, $rdfa); |
||
| 53 | |||
| 54 | return $rdfa; |
||
| 55 | } |
||
| 56 | } |
||
| 57 |