-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathResourceCheckerConfigCacheFactory.php
More file actions
39 lines (34 loc) · 985 Bytes
/
ResourceCheckerConfigCacheFactory.php
File metadata and controls
39 lines (34 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config;
/**
* A ConfigCacheFactory implementation that validates the
* cache with an arbitrary set of ResourceCheckers.
*
* @author Matthias Pigulla <mp@webfactory.de>
*/
class ResourceCheckerConfigCacheFactory implements ConfigCacheFactoryInterface
{
/**
* @param iterable<int, ResourceCheckerInterface> $resourceCheckers
*/
public function __construct(
private iterable $resourceCheckers = [],
) {
}
public function cache(string $file, callable $callable): ConfigCacheInterface
{
$cache = new ResourceCheckerConfigCache($file, $this->resourceCheckers);
if (!$cache->isFresh()) {
$callable($cache);
}
return $cache;
}
}