matomo
/
app
/
vendor
/
prefixed
/
symfony
/
http-kernel
/
DependencyInjection
/
ServicesResetter.php
AddAnnotatedClassesToCachePass.php
1 year ago
ConfigurableExtension.php
2 years ago
ControllerArgumentValueResolverPass.php
2 years ago
Extension.php
2 years ago
FragmentRendererPass.php
1 year ago
LazyLoadingFragmentHandler.php
1 year ago
LoggerPass.php
1 year ago
MergeExtensionConfigurationPass.php
2 years ago
RegisterControllerArgumentLocatorsPass.php
1 year ago
RegisterLocaleAwareServicesPass.php
2 years ago
RemoveEmptyControllerArgumentLocatorsPass.php
1 year ago
ResettableServicePass.php
1 year ago
ServicesResetter.php
2 years ago
ServicesResetter.php
47 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | namespace Matomo\Dependencies\Symfony\Component\HttpKernel\DependencyInjection; |
| 12 | |
| 13 | use Matomo\Dependencies\Symfony\Contracts\Service\ResetInterface; |
| 14 | /** |
| 15 | * Resets provided services. |
| 16 | * |
| 17 | * @author Alexander M. Turek <me@derrabus.de> |
| 18 | * @author Nicolas Grekas <p@tchwork.com> |
| 19 | * |
| 20 | * @internal |
| 21 | */ |
| 22 | class ServicesResetter implements ResetInterface |
| 23 | { |
| 24 | private $resettableServices; |
| 25 | private $resetMethods; |
| 26 | /** |
| 27 | * @param \Traversable<string, object> $resettableServices |
| 28 | * @param array<string, string|string[]> $resetMethods |
| 29 | */ |
| 30 | public function __construct(\Traversable $resettableServices, array $resetMethods) |
| 31 | { |
| 32 | $this->resettableServices = $resettableServices; |
| 33 | $this->resetMethods = $resetMethods; |
| 34 | } |
| 35 | public function reset() |
| 36 | { |
| 37 | foreach ($this->resettableServices as $id => $service) { |
| 38 | foreach ((array) $this->resetMethods[$id] as $resetMethod) { |
| 39 | if ('?' === $resetMethod[0] && !method_exists($service, $resetMethod = substr($resetMethod, 1))) { |
| 40 | continue; |
| 41 | } |
| 42 | $service->{$resetMethod}(); |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 |