Skip to content

Commit be73f06

Browse files
authored
method "set": sets the value to modules.json
Instead of saving the set-value only to the compiled file, the set-method saves the value to the modules .json file and calls optimize to persist the data to the cache-file.
1 parent 42ae55e commit be73f06

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/Repositories/LocalRepository.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,22 +131,17 @@ public function set($property, $value)
131131
{
132132
list($slug, $key) = explode('::', $property);
133133

134-
$cachePath = $this->getCachePath();
135-
$cache = $this->getCache();
136-
$module = $this->where('slug', $slug);
134+
$module = $this->getManifest($slug);
137135

138136
if (isset($module[$key])) {
139137
unset($module[$key]);
140138
}
141-
142139
$module[$key] = $value;
143140

144-
$module = collect([$module['basename'] => $module]);
145-
146-
$merged = $cache->merge($module);
147-
$content = json_encode($merged->all(), JSON_PRETTY_PRINT);
141+
$this->files->put($this->getManifestPath($slug), json_encode($module, JSON_PRETTY_PRINT));
148142

149-
return $this->files->put($cachePath, $content);
143+
return $this->optimize();
144+
150145
}
151146

152147
/**

0 commit comments

Comments
 (0)