| @@ 23-44 (lines=22) @@ | ||
| 20 | /** |
|
| 21 | * @author Tobias Nyholm <[email protected]> |
|
| 22 | */ |
|
| 23 | class DoctrineBridgeFactory |
|
| 24 | { |
|
| 25 | /** |
|
| 26 | * @param CacheItemPoolInterface $pool |
|
| 27 | * @param array $config |
|
| 28 | * @param array $tags |
|
| 29 | * |
|
| 30 | * @return DoctrineCacheBridge |
|
| 31 | */ |
|
| 32 | public static function get(CacheItemPoolInterface $pool, array $config, array $tags) |
|
| 33 | { |
|
| 34 | if ($config['use_tagging']) { |
|
| 35 | $pool = new FixedTaggingCachePool(TaggablePSR6PoolAdapter::makeTaggable($pool), $tags); |
|
| 36 | } |
|
| 37 | ||
| 38 | if (!empty($config['prefix'])) { |
|
| 39 | $pool = new PrefixedCachePool($pool, $config['prefix']); |
|
| 40 | } |
|
| 41 | ||
| 42 | return new DoctrineCacheBridge($pool); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| @@ 23-44 (lines=22) @@ | ||
| 20 | /** |
|
| 21 | * @author Tobias Nyholm <[email protected]> |
|
| 22 | */ |
|
| 23 | class RouterFactory |
|
| 24 | { |
|
| 25 | /** |
|
| 26 | * @param CacheItemPoolInterface $pool |
|
| 27 | * @param RouterInterface $router |
|
| 28 | * @param array $config |
|
| 29 | * |
|
| 30 | * @return CachingRouter |
|
| 31 | */ |
|
| 32 | public static function get(CacheItemPoolInterface $pool, RouterInterface $router, array $config) |
|
| 33 | { |
|
| 34 | if ($config['use_tagging']) { |
|
| 35 | $pool = TaggablePSR6PoolAdapter::makeTaggable($pool); |
|
| 36 | } |
|
| 37 | ||
| 38 | if (!empty($config['prefix'])) { |
|
| 39 | $pool = new PrefixedCachePool($pool, $config['prefix']); |
|
| 40 | } |
|
| 41 | ||
| 42 | return new CachingRouter($pool, $router, $config); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| @@ 23-43 (lines=21) @@ | ||
| 20 | /** |
|
| 21 | * @author Tobias Nyholm <[email protected]> |
|
| 22 | */ |
|
| 23 | class ValidationFactory |
|
| 24 | { |
|
| 25 | /** |
|
| 26 | * @param CacheItemPoolInterface $pool |
|
| 27 | * @param array $config |
|
| 28 | * |
|
| 29 | * @return SymfonyValidatorBridge |
|
| 30 | */ |
|
| 31 | public static function get(CacheItemPoolInterface $pool, array $config) |
|
| 32 | { |
|
| 33 | if ($config['use_tagging']) { |
|
| 34 | $pool = new FixedTaggingCachePool(TaggablePSR6PoolAdapter::makeTaggable($pool), ['validation']); |
|
| 35 | } |
|
| 36 | ||
| 37 | if (!empty($config['prefix'])) { |
|
| 38 | $pool = new PrefixedCachePool($pool, $config['prefix']); |
|
| 39 | } |
|
| 40 | ||
| 41 | return new SymfonyValidatorBridge($pool); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||