@@ -95,8 +95,10 @@ public function load($key, callable $generator = null)
95
95
$ this ->storage ->remove ($ storageKey );
96
96
throw $ e ;
97
97
}
98
+
98
99
$ this ->save ($ key , $ data , $ dependencies );
99
100
}
101
+
100
102
return $ data ;
101
103
}
102
104
@@ -109,6 +111,7 @@ public function bulkLoad(array $keys, callable $generator = null): array
109
111
if (count ($ keys ) === 0 ) {
110
112
return [];
111
113
}
114
+
112
115
foreach ($ keys as $ key ) {
113
116
if (!is_scalar ($ key )) {
114
117
throw new Nette \InvalidArgumentException ('Only scalar keys are allowed in bulkLoad() ' );
@@ -127,6 +130,7 @@ public function bulkLoad(array $keys, callable $generator = null): array
127
130
: null
128
131
);
129
132
}
133
+
130
134
return $ result ;
131
135
}
132
136
@@ -144,6 +148,7 @@ public function bulkLoad(array $keys, callable $generator = null): array
144
148
$ result [$ key ] = null ;
145
149
}
146
150
}
151
+
147
152
return $ result ;
148
153
}
149
154
@@ -187,6 +192,7 @@ public function save($key, $data, array $dependencies = null)
187
192
} else {
188
193
$ this ->storage ->write ($ key , $ data , $ dependencies );
189
194
}
195
+
190
196
return $ data ;
191
197
}
192
198
}
@@ -214,6 +220,7 @@ private function completeDependencies(?array $dp): array
214
220
foreach (array_unique ((array ) $ dp [self ::FILES ]) as $ item ) {
215
221
$ dp [self ::CALLBACKS ][] = [[self ::class, 'checkFile ' ], $ item , @filemtime ($ item ) ?: null ]; // @ - stat may fail
216
222
}
223
+
217
224
unset($ dp [self ::FILES ]);
218
225
}
219
226
@@ -227,12 +234,14 @@ private function completeDependencies(?array $dp): array
227
234
foreach (array_unique ((array ) $ dp [self ::CONSTS ]) as $ item ) {
228
235
$ dp [self ::CALLBACKS ][] = [[self ::class, 'checkConst ' ], $ item , constant ($ item )];
229
236
}
237
+
230
238
unset($ dp [self ::CONSTS ]);
231
239
}
232
240
233
241
if (!is_array ($ dp )) {
234
242
$ dp = [];
235
243
}
244
+
236
245
return $ dp ;
237
246
}
238
247
@@ -260,6 +269,7 @@ public function clean(array $conditions = null): void
260
269
if (isset ($ conditions [self ::TAGS ])) {
261
270
$ conditions [self ::TAGS ] = array_values ((array ) $ conditions [self ::TAGS ]);
262
271
}
272
+
263
273
$ this ->storage ->clean ($ conditions );
264
274
}
265
275
@@ -274,6 +284,7 @@ public function call(callable $function)
274
284
if (is_array ($ function ) && is_object ($ function [0 ])) {
275
285
$ key [0 ][0 ] = get_class ($ function [0 ]);
276
286
}
287
+
277
288
return $ this ->load ($ key , function () use ($ function , $ key ) {
278
289
return $ function (...array_slice ($ key , 1 ));
279
290
});
@@ -290,6 +301,7 @@ public function wrap(callable $function, array $dependencies = null): \Closure
290
301
if (is_array ($ function ) && is_object ($ function [0 ])) {
291
302
$ key [0 ][0 ] = get_class ($ function [0 ]);
292
303
}
304
+
293
305
return $ this ->load ($ key , function (&$ deps ) use ($ function , $ args , $ dependencies ) {
294
306
$ deps = $ dependencies ;
295
307
return $ function (...$ args );
@@ -308,6 +320,7 @@ public function capture($key): ?OutputHelper
308
320
if ($ data === null ) {
309
321
return new OutputHelper ($ this , $ key );
310
322
}
323
+
311
324
echo $ data ;
312
325
return null ;
313
326
}
@@ -344,6 +357,7 @@ public static function checkCallbacks(array $callbacks): bool
344
357
return false ;
345
358
}
346
359
}
360
+
347
361
return true ;
348
362
}
349
363
0 commit comments