public function compile($name) { $source = $this->getLoader()->getSource($name); $cacheKey = $this->getCacheFilename($name); $phpStr = ''; try { $this->partials->exchangeArray([new FileResource($this->getLoader()->getCacheKey($name))]); $phpStr = LightnCandy::compile($source, $this->options); } catch (\Exception $e) { throw new LoaderException($e->getMessage()); } $this->cache->write($cacheKey, '<?php // ' . $name . PHP_EOL . $phpStr, $this->partials->getArrayCopy()); return $phpStr; }
public function testLoad() { $cache = new Filesystem(__DIR__, true); $time = date('c'); $cache->write(__DIR__ . '/test', '<?php return "' . $time . '";', [new FileResource(__DIR__ . '/../Fixtures/Resources/views/main.hbs')]); $this->assertSame($time, $cache->load(__DIR__ . '/test')); }