__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?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\DependencyInjection\Attribute;
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\TypedReference;
use Symfony\Contracts\Service\Attribute\SubscribedService;
use Symfony\Contracts\Service\ServiceSubscriberInterface;
/**
* Autowires a service locator based on a tag name or an explicit list of key => service-type pairs.
*/
#[\Attribute(\Attribute::TARGET_PARAMETER)]
class AutowireLocator extends Autowire
{
/**
* @see ServiceSubscriberInterface::getSubscribedServices()
*
* @param string|array<string|SubscribedService> $services An explicit list of services or a tag name
* @param string|string[] $exclude A service or a list of services to exclude
*/
public function __construct(
string|array $services,
?string $indexAttribute = null,
?string $defaultIndexMethod = null,
?string $defaultPriorityMethod = null,
string|array $exclude = [],
bool $excludeSelf = true,
) {
if (\is_string($services)) {
parent::__construct(new ServiceLocatorArgument(new TaggedIteratorArgument($services, $indexAttribute, $defaultIndexMethod, true, $defaultPriorityMethod, (array) $exclude, $excludeSelf)));
return;
}
$references = [];
foreach ($services as $key => $type) {
$attributes = [];
if ($type instanceof Autowire) {
$references[$key] = $type;
continue;
}
if ($type instanceof SubscribedService) {
$key = $type->key ?? $key;
$attributes = $type->attributes;
$type = ($type->nullable ? '?' : '').($type->type ?? throw new InvalidArgumentException(sprintf('When "%s" is used, a type must be set.', SubscribedService::class)));
}
if (!\is_string($type) || !preg_match('/(?(DEFINE)(?<cn>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+))(?(DEFINE)(?<fqcn>(?&cn)(?:\\\\(?&cn))*+))^\??(?&fqcn)(?:(?:\|(?&fqcn))*+|(?:&(?&fqcn))*+)$/', $type)) {
throw new InvalidArgumentException(sprintf('"%s" is not a PHP type for key "%s".', \is_string($type) ? $type : get_debug_type($type), $key));
}
$optionalBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
if ('?' === $type[0]) {
$type = substr($type, 1);
$optionalBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
}
if (\is_int($name = $key)) {
$key = $type;
$name = null;
}
$references[$key] = new TypedReference($type, $type, $optionalBehavior, $name, $attributes);
}
parent::__construct(new ServiceLocatorArgument($references));
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| AsAlias.php | File | 704 B | 0644 |
|
| AsDecorator.php | File | 622 B | 0644 |
|
| AsTaggedItem.php | File | 654 B | 0644 |
|
| Autoconfigure.php | File | 965 B | 0644 |
|
| AutoconfigureTag.php | File | 735 B | 0644 |
|
| Autowire.php | File | 3.31 KB | 0644 |
|
| AutowireCallable.php | File | 1.84 KB | 0644 |
|
| AutowireDecorated.php | File | 370 B | 0644 |
|
| AutowireIterator.php | File | 1.03 KB | 0644 |
|
| AutowireLocator.php | File | 3.26 KB | 0644 |
|
| AutowireServiceClosure.php | File | 733 B | 0644 |
|
| Exclude.php | File | 487 B | 0644 |
|
| MapDecorated.php | File | 596 B | 0644 |
|
| TaggedIterator.php | File | 824 B | 0644 |
|
| TaggedLocator.php | File | 822 B | 0644 |
|
| Target.php | File | 2.2 KB | 0644 |
|
| When.php | File | 661 B | 0644 |
|