/usr/share/php/TheSeer/Autoload/Cache.php is in phpab 1.24.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | <?php
namespace TheSeer\Autoload {
class Cache {
/**
* @var CacheEntry[]
*/
private $loadedEntries = array();
/**
* @var CacheEntry[]
*/
private $usedEntries = array();
public function __construct(array $initialEntries) {
$this->loadedEntries = $initialEntries;
}
/**
* @param SourceFile $file
*
* @return bool
*/
public function hasResult(SourceFile $file) {
$pathname = $file->getPathname();
if (!isset($this->loadedEntries[$pathname])) {
return false;
}
return $this->loadedEntries[$pathname]->getTimestamp() === $file->getMTime();
}
public function getResult(SourceFile $file) {
if (!$this->hasResult($file)) {
throw new CacheException('Entry not found');
}
$pathname = $file->getPathname();
$entry = $this->loadedEntries[$pathname];
$this->usedEntries[$pathname] = $entry;
return $entry->getResult();
}
public function addResult(SourceFile $file, ParseResult $result) {
$this->usedEntries[$file->getPathname()] = new CacheEntry($file->getMTime(), $result);
}
public function persist($fname) {
if (file_exists($fname)) {
unlink($fname);
}
file_put_contents($fname, serialize($this->usedEntries));
}
}
class CacheException extends \Exception {
}
}
|