@@ -95,8 +95,10 @@ public function load($key, callable $generator = null)
9595 $ this ->storage ->remove ($ storageKey );
9696 throw $ e ;
9797 }
98+
9899 $ this ->save ($ key , $ data , $ dependencies );
99100 }
101+
100102 return $ data ;
101103 }
102104
@@ -109,6 +111,7 @@ public function bulkLoad(array $keys, callable $generator = null): array
109111 if (count ($ keys ) === 0 ) {
110112 return [];
111113 }
114+
112115 foreach ($ keys as $ key ) {
113116 if (!is_scalar ($ key )) {
114117 throw new Nette \InvalidArgumentException ('Only scalar keys are allowed in bulkLoad() ' );
@@ -127,6 +130,7 @@ public function bulkLoad(array $keys, callable $generator = null): array
127130 : null
128131 );
129132 }
133+
130134 return $ result ;
131135 }
132136
@@ -144,6 +148,7 @@ public function bulkLoad(array $keys, callable $generator = null): array
144148 $ result [$ key ] = null ;
145149 }
146150 }
151+
147152 return $ result ;
148153 }
149154
@@ -187,6 +192,7 @@ public function save($key, $data, array $dependencies = null)
187192 } else {
188193 $ this ->storage ->write ($ key , $ data , $ dependencies );
189194 }
195+
190196 return $ data ;
191197 }
192198 }
@@ -214,6 +220,7 @@ private function completeDependencies(?array $dp): array
214220 foreach (array_unique ((array ) $ dp [self ::FILES ]) as $ item ) {
215221 $ dp [self ::CALLBACKS ][] = [[self ::class, 'checkFile ' ], $ item , @filemtime ($ item ) ?: null ]; // @ - stat may fail
216222 }
223+
217224 unset($ dp [self ::FILES ]);
218225 }
219226
@@ -227,12 +234,14 @@ private function completeDependencies(?array $dp): array
227234 foreach (array_unique ((array ) $ dp [self ::CONSTS ]) as $ item ) {
228235 $ dp [self ::CALLBACKS ][] = [[self ::class, 'checkConst ' ], $ item , constant ($ item )];
229236 }
237+
230238 unset($ dp [self ::CONSTS ]);
231239 }
232240
233241 if (!is_array ($ dp )) {
234242 $ dp = [];
235243 }
244+
236245 return $ dp ;
237246 }
238247
@@ -260,6 +269,7 @@ public function clean(array $conditions = null): void
260269 if (isset ($ conditions [self ::TAGS ])) {
261270 $ conditions [self ::TAGS ] = array_values ((array ) $ conditions [self ::TAGS ]);
262271 }
272+
263273 $ this ->storage ->clean ($ conditions );
264274 }
265275
@@ -274,6 +284,7 @@ public function call(callable $function)
274284 if (is_array ($ function ) && is_object ($ function [0 ])) {
275285 $ key [0 ][0 ] = get_class ($ function [0 ]);
276286 }
287+
277288 return $ this ->load ($ key , function () use ($ function , $ key ) {
278289 return $ function (...array_slice ($ key , 1 ));
279290 });
@@ -290,6 +301,7 @@ public function wrap(callable $function, array $dependencies = null): \Closure
290301 if (is_array ($ function ) && is_object ($ function [0 ])) {
291302 $ key [0 ][0 ] = get_class ($ function [0 ]);
292303 }
304+
293305 return $ this ->load ($ key , function (&$ deps ) use ($ function , $ args , $ dependencies ) {
294306 $ deps = $ dependencies ;
295307 return $ function (...$ args );
@@ -308,6 +320,7 @@ public function capture($key): ?OutputHelper
308320 if ($ data === null ) {
309321 return new OutputHelper ($ this , $ key );
310322 }
323+
311324 echo $ data ;
312325 return null ;
313326 }
@@ -344,6 +357,7 @@ public static function checkCallbacks(array $callbacks): bool
344357 return false ;
345358 }
346359 }
360+
347361 return true ;
348362 }
349363
0 commit comments