mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Chill\MainBundle\Security\Resolver;
|
|
|
|
final class CenterResolverDispatcher implements CenterResolverDispatcherInterface
|
|
{
|
|
/**
|
|
* @var CenterResolverInterface[]
|
|
*/
|
|
private iterable $resolvers;
|
|
|
|
public function __construct(iterable $resolvers = [])
|
|
{
|
|
$this->resolvers = $resolvers;
|
|
}
|
|
|
|
public function resolveCenter($entity, ?array $options = [])
|
|
{
|
|
trigger_deprecation(
|
|
'ChillMainBundle',
|
|
'dev-master',
|
|
'
|
|
Use the service CenterResolverManager through the interface CenterResolverManagerInterface.
|
|
The new method "CenterResolverManagerInterface::resolveCenters(): array" is available and the typing
|
|
has been improved in order to avoid mixing types.
|
|
'
|
|
);
|
|
|
|
foreach ($this->resolvers as $resolver) {
|
|
if ($resolver->supports($entity, $options)) {
|
|
return $resolver->resolveCenter($entity, $options);
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|