/** * {@inheritDoc} */ public function addFile(StreamBase $tokenStream, ReflectionFile $file) { if (self::$level <= 1) { // Clean the old cache only for main classes, allow to bypass cleaning for hierarchy $this->clearTokenCache(); } return parent::addFile($tokenStream, $file); }
/** * Adds a file to the backend storage. * * @param \TokenReflection\Stream\StreamBase $tokenStream Token stream * @param \TokenReflection\ReflectionFile $file File reflection object * @return \TokenReflection\Broker\Backend\Memory */ public function addFile(TokenReflection\Stream\StreamBase $tokenStream, TokenReflection\ReflectionFile $file) { if ($this->cacheTokenStreams) { $this->fileCache[$file->getName()] = $cacheFile = tempnam(sys_get_temp_dir(), 'trc'); file_put_contents($cacheFile, serialize($tokenStream)); } parent::addFile($tokenStream, $file); return $this; }