static function get($name) { if (isset(self::$cache[$name])) { return self::$cache[$name]; } $file = new File(self::getTempFile($name)); if ($file->exist && strtotime('now') - $file->create_date < strtotime('now') + self::$live) { $context = $file->getContext(); self::$cache[$name] = $context; return $context; } return false; }
public function testSimpleGetters() { $this->assertEquals('dir/file.css', $this->object->getFilePath()); $this->assertSame($this->context, $this->object->getContext()); $this->assertEquals('Magento_Module', $this->object->getModule()); }
/** * @param $path * @param $data * @return int */ public static function put($path, $data) { if (!is_dir(dirname($path))) { self::mkdir(dirname($path)); } $return = file_put_contents($path, $data, null, File::getContext()); @chmod($path, self::$defaultMode); return $return; }