Update website
This commit is contained in:
parent
bb4b0f9be8
commit
011b183e28
4263 changed files with 3014 additions and 720369 deletions
|
@ -1,41 +0,0 @@
|
|||
<?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\Argument;
|
||||
|
||||
/**
|
||||
* Represents an abstract service argument, which have to be set by a compiler pass or a DI extension.
|
||||
*/
|
||||
final class AbstractArgument
|
||||
{
|
||||
private $text;
|
||||
private $context;
|
||||
|
||||
public function __construct(string $text = '')
|
||||
{
|
||||
$this->text = trim($text, '. ');
|
||||
}
|
||||
|
||||
public function setContext(string $context): void
|
||||
{
|
||||
$this->context = $context.' is abstract'.('' === $this->text ? '' : ': ');
|
||||
}
|
||||
|
||||
public function getText(): string
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
public function getTextWithContext(): string
|
||||
{
|
||||
return $this->context.$this->text.'.';
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?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\Argument;
|
||||
|
||||
/**
|
||||
* Represents a complex argument containing nested values.
|
||||
*
|
||||
* @author Titouan Galopin <galopintitouan@gmail.com>
|
||||
*/
|
||||
interface ArgumentInterface
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValues();
|
||||
|
||||
public function setValues(array $values);
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
<?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\Argument;
|
||||
|
||||
/**
|
||||
* @author Guilhem Niot <guilhem.niot@gmail.com>
|
||||
*/
|
||||
final class BoundArgument implements ArgumentInterface
|
||||
{
|
||||
public const SERVICE_BINDING = 0;
|
||||
public const DEFAULTS_BINDING = 1;
|
||||
public const INSTANCEOF_BINDING = 2;
|
||||
|
||||
private static $sequence = 0;
|
||||
|
||||
private $value;
|
||||
private $identifier;
|
||||
private $used;
|
||||
private $type;
|
||||
private $file;
|
||||
|
||||
public function __construct($value, bool $trackUsage = true, int $type = 0, string $file = null)
|
||||
{
|
||||
$this->value = $value;
|
||||
if ($trackUsage) {
|
||||
$this->identifier = ++self::$sequence;
|
||||
} else {
|
||||
$this->used = true;
|
||||
}
|
||||
$this->type = $type;
|
||||
$this->file = $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getValues(): array
|
||||
{
|
||||
return [$this->value, $this->identifier, $this->used, $this->type, $this->file];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setValues(array $values)
|
||||
{
|
||||
if (5 === \count($values)) {
|
||||
[$this->value, $this->identifier, $this->used, $this->type, $this->file] = $values;
|
||||
} else {
|
||||
[$this->value, $this->identifier, $this->used] = $values;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
<?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\Argument;
|
||||
|
||||
/**
|
||||
* Represents a collection of values to lazily iterate over.
|
||||
*
|
||||
* @author Titouan Galopin <galopintitouan@gmail.com>
|
||||
*/
|
||||
class IteratorArgument implements ArgumentInterface
|
||||
{
|
||||
use ReferenceSetArgumentTrait;
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<?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\Argument;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* @author Titouan Galopin <galopintitouan@gmail.com>
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
trait ReferenceSetArgumentTrait
|
||||
{
|
||||
private $values;
|
||||
|
||||
/**
|
||||
* @param Reference[] $values
|
||||
*/
|
||||
public function __construct(array $values)
|
||||
{
|
||||
$this->setValues($values);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Reference[]
|
||||
*/
|
||||
public function getValues()
|
||||
{
|
||||
return $this->values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Reference[] $values The service references to put in the set
|
||||
*/
|
||||
public function setValues(array $values)
|
||||
{
|
||||
foreach ($values as $k => $v) {
|
||||
if (null !== $v && !$v instanceof Reference) {
|
||||
throw new InvalidArgumentException(sprintf('A "%s" must hold only Reference instances, "%s" given.', __CLASS__, get_debug_type($v)));
|
||||
}
|
||||
}
|
||||
|
||||
$this->values = $values;
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
<?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\Argument;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class RewindableGenerator implements \IteratorAggregate, \Countable
|
||||
{
|
||||
private $generator;
|
||||
private $count;
|
||||
|
||||
/**
|
||||
* @param int|callable $count
|
||||
*/
|
||||
public function __construct(callable $generator, $count)
|
||||
{
|
||||
$this->generator = $generator;
|
||||
$this->count = $count;
|
||||
}
|
||||
|
||||
public function getIterator(): \Traversable
|
||||
{
|
||||
$g = $this->generator;
|
||||
|
||||
return $g();
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
if (\is_callable($count = $this->count)) {
|
||||
$this->count = $count();
|
||||
}
|
||||
|
||||
return $this->count;
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
<?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\Argument;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Represents a service wrapped in a memoizing closure.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ServiceClosureArgument implements ArgumentInterface
|
||||
{
|
||||
private $values;
|
||||
|
||||
public function __construct(Reference $reference)
|
||||
{
|
||||
$this->values = [$reference];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getValues()
|
||||
{
|
||||
return $this->values;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setValues(array $values)
|
||||
{
|
||||
if ([0] !== array_keys($values) || !($values[0] instanceof Reference || null === $values[0])) {
|
||||
throw new InvalidArgumentException('A ServiceClosureArgument must hold one and only one Reference.');
|
||||
}
|
||||
|
||||
$this->values = $values;
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
<?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\Argument;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ServiceLocator as BaseServiceLocator;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ServiceLocator extends BaseServiceLocator
|
||||
{
|
||||
private $factory;
|
||||
private $serviceMap;
|
||||
private $serviceTypes;
|
||||
|
||||
public function __construct(\Closure $factory, array $serviceMap, array $serviceTypes = null)
|
||||
{
|
||||
$this->factory = $factory;
|
||||
$this->serviceMap = $serviceMap;
|
||||
$this->serviceTypes = $serviceTypes;
|
||||
parent::__construct($serviceMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get(string $id)
|
||||
{
|
||||
return isset($this->serviceMap[$id]) ? ($this->factory)(...$this->serviceMap[$id]) : parent::get($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProvidedServices(): array
|
||||
{
|
||||
return $this->serviceTypes ?? $this->serviceTypes = array_map(function () { return '?'; }, $this->serviceMap);
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
<?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\Argument;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Represents a closure acting as a service locator.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ServiceLocatorArgument implements ArgumentInterface
|
||||
{
|
||||
use ReferenceSetArgumentTrait;
|
||||
|
||||
private $taggedIteratorArgument;
|
||||
|
||||
/**
|
||||
* @param Reference[]|TaggedIteratorArgument $values
|
||||
*/
|
||||
public function __construct($values = [])
|
||||
{
|
||||
if ($values instanceof TaggedIteratorArgument) {
|
||||
$this->taggedIteratorArgument = $values;
|
||||
$this->values = [];
|
||||
} else {
|
||||
$this->setValues($values);
|
||||
}
|
||||
}
|
||||
|
||||
public function getTaggedIteratorArgument(): ?TaggedIteratorArgument
|
||||
{
|
||||
return $this->taggedIteratorArgument;
|
||||
}
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
<?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\Argument;
|
||||
|
||||
/**
|
||||
* Represents a collection of services found by tag name to lazily iterate over.
|
||||
*
|
||||
* @author Roland Franssen <franssen.roland@gmail.com>
|
||||
*/
|
||||
class TaggedIteratorArgument extends IteratorArgument
|
||||
{
|
||||
private $tag;
|
||||
private $indexAttribute;
|
||||
private $defaultIndexMethod;
|
||||
private $defaultPriorityMethod;
|
||||
private $needsIndexes = false;
|
||||
|
||||
/**
|
||||
* @param string $tag The name of the tag identifying the target services
|
||||
* @param string|null $indexAttribute The name of the attribute that defines the key referencing each service in the tagged collection
|
||||
* @param string|null $defaultIndexMethod The static method that should be called to get each service's key when their tag doesn't define the previous attribute
|
||||
* @param bool $needsIndexes Whether indexes are required and should be generated when computing the map
|
||||
* @param string|null $defaultPriorityMethod The static method that should be called to get each service's priority when their tag doesn't define the "priority" attribute
|
||||
*/
|
||||
public function __construct(string $tag, string $indexAttribute = null, string $defaultIndexMethod = null, bool $needsIndexes = false, string $defaultPriorityMethod = null)
|
||||
{
|
||||
parent::__construct([]);
|
||||
|
||||
if (null === $indexAttribute && $needsIndexes) {
|
||||
$indexAttribute = preg_match('/[^.]++$/', $tag, $m) ? $m[0] : $tag;
|
||||
}
|
||||
|
||||
$this->tag = $tag;
|
||||
$this->indexAttribute = $indexAttribute;
|
||||
$this->defaultIndexMethod = $defaultIndexMethod ?: ($indexAttribute ? 'getDefault'.str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $indexAttribute))).'Name' : null);
|
||||
$this->needsIndexes = $needsIndexes;
|
||||
$this->defaultPriorityMethod = $defaultPriorityMethod ?: ($indexAttribute ? 'getDefault'.str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $indexAttribute))).'Priority' : null);
|
||||
}
|
||||
|
||||
public function getTag()
|
||||
{
|
||||
return $this->tag;
|
||||
}
|
||||
|
||||
public function getIndexAttribute(): ?string
|
||||
{
|
||||
return $this->indexAttribute;
|
||||
}
|
||||
|
||||
public function getDefaultIndexMethod(): ?string
|
||||
{
|
||||
return $this->defaultIndexMethod;
|
||||
}
|
||||
|
||||
public function needsIndexes(): bool
|
||||
{
|
||||
return $this->needsIndexes;
|
||||
}
|
||||
|
||||
public function getDefaultPriorityMethod(): ?string
|
||||
{
|
||||
return $this->defaultPriorityMethod;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue