class ServicesResetter
Resets provided services.
@author Alexander M. Turek <me@derrabus.de> @author Nicolas Grekas <p@tchwork.com>
@final since Symfony 7.2
Hierarchy
- class \Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter implements \Symfony\Contracts\Service\ResetInterface
Expanded class hierarchy of ServicesResetter
File
-
vendor/
symfony/ http-kernel/ DependencyInjection/ ServicesResetter.php, line 26
Namespace
Symfony\Component\HttpKernel\DependencyInjectionView source
class ServicesResetter implements ResetInterface {
/**
* @param \Traversable<string, object> $resettableServices
* @param array<string, string|string[]> $resetMethods
*/
public function __construct(\Traversable $resettableServices, array $resetMethods) {
}
public function reset() : void {
foreach ($this->resettableServices as $id => $service) {
if ($service instanceof LazyObjectInterface && !$service->isLazyObjectInitialized(true)) {
continue;
}
if ($service instanceof LazyLoadingInterface && !$service->isProxyInitialized()) {
continue;
}
foreach ((array) $this->resetMethods[$id] as $resetMethod) {
if ('?' === $resetMethod[0] && !method_exists($service, $resetMethod = substr($resetMethod, 1))) {
continue;
}
$service->{$resetMethod}();
}
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
ServicesResetter::reset | public | function | Overrides ResetInterface::reset | |
ServicesResetter::__construct | public | function |