prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
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\CssSelector\Tests\Node;
use Symfony\Component\CssSelector\Node\At... | [Element[*][attribute $= 'value']]"],
[new AttributeNode(new ElementNode(), 'namespace', 'attribute', '$=', 'value'), "Attribute[Element[*][namespace|attribute $= 'value']]"],
];
}
public static function getSpecificityValueTest | return [
[new AttributeNode(new ElementNode(), null, 'attribute', 'exists', null), 'Attribute[Element[*][attribute]]'],
[new AttributeNode(new ElementNode(), null, 'attribute', '$=', 'value'), "Attribute | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Node/AttributeNodeTest.php",
"language": "php",
"file_size": 1442,
"cut_index": 524,
"middle_length": 229
} |
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\CssSelector\Tests\Node;
use Symfony\Component\CssSelector\Node\ClassNo... | , 'Class[Element[*].class]'],
];
}
public static function getSpecificityValueTestData()
{
return [
[new ClassNode(new ElementNode(), 'class'), 10],
[new ClassNode(new ElementNode(null, 'element'), 'class | [new ClassNode(new ElementNode(), 'class') | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Node/ClassNodeTest.php",
"language": "php",
"file_size": 865,
"cut_index": 529,
"middle_length": 52
} |
/*
* 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\CssSelector\Tests\Node;
use Symfony\Component\CssSelector\N... | entNode()), 'CombinedSelector[Element[*] <followed> Element[*]]'],
];
}
public static function getSpecificityValueTestData()
{
return [
[new CombinedSelectorNode(new ElementNode(), '>', new ElementNode()), 0],
| tData()
{
return [
[new CombinedSelectorNode(new ElementNode(), '>', new ElementNode()), 'CombinedSelector[Element[*] > Element[*]]'],
[new CombinedSelectorNode(new ElementNode(), ' ', new Elem | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Node/CombinedSelectorNodeTest.php",
"language": "php",
"file_size": 1234,
"cut_index": 518,
"middle_length": 229
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Node;
use Symfony\Component\CssSelector\Node\ElementNode;
class ElementNodeTest extends AbstractNodeTestCase
{
public static... | amespace|element]'],
];
}
public static function getSpecificityValueTestData()
{
return [
[new ElementNode(), 0],
[new ElementNode(null, 'element'), 1],
[new ElementNode('namespace', 'element | [new ElementNode('namespace', 'element'), 'Element[n | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Node/ElementNodeTest.php",
"language": "php",
"file_size": 941,
"cut_index": 606,
"middle_length": 52
} |
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\CssSelector\Tests\Node;
use Symfony\Component\CssSelector\Node\ElementNode;
us... | n(Token::TYPE_IDENTIFIER, 'value', 0),
]), "Function[Element[*]:function(['value'])]"],
[new FunctionNode(new ElementNode(), 'function', [
new Token(Token::TYPE_STRING, 'value1', 0),
new Token(Token:: | ConversionTestData()
{
return [
[new FunctionNode(new ElementNode(), 'function'), 'Function[Element[*]:function()]'],
[new FunctionNode(new ElementNode(), 'function', [
new Toke | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Node/FunctionNodeTest.php",
"language": "php",
"file_size": 1656,
"cut_index": 537,
"middle_length": 229
} |
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\CssSelector\Tests\Node;
use Symfony\Component\CssSelector\Node\ElementNode;
... | ent[*]#id]'],
];
}
public static function getSpecificityValueTestData()
{
return [
[new HashNode(new ElementNode(), 'id'), 100],
[new HashNode(new ElementNode(null, 'id'), 'class'), 101],
];
| [new HashNode(new ElementNode(), 'id'), 'Hash[Elem | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Node/HashNodeTest.php",
"language": "php",
"file_size": 847,
"cut_index": 535,
"middle_length": 52
} |
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\CssSelector\Tests\Node;
use Symfony\Component\CssSelector\Node\ClassNode;
use ... | Node(new ElementNode(), 'id'),
]), 'Matching[Element[*]:is(Class[Element[*].class], Hash[Element[*]#id])]'],
];
}
public static function getSpecificityValueTestData()
{
return [
[new MatchingNode(new Ele | deTestCase
{
public static function getToStringConversionTestData()
{
return [
[new MatchingNode(new ElementNode(), [
new ClassNode(new ElementNode(), 'class'),
new Hash | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Node/MatchingNodeTest.php",
"language": "php",
"file_size": 1609,
"cut_index": 537,
"middle_length": 229
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Node;
use Symfony\Component\CssSelector\Node\ClassNode;
use Symfony\Component\CssSelector\Node\ElementNode;
use Symfony\Component... | ode(), 'class')), 'Negation[Element[*]:not(Class[Element[*].class])]'],
];
}
public static function getSpecificityValueTestData()
{
return [
[new NegationNode(new ElementNode(), new ClassNode(new ElementNode(), 'cla | onNode(new ElementNode(), new ClassNode(new ElementN | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Node/NegationNodeTest.php",
"language": "php",
"file_size": 945,
"cut_index": 606,
"middle_length": 52
} |
/*
* 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\CssSelector\Tests\Node;
use Symfony\Component\CssSelector\... | [new PseudoNode(new ElementNode(), 'pseudo'), 'Pseudo[Element[*]:pseudo]'],
];
}
public static function getSpecificityValueTestData()
{
return [
[new PseudoNode(new ElementNode(), 'pseudo'), 10],
] | return [
| {
"filepath": "src/Symfony/Component/CssSelector/Tests/Node/PseudoNodeTest.php",
"language": "php",
"file_size": 797,
"cut_index": 517,
"middle_length": 14
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Node;
use Symfony\Component\CssSelector\Node\ElementNode;
use Symfony\Component\CssSelector\Node\SelectorNode;
class SelectorNod... | pseudo'), 'Selector[Element[*]::pseudo]'],
];
}
public static function getSpecificityValueTestData()
{
return [
[new SelectorNode(new ElementNode()), 0],
[new SelectorNode(new ElementNode(), 'pseudo'), 1 | ,
[new SelectorNode(new ElementNode(), ' | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Node/SelectorNodeTest.php",
"language": "php",
"file_size": 936,
"cut_index": 606,
"middle_length": 52
} |
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\CssSelector\Tests\Node;
use Symfony\Component\CssSelector\Node\Cl... | ew ElementNode(), 'class'),
new HashNode(new ElementNode(), 'id'),
]), 'SpecificityAdjustment[Element[*]:where(Class[Element[*].class], Hash[Element[*]#id])]'],
];
}
public static function getSpecificityValueTes | tyAdjustmentNodeTest extends AbstractNodeTestCase
{
public static function getToStringConversionTestData()
{
return [
[new SpecificityAdjustmentNode(new ElementNode(), [
new ClassNode(n | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Node/SpecificityAdjustmentNodeTest.php",
"language": "php",
"file_size": 1480,
"cut_index": 524,
"middle_length": 229
} |
ge.
*
* (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\CssSelector\Tests\Node;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
u... | + 123, $specificity->plus(new Specificity(1, 2, 3))->getValue());
}
public static function getValueTestData()
{
return [
[new Specificity(0, 0, 0), 0],
[new Specificity(0, 0, 2), 2],
[new Specificit | lue)
{
$this->assertEquals($value, $specificity->getValue());
}
#[DataProvider('getValueTestData')]
public function testPlusValue(Specificity $specificity, $value)
{
$this->assertEquals($value | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Node/SpecificityTest.php",
"language": "php",
"file_size": 2150,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache;
use Psr\Cache\CacheItemInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cache\Exception\LogicException;
use Symfony\Contracts\Cache\ItemInterface;
/**
* @author Nicolas Gr... | e $innerItem = null;
protected ?string $poolHash = null;
protected bool $isTaggable = false;
public function getKey(): string
{
return $this->key;
}
public function get(): mixed
{
return $this->value;
}
| $key;
protected mixed $value = null;
protected bool $isHit = false;
protected float|int|null $expiry = null;
protected array $metadata = [];
protected array $newMetadata = [];
protected ?CacheItemInterfac | {
"filepath": "src/Symfony/Component/Cache/CacheItem.php",
"language": "php",
"file_size": 6255,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache;
use Psr\Log\LoggerInterface;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Cache\ItemInterface;
/**
* LockRegistry is used internally by existing adapters to protect against cache stampede.
*
* It does so by wrapping the compu... | alingCallback;
/**
* The number of items in this list controls the max number of concurrent processes.
*/
private static array $files = [
__DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'AbstractAdapter.php',
| Grekas <p@tchwork.com>
*/
final class LockRegistry
{
private static array $openedFiles = [];
private static ?array $lockedFiles = null;
private static \Exception $signalingException;
private static \Closure $sign | {
"filepath": "src/Symfony/Component/Cache/LockRegistry.php",
"language": "php",
"file_size": 8091,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache;
use Psr\Cache\CacheException as Psr6CacheException;
use Psr\Cache\CacheItemPoolInterface;
use Psr\SimpleCache\CacheException as SimpleCacheException;
use Psr\SimpleCache\CacheInterface;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfon... | heItemPrototype = null;
private static \Closure $packCacheItem;
public function __construct(CacheItemPoolInterface $pool)
{
$this->pool = $pool;
if (!$pool instanceof AdapterInterface) {
return;
}
$ | *
* @author Nicolas Grekas <p@tchwork.com>
*/
class Psr16Cache implements CacheInterface, PruneableInterface, ResettableInterface
{
use ProxyTrait;
private ?\Closure $createCacheItem = null;
private ?CacheItem $cac | {
"filepath": "src/Symfony/Component/Cache/Psr16Cache.php",
"language": "php",
"file_size": 7958,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache\Adapter;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cache\ResettableInterface;
use Symfony\Component\Cache... | Trait;
/**
* @internal
*/
protected const NS_SEPARATOR = ':';
private static bool $apcuSupported;
protected function __construct(string $namespace = '', int $defaultLifetime = 0)
{
if ('' !== $namespace) {
| r Nicolas Grekas <p@tchwork.com>
*/
abstract class AbstractAdapter implements AdapterInterface, CacheInterface, NamespacedPoolInterface, LoggerAwareInterface, ResettableInterface
{
use AbstractAdapterTrait;
use Contracts | {
"filepath": "src/Symfony/Component/Cache/Adapter/AbstractAdapter.php",
"language": "php",
"file_size": 8002,
"cut_index": 716,
"middle_length": 229
} |
xception;
use Symfony\Component\Cache\ResettableInterface;
use Symfony\Component\Cache\Traits\AbstractAdapterTrait;
use Symfony\Component\Cache\Traits\ContractsTrait;
use Symfony\Contracts\Cache\NamespacedPoolInterface;
use Symfony\Contracts\Cache\TagAwareCacheInterface;
/**
* Abstract for native TagAware adapters.
... | dapterInterface, NamespacedPoolInterface, LoggerAwareInterface, ResettableInterface
{
use AbstractAdapterTrait;
use ContractsTrait;
/**
* @internal
*/
protected const NS_SEPARATOR = ':';
private const TAGS_PREFIX = "\1tags\1 | te().
*
* @author Nicolas Grekas <p@tchwork.com>
* @author André Rømcke <andre.romcke+symfony@gmail.com>
*
* @internal
*/
abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterface, A | {
"filepath": "src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php",
"language": "php",
"file_size": 13786,
"cut_index": 921,
"middle_length": 229
} |
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\Cache\Adapter;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Compo... | e AdapterInterface extends CacheItemPoolInterface
{
public function getItem(mixed $key): CacheItem;
/**
* @return iterable<string, CacheItem>
*/
public function getItems(array $keys = []): iterable;
public function clear(string | uthor Kévin Dunglas <dunglas@gmail.com>
*/
interfac | {
"filepath": "src/Symfony/Component/Cache/Adapter/AdapterInterface.php",
"language": "php",
"file_size": 861,
"cut_index": 529,
"middle_length": 52
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Adapter;
use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\Exception\CacheException;
use Symfony\Component\Cache\Marshaller\Marshall... | throw new CacheException('APCu is not enabled.');
}
if ('cli' === \PHP_SAPI) {
ini_set('apc.use_request_time', 0);
}
parent::__construct($namespace, $defaultLifetime);
if (null !== $version) {
| tion __construct(
string $namespace = '',
int $defaultLifetime = 0,
?string $version = null,
private ?MarshallerInterface $marshaller = null,
) {
if (!static::isSupported()) {
| {
"filepath": "src/Symfony/Component/Cache/Adapter/ApcuAdapter.php",
"language": "php",
"file_size": 3259,
"cut_index": 614,
"middle_length": 229
} |
use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cache\ResettableInterface;
use Symfony\Component\VarExporter\DeepCloner;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Cache\NamespacedPoolInterface;
/**
* An in-memory cac... | ivate array $subPools = [];
private array $explicitExpiries = [];
private static \Closure $createCacheItem;
/**
* @param bool $storeSerialized Disabling serialization can lead to cache corruptions when storing mutable values but increase | pterInterface, CacheInterface, NamespacedPoolInterface, LoggerAwareInterface, ResettableInterface
{
use LoggerAwareTrait;
private array $values = [];
private array $tags = [];
private array $expiries = [];
pr | {
"filepath": "src/Symfony/Component/Cache/Adapter/ArrayAdapter.php",
"language": "php",
"file_size": 11930,
"cut_index": 921,
"middle_length": 229
} |
onent\Cache\Exception\BadMethodCallException;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\ResettableInterface;
use Symfony\Component\Cache\Traits\ContractsTrait;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contra... | e, ResettableInterface
{
use ContractsTrait;
private array $adapters = [];
private int $adapterCount;
private static \Closure $syncItem;
/**
* @param CacheItemPoolInterface[] $adapters The ordered list of adapters used to | its data store.
* They are saved and deleted in all adapters at once.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class ChainAdapter implements AdapterInterface, CacheInterface, NamespacedPoolInterface, PruneableInterfac | {
"filepath": "src/Symfony/Component/Cache/Adapter/ChainAdapter.php",
"language": "php",
"file_size": 9509,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache\Adapter;
use Couchbase\Bucket;
use Couchbase\Cluster;
use Couchbase\ClusterOptions;
use Couchbase\Collection;
use Couchbase\DocumentNotFoundException;
use Couchbase\UpsertOptions;
use Symfony\Component\Cache\Exception\CacheException;
use Symfony\Compo... | private Collection $connection,
string $namespace = '',
int $defaultLifetime = 0,
?MarshallerInterface $marshaller = null,
) {
if (!static::isSupported()) {
throw new CacheException('Couchbase >= 3.0.5 < 4.0. | e Cerezo Aranda <aj.cerezo@gmail.com>
*/
class CouchbaseCollectionAdapter extends AbstractAdapter
{
private const MAX_KEY_LENGTH = 250;
private MarshallerInterface $marshaller;
public function __construct(
| {
"filepath": "src/Symfony/Component/Cache/Adapter/CouchbaseCollectionAdapter.php",
"language": "php",
"file_size": 6175,
"cut_index": 716,
"middle_length": 229
} |
nager;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SQLitePlatf... | ponent\Cache\Marshaller\DefaultMarshaller;
use Symfony\Component\Cache\Marshaller\MarshallerInterface;
use Symfony\Component\Cache\PruneableInterface;
class DoctrineDbalAdapter extends AbstractAdapter implements PruneableInterface
{
private const MAX_ | e;
use Doctrine\DBAL\Schema\PrimaryKeyConstraint;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Tools\DsnParser;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Com | {
"filepath": "src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php",
"language": "php",
"file_size": 16949,
"cut_index": 921,
"middle_length": 229
} |
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\CssSelector\XPath\Extension;
use Symfony\Component\CssSelector\XPath\XPathExpr... | eturn [
' ' => $this->translateDescendant(...),
'>' => $this->translateChild(...),
'+' => $this->translateDirectAdjacent(...),
'~' => $this->translateIndirectAdjacent(...),
];
}
public functi | in/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class CombinationExtension extends AbstractExtension
{
public function getCombinationTranslators(): array
{
r | {
"filepath": "src/Symfony/Component/CssSelector/XPath/Extension/CombinationExtension.php",
"language": "php",
"file_size": 1871,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\CssSelector\XPath\Extension;
use Symfony\Component\CssSelector\Exception\ExpressionErrorException;
use Symfony\Component\CssSelector\Exception\SyntaxErrorException;
use Symfony\Component\CssSelector\Node\FunctionNode;
use Symfony\Component\CssSelector\Parse... | ension extends AbstractExtension
{
public function getFunctionTranslators(): array
{
return [
'nth-child' => $this->translateNthChild(...),
'nth-last-child' => $this->translateNthLastChild(...),
'nth-of-t | a port of the Python cssselect library,
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class FunctionExt | {
"filepath": "src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php",
"language": "php",
"file_size": 5165,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\CssSelector\XPath\Extension;
use Symfony\Component\CssSelector\Exception\ExpressionErrorException;
use Symfony\Component\CssSelector\Node\FunctionNode;
use Symfony\Component\CssSelector\XPath\Translator;
use Symfony\Component\CssSelector\XPath\XPathExpr;
/... | ->getExtension('node')
->setFlag(NodeExtension::ELEMENT_NAME_IN_LOWER_CASE, true)
->setFlag(NodeExtension::ATTRIBUTE_NAME_IN_LOWER_CASE, true);
}
public function getPseudoClassTranslators(): array
{
return | t.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class HtmlExtension extends AbstractExtension
{
public function __construct(Translator $translator)
{
$translator
| {
"filepath": "src/Symfony/Component/CssSelector/XPath/Extension/HtmlExtension.php",
"language": "php",
"file_size": 5809,
"cut_index": 716,
"middle_length": 229
} |
ge.
*
* (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\CssSelector\XPath\Extension;
use Symfony\Component\CssSelector\XPath\XPathExpr;
/**
* XPath expression... | ->translateRelationDescendant(...),
'>' => $this->translateRelationChild(...),
'+' => $this->translateRelationDirectAdjacent(...),
'~' => $this->translateRelationIndirectAdjacent(...),
];
}
public functi | anck Ranaivo-Harisoa <franckranaivo@gmail.com>
*
* @internal
*/
class RelationExtension extends AbstractExtension
{
public function getRelativeCombinationTranslators(): array
{
return [
' ' => $this | {
"filepath": "src/Symfony/Component/CssSelector/XPath/Extension/RelationExtension.php",
"language": "php",
"file_size": 2115,
"cut_index": 563,
"middle_length": 229
} |
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\CssSelector\Node;
/**
* Represents a "<selector>[<namespace>|<attribute> <ope... | ivate string $attribute,
private string $operator,
private ?string $value,
) {
}
public function getSelector(): NodeInterface
{
return $this->selector;
}
public function getNamespace(): ?string
{
| ois Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class AttributeNode extends AbstractNode
{
public function __construct(
private NodeInterface $selector,
private ?string $namespace,
pr | {
"filepath": "src/Symfony/Component/CssSelector/Node/AttributeNode.php",
"language": "php",
"file_size": 1874,
"cut_index": 537,
"middle_length": 229
} |
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\CssSelector\Node;
/**
* Represents a combined node.
*
* This c... | ctor,
) {
}
public function getSelector(): NodeInterface
{
return $this->selector;
}
public function getCombinator(): string
{
return $this->combinator;
}
public function getSubSelector(): NodeInterfac | olabs.com>
*
* @internal
*/
class CombinedSelectorNode extends AbstractNode
{
public function __construct(
private NodeInterface $selector,
private string $combinator,
private NodeInterface $subSele | {
"filepath": "src/Symfony/Component/CssSelector/Node/CombinedSelectorNode.php",
"language": "php",
"file_size": 1470,
"cut_index": 524,
"middle_length": 229
} |
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\CssSelector\Node;
use Symfony\Component\CssSelector\Parser\Token;
/**
* Repr... | __construct(
private NodeInterface $selector,
string $name,
private array $arguments = [],
) {
$this->name = strtolower($name);
}
public function getSelector(): NodeInterface
{
return $this->selector |
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class FunctionNode extends AbstractNode
{
private string $name;
/**
* @param Token[] $arguments
*/
public function | {
"filepath": "src/Symfony/Component/CssSelector/Node/FunctionNode.php",
"language": "php",
"file_size": 1692,
"cut_index": 537,
"middle_length": 229
} |
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\CssSelector\Node;
/**
* Represents a "<selector>:is(<subSelector... | public readonly array $arguments = [],
) {
}
public function getSpecificity(): Specificity
{
$argumentsSpecificity = array_reduce(
$this->arguments,
static fn ($c, $n) => 1 === $n->getSpecificity()->co | ir.hubert@gmail.com>
*
* @internal
*/
class MatchingNode extends AbstractNode
{
/**
* @param array<NodeInterface> $arguments
*/
public function __construct(
public readonly NodeInterface $selector,
| {
"filepath": "src/Symfony/Component/CssSelector/Node/MatchingNode.php",
"language": "php",
"file_size": 1502,
"cut_index": 524,
"middle_length": 229
} |
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\CssSelector\Node;
/**
* Represents a "<selector>:<identifier>" n... | {
$this->identifier = strtolower($identifier);
}
public function getSelector(): NodeInterface
{
return $this->selector;
}
public function getIdentifier(): string
{
return $this->identifier;
}
publi | ncois.simon@sensiolabs.com>
*
* @internal
*/
class PseudoNode extends AbstractNode
{
private string $identifier;
public function __construct(
private NodeInterface $selector,
string $identifier,
) | {
"filepath": "src/Symfony/Component/CssSelector/Node/PseudoNode.php",
"language": "php",
"file_size": 1297,
"cut_index": 524,
"middle_length": 229
} |
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\CssSelector\Node;
/**
* Represents a "<selector>(::|:)<pseudoEle... | lement = null,
) {
$this->pseudoElement = $pseudoElement ? strtolower($pseudoElement) : null;
}
public function getTree(): NodeInterface
{
return $this->tree;
}
public function getPseudoElement(): ?string
{
| <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class SelectorNode extends AbstractNode
{
private ?string $pseudoElement;
public function __construct(
private NodeInterface $tree,
?string $pseudoE | {
"filepath": "src/Symfony/Component/CssSelector/Node/SelectorNode.php",
"language": "php",
"file_size": 1401,
"cut_index": 524,
"middle_length": 229
} |
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\CssSelector\Node;
/**
* Represents a node specificity.
*
* This component i... | private int $a,
private int $b,
private int $c,
) {
}
public function plus(self $specificity): self
{
return new self($this->a + $specificity->a, $this->b + $specificity->b, $this->c + $specificity->c);
}
| Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class Specificity
{
public const A_FACTOR = 100;
public const B_FACTOR = 10;
public const C_FACTOR = 1;
public function __construct(
| {
"filepath": "src/Symfony/Component/CssSelector/Node/Specificity.php",
"language": "php",
"file_size": 1737,
"cut_index": 537,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\CssSelector\CssSelectorConverter;
u... | 'foo']", $converter->toXPath('h1#foo'));
$this->assertEquals("descendant-or-self::h1[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]", $converter->toXPath('h1.foo'));
$this->assertEquals('descendant-or-self::foo:h1 | verter();
$this->assertEquals('descendant-or-self::*', $converter->toXPath(''));
$this->assertEquals('descendant-or-self::h1', $converter->toXPath('h1'));
$this->assertEquals("descendant-or-self::h1[@id = | {
"filepath": "src/Symfony/Component/CssSelector/Tests/CssSelectorConverterTest.php",
"language": "php",
"file_size": 4652,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (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\CssSelector\Tests\Parser;
use PHPUnit\Framework\TestCase;
use Symfony\Component\CssSelector\Parser\Reade... |
}
public function testGetRemainingLength()
{
$reader = new Reader('hello');
$this->assertEquals(5, $reader->getRemainingLength());
$this->assignPosition($reader, 2);
$this->assertEquals(3, $reader->getRemainin | o');
$this->assertFalse($reader->isEOF());
$this->assignPosition($reader, 2);
$this->assertFalse($reader->isEOF());
$this->assignPosition($reader, 5);
$this->assertTrue($reader->isEOF()); | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/ReaderTest.php",
"language": "php",
"file_size": 2909,
"cut_index": 563,
"middle_length": 229
} |
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\CssSelector\Tests\Parser\Shortcut;
use PHPUnit\Framework\Attribut... | $selectors = $parser->parse($source);
$this->assertCount(1, $selectors);
/** @var SelectorNode $selector */
$selector = $selectors[0];
$this->assertEquals($representation, (string) $selector->getTree());
}
| is Simon <jeanfrancois.simon@sensiolabs.com>
*/
class ClassParserTest extends TestCase
{
#[DataProvider('getParseTestData')]
public function testParse($source, $representation)
{
$parser = new ClassParser();
| {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/Shortcut/ClassParserTest.php",
"language": "php",
"file_size": 1454,
"cut_index": 524,
"middle_length": 229
} |
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\CssSelector\Tests\Parser\Shortcut;
use PHPUnit\Framework\Attribut... | $selectors = $parser->parse($source);
$this->assertCount(1, $selectors);
/** @var SelectorNode $selector */
$selector = $selectors[0];
$this->assertEquals($representation, (string) $selector->getTree());
}
pub | s Simon <jeanfrancois.simon@sensiolabs.com>
*/
class HashParserTest extends TestCase
{
#[DataProvider('getParseTestData')]
public function testParse($source, $representation)
{
$parser = new HashParser();
| {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/Shortcut/HashParserTest.php",
"language": "php",
"file_size": 1416,
"cut_index": 524,
"middle_length": 229
} |
/*
* 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\CssSelector\XPath\Extension;
/**
* XPath expression transl... | getCombinationTranslators(): array
{
return [];
}
public function getFunctionTranslators(): array
{
return [];
}
public function getPseudoClassTranslators(): array
{
return [];
}
public functio | s Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
abstract class AbstractExtension implements ExtensionInterface
{
public function getNodeTranslators(): array
{
return [];
}
public function | {
"filepath": "src/Symfony/Component/CssSelector/XPath/Extension/AbstractExtension.php",
"language": "php",
"file_size": 1175,
"cut_index": 518,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\CssSelector\XPath\Extension;
use Symfony\Component\CssSelector\Node;
use Symfony\Component\CssSelector\XPath\Translator;
use Symfony\Component\CssSelector\XPath\XPathExpr;
/**
* XPath expression translator node extension.
*
* This component is a port of... | construct(
private int $flags = 0,
) {
}
/**
* @return $this
*/
public function setFlag(int $flag, bool $on): static
{
if ($on && !$this->hasFlag($flag)) {
$this->flags += $flag;
}
| l
*/
class NodeExtension extends AbstractExtension
{
public const ELEMENT_NAME_IN_LOWER_CASE = 1;
public const ATTRIBUTE_NAME_IN_LOWER_CASE = 2;
public const ATTRIBUTE_VALUE_IN_LOWER_CASE = 4;
public function __ | {
"filepath": "src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php",
"language": "php",
"file_size": 8019,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\XPath\Extension;
use Symfony\Component\CssSelector\Exception\ExpressionErrorException;
use Symfony\Component\CssSelector\XPath\XPathExpr;
/**
... | [
'root' => $this->translateRoot(...),
'scope' => $this->translateScopePseudo(...),
'first-child' => $this->translateFirstChild(...),
'last-child' => $this->translateLastChild(...),
'first-of-type | select.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class PseudoClassExtension extends AbstractExtension
{
public function getPseudoClassTranslators(): array
{
return | {
"filepath": "src/Symfony/Component/CssSelector/XPath/Extension/PseudoClassExtension.php",
"language": "php",
"file_size": 3530,
"cut_index": 614,
"middle_length": 229
} |
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\CssSelector\Node;
/**
* Represents a "<namespace>|<element>" nod... | function getNamespace(): ?string
{
return $this->namespace;
}
public function getElement(): ?string
{
return $this->element;
}
public function getSpecificity(): Specificity
{
return new Specificity(0, | ois.simon@sensiolabs.com>
*
* @internal
*/
class ElementNode extends AbstractNode
{
public function __construct(
private ?string $namespace = null,
private ?string $element = null,
) {
}
public | {
"filepath": "src/Symfony/Component/CssSelector/Node/ElementNode.php",
"language": "php",
"file_size": 1261,
"cut_index": 524,
"middle_length": 229
} |
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\CssSelector\Node;
/**
* Represents a "<selector>:not(<identifier... | public function getSelector(): NodeInterface
{
return $this->selector;
}
public function getSubSelector(): NodeInterface
{
return $this->subSelector;
}
public function getSpecificity(): Specificity
{
| anfrancois.simon@sensiolabs.com>
*
* @internal
*/
class NegationNode extends AbstractNode
{
public function __construct(
private NodeInterface $selector,
private NodeInterface $subSelector,
) {
}
| {
"filepath": "src/Symfony/Component/CssSelector/Node/NegationNode.php",
"language": "php",
"file_size": 1261,
"cut_index": 524,
"middle_length": 229
} |
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\CssSelector\Node;
/**
* Represents a "<selector>:where(<subSelec... | ce $selector,
public readonly array $arguments = [],
) {
}
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity();
}
public function __toString(): string
{
$selectorArg | enoir.hubert@gmail.com>
*
* @internal
*/
class SpecificityAdjustmentNode extends AbstractNode
{
/**
* @param array<NodeInterface> $arguments
*/
public function __construct(
public readonly NodeInterfa | {
"filepath": "src/Symfony/Component/CssSelector/Node/SpecificityAdjustmentNode.php",
"language": "php",
"file_size": 1253,
"cut_index": 524,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Parser;
use PHPUnit\Framework\TestCase;
use Symfony\Component\CssSelector\Exception\SyntaxErrorException;
use Symfony\Component\CssSelect... | his->assertSame($t1, $stream->getNext());
$this->assertSame($t2, $stream->getNext());
$this->assertSame($t3, $stream->getNext());
}
public function testGetPeek()
{
$stream = new TokenStream();
$stream->push($t1 | $stream->push($t1 = new Token(Token::TYPE_IDENTIFIER, 'h1', 0));
$stream->push($t2 = new Token(Token::TYPE_DELIMITER, '.', 2));
$stream->push($t3 = new Token(Token::TYPE_IDENTIFIER, 'title', 3));
$t | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php",
"language": "php",
"file_size": 3186,
"cut_index": 614,
"middle_length": 229
} |
<?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\CssSelector\Tests\Parser\Shortcut;
use PHPUnit\Framew... | );
/** @var SelectorNode $selector */
$selector = $selectors[0];
$this->assertEquals('Element[*]', (string) $selector->getTree());
$selectors = $parser->parse('this will produce an empty array');
$this->assertCount | sensiolabs.com>
*/
class EmptyStringParserTest extends TestCase
{
public function testParse()
{
$parser = new EmptyStringParser();
$selectors = $parser->parse('');
$this->assertCount(1, $selectors | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/Shortcut/EmptyStringParserTest.php",
"language": "php",
"file_size": 1023,
"cut_index": 512,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\XPath\Extension;
use Symfony\Component\CssSelector\XPath\Translator;
use Symfony\Component\CssSelector\XPath\XPathExpr;
/**
* XPath expressio... | 'exists' => $this->translateExists(...),
'=' => $this->translateEquals(...),
'~=' => $this->translateIncludes(...),
'|=' => $this->translateDashMatch(...),
'^=' => $this->translatePrefixMatch(...),
| Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class AttributeMatchingExtension extends AbstractExtension
{
public function getAttributeMatchingTranslators(): array
{
return [
| {
"filepath": "src/Symfony/Component/CssSelector/XPath/Extension/AttributeMatchingExtension.php",
"language": "php",
"file_size": 3763,
"cut_index": 614,
"middle_length": 229
} |
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\CssSelector\Node;
/**
* Abstract base node class.
*
... | com>
*
* @internal
*/
abstract class AbstractNode implements NodeInterface
{
private string $nodeName;
public function getNodeName(): string
{
return $this->nodeName ??= preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', static::class);
| on@sensiolabs. | {
"filepath": "src/Symfony/Component/CssSelector/Node/AbstractNode.php",
"language": "php",
"file_size": 793,
"cut_index": 514,
"middle_length": 14
} |
/*
* 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\CssSelector\Node;
/**
* Represents a "<selector>#<id>" nod... | tor(): NodeInterface
{
return $this->selector;
}
public function getId(): string
{
return $this->id;
}
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new | ois.simon@sensiolabs.com>
*
* @internal
*/
class HashNode extends AbstractNode
{
public function __construct(
private NodeInterface $selector,
private string $id,
) {
}
public function getSelec | {
"filepath": "src/Symfony/Component/CssSelector/Node/HashNode.php",
"language": "php",
"file_size": 1177,
"cut_index": 518,
"middle_length": 229
} |
$this->assertEquals($representation, array_map(static fn (SelectorNode $node) => (string) $node->getTree(), $parser->parse($source)));
}
#[DataProvider('getParserExceptionTestData')]
public function testParserException($source, $message)
{
$parser = new Parser();
try {
... | $this->assertCount(1, $selectors);
/** @var SelectorNode $selector */
$selector = $selectors[0];
$this->assertEquals($element, (string) $selector->getTree());
$this->assertEquals($pseudo, (string) $selector->getPseudo | ssage());
}
}
#[DataProvider('getPseudoElementsTestData')]
public function testPseudoElements($source, $element, $pseudo)
{
$parser = new Parser();
$selectors = $parser->parse($source);
| {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php",
"language": "php",
"file_size": 18041,
"cut_index": 1331,
"middle_length": 229
} |
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\CssSelector\Tests\Parser\Shortcut;
use PHPUnit\Framework\Attribut... | er();
$selectors = $parser->parse($source);
$this->assertCount(1, $selectors);
/** @var SelectorNode $selector */
$selector = $selectors[0];
$this->assertEquals($representation, (string) $selector->getTree());
} | çois Simon <jeanfrancois.simon@sensiolabs.com>
*/
class ElementParserTest extends TestCase
{
#[DataProvider('getParseTestData')]
public function testParse($source, $representation)
{
$parser = new ElementPars | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/Shortcut/ElementParserTest.php",
"language": "php",
"file_size": 1280,
"cut_index": 524,
"middle_length": 229
} |
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\CssSelector\Node;
/**
* Represents a "<selector>:has(<subselector>)" node.
*... | private array $arguments,
) {
}
public function getSelector(): NodeInterface
{
return $this->selector;
}
/**
* @return list<array{0: string, 1: NodeInterface}>
*/
public function getArguments(): array
| mail.com>
*
* @internal
*/
class RelationNode extends AbstractNode
{
/**
* @param list<array{0: string, 1: NodeInterface}> $arguments
*/
public function __construct(
private NodeInterface $selector,
| {
"filepath": "src/Symfony/Component/CssSelector/Node/RelationNode.php",
"language": "php",
"file_size": 1779,
"cut_index": 537,
"middle_length": 229
} |
/*
* 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\CssSelector\Node;
/**
* Represents a "<selector>.<name>" n... | Selector(): NodeInterface
{
return $this->selector;
}
public function getName(): string
{
return $this->name;
}
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()-> | ncois.simon@sensiolabs.com>
*
* @internal
*/
class ClassNode extends AbstractNode
{
public function __construct(
private NodeInterface $selector,
private string $name,
) {
}
public function get | {
"filepath": "src/Symfony/Component/CssSelector/Node/ClassNode.php",
"language": "php",
"file_size": 1188,
"cut_index": 518,
"middle_length": 229
} |
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\CssSelector\XPath\Extension;
use Symfony\Component\CssSelector\XPath\XPathExpr... | t argument and the translator as second argument.
*
* @return callable[]
*/
public function getNodeTranslators(): array;
/**
* Returns combination translators.
*
* @return callable[]
*/
public function getCom | select.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
interface ExtensionInterface
{
/**
* Returns node translators.
*
* These callables will receive the node as firs | {
"filepath": "src/Symfony/Component/CssSelector/XPath/Extension/ExtensionInterface.php",
"language": "php",
"file_size": 1820,
"cut_index": 537,
"middle_length": 229
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Adapter;
use Symfony\Component\Cache\Marshaller\DefaultMarshaller;
use Symfony\Component\Cache\Marshaller\MarshallerInterface;
use Symfony\Co... | '', int $defaultLifetime = 0, ?string $directory = null, ?MarshallerInterface $marshaller = null)
{
$this->marshaller = $marshaller ?? new DefaultMarshaller();
parent::__construct('', $defaultLifetime);
$this->init($namespace, |
public function __construct(string $namespace = | {
"filepath": "src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php",
"language": "php",
"file_size": 935,
"cut_index": 606,
"middle_length": 52
} |
he 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\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.22.0', '>=')) {
/**
... | et_args());
}
}
} else {
/**
* @internal
*/
trait Relay22Trait
{
public function jsonStrAppend($key, $value, $path = null): \Relay\Relay|array|false
{
return $this->initializeLazyObject()->jsonS | is->initializeLazyObject()->jsonStrAppend(...\func_g | {
"filepath": "src/Symfony/Component/Cache/Traits/Relay/Relay22Trait.php",
"language": "php",
"file_size": 904,
"cut_index": 547,
"middle_length": 52
} |
/*
* 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\Cache\Traits\Relay;
if (version_compare(phpversion('relay')... | public function digest($key): \Relay\Cluster|false|string|null
{
return $this->initializeLazyObject()->digest(...\func_get_args());
}
public function wait($key_or_address, $replicas, $timeout): \Relay\Cluster|false| | ct()->_digest(...\func_get_args());
}
public function delex($key, $options = null): \Relay\Cluster|false|int
{
return $this->initializeLazyObject()->delex(...\func_get_args());
}
| {
"filepath": "src/Symfony/Component/Cache/Traits/Relay/RelayCluster20Trait.php",
"language": "php",
"file_size": 1198,
"cut_index": 518,
"middle_length": 229
} |
n 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\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.21.0', '>=')) {
/**
* @internal
*/
trait ... | nc_get_args(), 1));
}
public function gcra($key, $maxBurst, $requestsPerPeriod, $period, $tokens = 0): \Relay\Cluster|array|false
{
return $this->initializeLazyObject()->gcra(...\func_get_args());
}
}
} else | Object()->clusterscan($iterator, ...\array_slice(\fu | {
"filepath": "src/Symfony/Component/Cache/Traits/Relay/RelayCluster21Trait.php",
"language": "php",
"file_size": 970,
"cut_index": 582,
"middle_length": 52
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Marshaller;
use Symfony\Component\Cache\Exception\CacheException;
/**
* Serializes/unserializes values using igbinary_serialize() if available, ser... | rsion_compare('3.1.6', phpversion('igbinary'), '>'))) {
throw new CacheException(\extension_loaded('igbinary') ? 'Please upgrade the "igbinary" PHP extension to v3.1.6 or higher.' : 'The "igbinary" PHP extension is not loaded.');
}
| throwOnSerializationFailure = false;
public function __construct(?bool $useIgbinarySerialize = null, bool $throwOnSerializationFailure = false)
{
if ($useIgbinarySerialize && (!\extension_loaded('igbinary') || ve | {
"filepath": "src/Symfony/Component/Cache/Marshaller/DefaultMarshaller.php",
"language": "php",
"file_size": 3438,
"cut_index": 614,
"middle_length": 229
} |
hp
/*
* 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\Cache\Marshaller;
use Symfony\Component\Cache\Exception\... | marshall(array $values, ?array &$failed): array
{
return array_map('gzdeflate', $this->marshaller->marshall($values, $failed));
}
public function unmarshall(string $value): mixed
{
if (false !== $inflatedValue = @gzinflate( | struct(
private MarshallerInterface $marshaller,
) {
if (!\function_exists('gzdeflate')) {
throw new CacheException('The "zlib" PHP extension is not loaded.');
}
}
public function | {
"filepath": "src/Symfony/Component/Cache/Marshaller/DeflateMarshaller.php",
"language": "php",
"file_size": 1121,
"cut_index": 515,
"middle_length": 229
} |
hp
/*
* 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\Cache\Marshaller;
/**
* Serializes/unserializes PHP val... | listed in $failed.
*/
public function marshall(array $values, ?array &$failed): array;
/**
* Unserializes a single value and throws an exception if anything goes wrong.
*
* @throws \Exception Whenever unserialization fails
| Grekas <p@tchwork.com>
*/
interface MarshallerInterface
{
/**
* Serializes a list of values.
*
* When serialization fails for a specific value, no exception should be
* thrown. Instead, its key should be | {
"filepath": "src/Symfony/Component/Cache/Marshaller/MarshallerInterface.php",
"language": "php",
"file_size": 1060,
"cut_index": 515,
"middle_length": 229
} |
ge.
*
* (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\Cache\Marshaller;
use Symfony\Component\Cache\Exception\CacheException;
use Symfony\Component\Cache\Exce... | ng keys can be provided to decrypt values;
* each key must be generated using sodium_crypto_box_keypair()
*/
public function __construct(
private array $decryptionKeys,
?MarshallerInterface $mar | terface
{
private MarshallerInterface $marshaller;
/**
* @param string[] $decryptionKeys The key at index "0" is required and is used to decrypt and encrypt values;
* more rotati | {
"filepath": "src/Symfony/Component/Cache/Marshaller/SodiumMarshaller.php",
"language": "php",
"file_size": 2300,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Marshaller;
/**
* A marshaller optimized for data structures generated by AbstractTagAwareAdapter.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
... | $value) {
if (\is_array($value) && \is_array($value['tags'] ?? null) && \array_key_exists('value', $value) && \count($value) === 2 + (\is_string($value['meta'] ?? null) && 8 === \strlen($value['meta']))) {
// if the value is an | this->marshaller = $marshaller ?? new DefaultMarshaller();
}
public function marshall(array $values, ?array &$failed): array
{
$failed = $notSerialized = $serialized = [];
foreach ($values as $id => | {
"filepath": "src/Symfony/Component/Cache/Marshaller/TagAwareMarshaller.php",
"language": "php",
"file_size": 3060,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (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\Cache\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\... | InvalidKey($key)
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Cache key');
CacheItem::validateKey($key);
}
public static function provideInvalidKey(): array
{
ret | ngableTag;
class CacheItemTest extends TestCase
{
public function testValidKey()
{
$this->assertSame('foo', CacheItem::validateKey('foo'));
}
#[DataProvider('provideInvalidKey')]
public function test | {
"filepath": "src/Symfony/Component/Cache/Tests/CacheItemTest.php",
"language": "php",
"file_size": 2845,
"cut_index": 563,
"middle_length": 229
} |
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\Cache\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Componen... | ed on Windows');
}
$lockFiles = LockRegistry::setFiles([]);
LockRegistry::setFiles($lockFiles);
$expected = array_map('realpath', glob(__DIR__.'/../Adapter/*.php'));
$this->assertSame($expected, $lockFiles);
}
}
| stry is disabl | {
"filepath": "src/Symfony/Component/Cache/Tests/LockRegistryTest.php",
"language": "php",
"file_size": 794,
"cut_index": 524,
"middle_length": 14
} |
ge.
*
* (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\Cache\Tests;
use Cache\IntegrationTests\SimpleCacheTest;
use Psr\SimpleCache\CacheInterface;
use Symfony... | $this->skippedTests['testGetMultipleNoIterable'] =
$this->skippedTests['testSetInvalidKeys'] =
$this->skippedTests['testSetMultipleInvalidKeys'] =
$this->skippedTests['testSetMultipleNoIterable'] =
$this | ted function setUp(): void
{
try {
\assert(false === true, new \Exception());
$this->skippedTests['testGetInvalidKeys'] =
$this->skippedTests['testGetMultipleInvalidKeys'] =
| {
"filepath": "src/Symfony/Component/Cache/Tests/Psr16CacheProxyTest.php",
"language": "php",
"file_size": 2039,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache\Tests;
use Cache\IntegrationTests\SimpleCacheTest;
use PHPUnit\Framework\Attributes\Group;
use Psr\SimpleCache\CacheInterface;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Compone... | ) {
$pool = ((array) $pool)[\sprintf("\0%s\0pool", Psr16Cache::class)];
}
if (!$pool instanceof PruneableInterface) {
$this->skippedTests['testPrune'] = 'Not a pruneable cache pool.';
}
try {
| st
{
protected function setUp(): void
{
if (\array_key_exists('testPrune', $this->skippedTests)) {
return;
}
$pool = $this->createSimpleCache();
if ($pool instanceof Psr16Cache | {
"filepath": "src/Symfony/Component/Cache/Tests/Psr16CacheTest.php",
"language": "php",
"file_size": 6859,
"cut_index": 716,
"middle_length": 229
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Tests;
use Cache\IntegrationTests\SimpleCacheTest;
use PHPUnit\Framework\Attributes\Group;
use Psr\SimpleCache\CacheInterface;
use Symfony\Co... | ts['testSetTtl'] =
$this->skippedTests['testSetMultipleTtl'] = 'The ExternalAdapter test class does not support TTLs.';
}
public function createSimpleCache(): CacheInterface
{
return new Psr16Cache(new ExternalAdapter());
} | nction setUp(): void
{
$this->skippedTes | {
"filepath": "src/Symfony/Component/Cache/Tests/Psr16CacheWithExternalAdapter.php",
"language": "php",
"file_size": 917,
"cut_index": 606,
"middle_length": 52
} |
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\Cache\Tests\Adapter;
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
us... | ite',
'testDefaultLifeTime' => 'Testing expiration slows down the test suite',
];
protected static \Redis|Relay|RelayCluster|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis;
public function createCachePool(int $defaultLifetim | dapterTestCase
{
protected $skippedTests = [
'testExpiration' => 'Testing expiration slows down the test suite',
'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test su | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTestCase.php",
"language": "php",
"file_size": 1919,
"cut_index": 537,
"middle_length": 229
} |
e Psr\Cache\CacheItemInterface;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Contracts\Cache\CallbackInterface;
use Symfony\Contracts\Cache\NamespacedPoolInterface;
abstract class AdapterTestCase extends CachePoolTest
{
pro... | ItemsInvalidKeys'] =
$this->skippedTests['testHasItemInvalidKeys'] =
$this->skippedTests['testDeleteItemInvalidKeys'] =
$this->skippedTests['testDeleteItemsInvalidKeys'] = 'Keys are checked only when assert() is enabled. | ts['testPrune'] = 'Not a pruneable cache pool.';
}
try {
\assert(false === true, new \Exception());
$this->skippedTests['testGetItemInvalidKeys'] =
$this->skippedTests['testGet | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php",
"language": "php",
"file_size": 14715,
"cut_index": 921,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Tests\Adapter;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Log\NullLogger;
use Symfony\Component\Cache\Adapter\ApcuAdapter;
use Symfony\Component\C... | chePool(int $defaultLifetime = 0): CacheItemPoolInterface
{
if (!\function_exists('apcu_fetch') || !filter_var(\ini_get('apc.enabled'), \FILTER_VALIDATE_BOOL)) {
$this->markTestSkipped('APCu extension is required.');
}
| ,
'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite',
'testDefaultLifeTime' => 'Testing expiration slows down the test suite',
];
public function createCa | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php",
"language": "php",
"file_size": 4972,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Tests\Adapter;
use PHPUnit\Framework\Attributes\Group;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Sy... | ich ArrayAdapter is not.',
'testClearWithInvalidPrefix' => 'ArrayAdapter does not validate the prefix.',
];
public function createCachePool(int $defaultLifetime = 0): CacheItemPoolInterface
{
return new ArrayAdapter($defaultLif | [
'testGetMetadata' => 'ArrayAdapter does not keep metadata.',
'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is not.',
'testSaveWithoutExpire' => 'Assumes a shared cache wh | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/ArrayAdapterTest.php",
"language": "php",
"file_size": 3563,
"cut_index": 614,
"middle_length": 229
} |
Interface;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Adapter\ChainAdapter;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cache\Tests\Fixtures\External... | estGetMetadata' === $testMethod) {
return new ChainAdapter([new FilesystemAdapter('a', $defaultLifetime), new FilesystemAdapter('b', $defaultLifetime)], $defaultLifetime);
}
return new ChainAdapter([new ArrayAdapter($defaultLif | las@gmail.com>
*/
#[Group('time-sensitive')]
class ChainAdapterTest extends AdapterTestCase
{
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
if ('t | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php",
"language": "php",
"file_size": 11588,
"cut_index": 921,
"middle_length": 229
} |
ge.
*
* (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\Cache\Tests\Adapter;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPh... | protected $skippedTests = [
'testClearPrefix' => 'Couchbase cannot clear by prefix',
'testClearPrefixWithUnderscore' => 'Couchbase cannot clear by prefix',
'testClearWithInvalidPrefix' => 'Couchbase cannot clear by prefix',
];
| ose Cerezo Aranda <aj.cerezo@gmail.com>
*/
#[RequiresPhpExtension('couchbase', '<4.0.0')]
#[RequiresPhpExtension('couchbase', '>=3.0.5')]
#[Group('integration')]
class CouchbaseCollectionAdapterTest extends AdapterTestCase
{
| {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/CouchbaseCollectionAdapterTest.php",
"language": "php",
"file_size": 2215,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache\Tests\Adapter;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\AbstractMySQLDriver;
use Doctrine\DBAL\Driver\Middleware;
use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
use Doctrine\DBAL\DriverMana... | ('time-sensitive')]
class DoctrineDbalAdapterTest extends AdapterTestCase
{
protected static string $dbFile;
public static function setUpBeforeClass(): void
{
self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache');
}
p | Unit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\DoctrineDbalAdapter;
#[RequiresPhpExtension('pdo_sqlite')]
#[Group | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php",
"language": "php",
"file_size": 8520,
"cut_index": 716,
"middle_length": 229
} |
hp
/*
* 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\Cache\Tests\Adapter;
use PHPUnit\Framework\Attributes\Gr... | terClass(): void
{
(new Filesystem())->remove(sys_get_temp_dir().'/symfony-cache');
}
protected function isPruned(CacheItemPoolInterface $cache, string $name): bool
{
$getFileMethod = (new \ReflectionObject($cache))->getMet | erTest extends AdapterTestCase
{
public function createCachePool(int $defaultLifetime = 0): CacheItemPoolInterface
{
return new FilesystemAdapter('', $defaultLifetime);
}
public static function tearDownAf | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php",
"language": "php",
"file_size": 1093,
"cut_index": 515,
"middle_length": 229
} |
/*
* 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\Cache\Tests\Adapter;
use PHPUnit\Framework\Attributes\Group... | agAwareAdapter('', $defaultLifetime);
}
public function testCommitDoesNotFailWhenTagSaveFails()
{
$adapter = new FailingTagFilesystemAdapter();
$item = $adapter->getItem('foo');
$item->set('bar');
$item->tag([' | nsitive')]
class FilesystemTagAwareAdapterTest extends FilesystemAdapterTest
{
use TagAwareTestTrait;
public function createCachePool(int $defaultLifetime = 0): CacheItemPoolInterface
{
return new FilesystemT | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/FilesystemTagAwareAdapterTest.php",
"language": "php",
"file_size": 1158,
"cut_index": 518,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Tests\Adapter;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Compone... | {
parent::__construct(str_repeat('-', 10));
}
protected function doHave(string $id): bool
{
Assert::assertSame(array_shift(self::$series), $id);
return false;
| private static $series = [
['----------:z5XrNUPebf0nPxQwjc6C1A:'],
['----------:---------------------------------------'],
];
public function __construct()
| {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php",
"language": "php",
"file_size": 4293,
"cut_index": 614,
"middle_length": 229
} |
equiresPhpExtension;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Adapter\MemcachedAdapter;
use Symfony\Component\Cache\Exception\CacheException;
#[Group('integration')]
class MemcachedAdapterTest extends AdapterTestCase
{
protected $skipped... | ];
protected static \Memcached $client;
public static function setUpBeforeClass(): void
{
if (!MemcachedAdapter::isSupported()) {
self::markTestSkipped('Extension memcached > 3.1.5 required.');
}
self:: | suite',
'testClearPrefix' => 'Memcached cannot clear by prefix',
'testClearPrefixWithUnderscore' => 'Memcached cannot clear by prefix',
'testClearWithInvalidPrefix' => 'Memcached cannot clear by prefix',
| {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php",
"language": "php",
"file_size": 9859,
"cut_index": 921,
"middle_length": 229
} |
n 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\Cache\Tests\Adapter;
use PHPUnit\Framework\Attributes\Group;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Ca... | eCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
if ('testGetMetadata' === $testMethod) {
return new ProxyAdapter(new FilesystemAdapter(), 'foo', $defaultLifetime);
}
return | extends ProxyAdapterTest
{
public function creat | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/NamespacedProxyAdapterTest.php",
"language": "php",
"file_size": 978,
"cut_index": 582,
"middle_length": 52
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Tests\Adapter;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Psr\Cache\CacheItemInterface;
use Symfony\Component\Cache\... | Hit is false.");
}
public function testGet()
{
$adapter = $this->createCachePool();
$fetched = [];
$adapter->get('myKey', static function ($item) use (&$fetched) { $fetched[] = $item; });
$this->assertCount(1, | on testGetItem()
{
$adapter = $this->createCachePool();
$item = $adapter->getItem('key');
$this->assertFalse($item->isHit());
$this->assertNull($item->get(), "Item's value must be null when is | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/NullAdapterTest.php",
"language": "php",
"file_size": 4343,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Tests\Adapter;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpExt... | che');
$pool = new PdoAdapter('sqlite:'.self::$dbFile);
$pool->createTable();
}
public static function tearDownAfterClass(): void
{
@unlink(self::$dbFile);
}
public function createCachePool(int $defaultLifetim | p('time-sensitive')]
class PdoAdapterTest extends AdapterTestCase
{
protected static string $dbFile;
public static function setUpBeforeClass(): void
{
self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_ca | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php",
"language": "php",
"file_size": 4152,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache\Tests\Adapter;
use PHPUnit\Framework\Attributes\Group;
use Psr\Cache\CacheItemInterface;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\NullAdapter;
use Symfony\Componen... | ter is read-only.',
'testBasicUsageWithLongKey' => 'PhpArrayAdapter is read-only.',
'testClear' => 'PhpArrayAdapter is read-only.',
'testClearWithDeferredItems' => 'PhpArrayAdapter is read-only.',
'testDeleteItem' => 'PhpArr | 'testGet' => 'PhpArrayAdapter is read-only.',
'testDontSaveWhenAskedNotTo' => 'PhpArrayAdapter is read-only.',
'testRecursiveGet' => 'PhpArrayAdapter is read-only.',
'testBasicUsage' => 'PhpArrayAdap | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php",
"language": "php",
"file_size": 6428,
"cut_index": 716,
"middle_length": 229
} |
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\Cache\Tests\Adapter;
use PHPUnit\Framework\Attributes\Group;
use Psr\Cache\Cac... | idKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
'testHasItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
'testDeleteItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on in | sitive')]
class PhpArrayAdapterWithFallbackTest extends AdapterTestCase
{
protected $skippedTests = [
'testGetItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
'testGetItemsInval | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php",
"language": "php",
"file_size": 1923,
"cut_index": 537,
"middle_length": 229
} |
ackage.
*
* (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\Cache\Tests\Adapter;
use PHPUnit\Framework\Attributes\Group;
use Psr\Cache\CacheItemPoolInterface;
u... | onfiguring a default lifetime.',
'testExpiration' => 'PhpFilesAdapter in append-only mode does not expiration.',
];
public function createCachePool(): CacheItemPoolInterface
{
return new PhpFilesAdapter('sf-cache', 0, null, tru | efaultLifeTime' => 'PhpFilesAdapter does not allow c | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterAppendOnlyTest.php",
"language": "php",
"file_size": 879,
"cut_index": 559,
"middle_length": 52
} |
/*
* 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\Cache\Tests\Adapter;
use PHPUnit\Framework\Attributes\Group... | {
return new PhpFilesAdapter('sf-cache');
}
public static function tearDownAfterClass(): void
{
(new Filesystem())->remove(sys_get_temp_dir().'/symfony-cache');
}
protected function isPruned(CacheItemPoolInterface $c | extends AdapterTestCase
{
protected $skippedTests = [
'testDefaultLifeTime' => 'PhpFilesAdapter does not allow configuring a default lifetime.',
];
public function createCachePool(): CacheItemPoolInterface
| {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php",
"language": "php",
"file_size": 1192,
"cut_index": 518,
"middle_length": 229
} |
/*
* 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\Cache\Tests\Adapter;
use PHPUnit\Framework\Attributes\Group... | arkTestSkipped('REDIS_SENTINEL_HOSTS env var is not defined.');
}
if (!$service = getenv('REDIS_SENTINEL_SERVICE')) {
self::markTestSkipped('REDIS_SENTINEL_SERVICE env var is not defined.');
}
self::$redis = Abs | ss(): void
{
if (!class_exists(\Predis\Client::class)) {
self::markTestSkipped('The Predis\Client class is required.');
}
if (!$hosts = getenv('REDIS_SENTINEL_HOSTS')) {
self::m | {
"filepath": "src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterSentinelTest.php",
"language": "php",
"file_size": 1165,
"cut_index": 518,
"middle_length": 229
} |
ny\Component\Cache\Marshaller\DefaultMarshaller;
use Symfony\Component\Cache\Marshaller\MarshallerInterface;
use Symfony\Contracts\Cache\ItemInterface;
/**
* @author Rob Frawley 2nd <rmf@src.run>
* @author Nicolas Grekas <p@tchwork.com>
*/
class MemcachedAdapter extends AbstractAdapter
{
/**
* We are repla... | ivate \Memcached $client;
private \Memcached $lazyClient;
/**
* Using a MemcachedAdapter with a TagAwareAdapter for storing tags is discouraged.
* Using a RedisAdapter is recommended instead. If you cannot do otherwise, be aware that:
| ractAdapter::NS_SEPARATOR}.
*/
private const RESERVED_MEMCACHED = " \n\r\t\v\f\0";
private const RESERVED_PSR6 = '@()\{}/';
private const MAX_KEY_LENGTH = 250;
private MarshallerInterface $marshaller;
pr | {
"filepath": "src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php",
"language": "php",
"file_size": 13419,
"cut_index": 921,
"middle_length": 229
} |
he 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\Cache\Adapter;
/**
* @author Lars Strojny <lars@strojny.net>
*/
final class ParameterN... | e;
}
try {
return \DateTimeImmutable::createFromFormat('U', 0)->add(new \DateInterval($duration))->getTimestamp();
} catch (\Exception $e) {
throw new \InvalidArgumentException(\sprintf('Cannot parse date in | = strtotime($duration, 0)) {
return $tim | {
"filepath": "src/Symfony/Component/Cache/Adapter/ParameterNormalizer.php",
"language": "php",
"file_size": 908,
"cut_index": 547,
"middle_length": 52
} |
onent\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\ResettableInterface;
use Symfony\Component\Cache\Traits\CachedValueInterface;
use Symfony\Component\Cache\Traits\ContractsTrait;
use Symfony\Component\Cache\Traits\ProxyTrait;
use Symfony\Componen... | dapterInterface, CacheInterface, PruneableInterface, ResettableInterface
{
use ContractsTrait;
use ProxyTrait;
private array $keys;
private array $values;
private static \Closure $createCacheItem;
private static array $valuesCache | d up items are read-only and run-time discovered items are cached using a fallback adapter.
*
* @author Titouan Galopin <galopintitouan@gmail.com>
* @author Nicolas Grekas <p@tchwork.com>
*/
class PhpArrayAdapter implements A | {
"filepath": "src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php",
"language": "php",
"file_size": 12299,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache\Adapter;
use Psr\Cache\CacheItemInterface;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\ResettableInterface;
use Symfony\Component\Cache\Traits... | ';
private int $namespaceLen;
private string $poolHash;
private int $defaultLifetime;
private static \Closure $createCacheItem;
private static \Closure $setInnerItem;
public function __construct(CacheItemPoolInterface $pool, strin | <p@tchwork.com>
*/
class ProxyAdapter implements AdapterInterface, NamespacedPoolInterface, CacheInterface, PruneableInterface, ResettableInterface
{
use ContractsTrait;
use ProxyTrait;
private string $namespace = ' | {
"filepath": "src/Symfony/Component/Cache/Adapter/ProxyAdapter.php",
"language": "php",
"file_size": 7288,
"cut_index": 716,
"middle_length": 229
} |
e\ReplicationInterface;
use Predis\Connection\Replication\ReplicationInterface as Predis2ReplicationInterface;
use Predis\Response\ErrorInterface;
use Predis\Response\Status;
use Relay\Relay;
use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cac... | (volatile) even
* if not set by caller. Thus if you configure redis with the right eviction policy you can be safe this tag <> cache
* relationship survives eviction (cache cleanup when Redis runs out of memory).
*
* Redis server 2.8+ with any `volatil | reMarshaller;
use Symfony\Component\Cache\Traits\RedisTrait;
/**
* Stores tag id <> cache id relationship as a Redis Set.
*
* Set (tag relation info) is stored without expiry (non-volatile), while cache always gets an expiry | {
"filepath": "src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php",
"language": "php",
"file_size": 13020,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache\Adapter;
use Psr\Cache\CacheItemInterface;
use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\Exception\BadMethodCallException;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\ResettableInterface;
use Symfon... | Interface, PruneableInterface, ResettableInterface
{
private string $namespace = '';
private array $calls = [];
public function __construct(
protected AdapterInterface $pool,
protected readonly ?\Closure $disabled = null,
) | .
*
* @author Aaron Scherer <aequasi@gmail.com>
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Nicolas Grekas <p@tchwork.com>
*/
class TraceableAdapter implements AdapterInterface, CacheInterface, NamespacedPool | {
"filepath": "src/Symfony/Component/Cache/Adapter/TraceableAdapter.php",
"language": "php",
"file_size": 8952,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache\DataCollector;
use Symfony\Component\Cache\Adapter\TraceableAdapter;
use Symfony\Component\Cache\Adapter\TraceableAdapterEvent;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKern... | tance(string $name, TraceableAdapter $instance): void
{
$this->instances[$name] = $instance;
}
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
{
$this->lateCollect();
} | holm@gmail.com>
*
* @final
*/
class CacheDataCollector extends DataCollector implements LateDataCollectorInterface
{
/**
* @var TraceableAdapter[]
*/
private array $instances = [];
public function addIns | {
"filepath": "src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php",
"language": "php",
"file_size": 6129,
"cut_index": 716,
"middle_length": 229
} |
he\Exception\InvalidArgumentException;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
trait AbstractAdapterTrait
{
use LoggerAwareTrait;
/**
* needs to be set by class, signature is function(string <key>, mixed <value>, bool <isHit>).
*/
private static \Closure $createCacheIte... | private array $ids = [];
/**
* The maximum length to enforce for identifiers or null when no limit applies.
*/
protected ?int $maxIdLength = null;
/**
* Fetches several cache items.
*
* @param array $ids The cache | e readonly string $rootNamespace;
private string $namespace = '';
private int $defaultLifetime;
private string $namespaceVersion = '';
private bool $versioningIsEnabled = false;
private array $deferred = [];
| {
"filepath": "src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php",
"language": "php",
"file_size": 13204,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache\Traits;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
trait FilesystemCommonTrait
{
private string $directory;
private string $tmpSuffix;
private functio... | on(\sprintf('Namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0]));
}
$directory .= \DIRECTORY_SEPARATOR.$namespace;
} else {
$directory .= \DIRECTORY_SEPARATOR.'@';
}
| {
$directory = realpath($directory) ?: $directory;
}
if (isset($namespace[0])) {
if (preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) {
throw new InvalidArgumentExcepti | {
"filepath": "src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php",
"language": "php",
"file_size": 5751,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache\Traits;
if (version_compare(phpversion('redis'), '6.3.0', '>=')) {
/**
* @internal
*/
trait Redis63ProxyTrait
{
public function delifeq($key, $value): \Redis|int|false
{
return $this->initializeLazyObj... | }
public function hexpiretime($key, $fields): \Redis|array|false
{
return $this->initializeLazyObject()->hexpiretime(...\func_get_args());
}
public function hgetdel($key, $fields): \Redis|array|false
| )->hexpire(...\func_get_args());
}
public function hexpireat($key, $time, $fields, $mode = null): \Redis|array|false
{
return $this->initializeLazyObject()->hexpireat(...\func_get_args());
| {
"filepath": "src/Symfony/Component/Cache/Traits/Redis63ProxyTrait.php",
"language": "php",
"file_size": 5229,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Cache\Traits;
if (version_compare(phpversion('redis'), '6.3.0', '>=')) {
/**
* @internal
*/
trait RedisCluster63ProxyTrait
{
public function delifeq($key, $value): \RedisCluster|int|false
{
return $this->ini... | at(...\func_get_args());
}
public function hexpiretime($key, $fields): \RedisCluster|array|false
{
return $this->initializeLazyObject()->hexpiretime(...\func_get_args());
}
public function hgetdel($key, | initializeLazyObject()->hexpire(...\func_get_args());
}
public function hexpireat($key, $time, $fields, $mode = null): \RedisCluster|array|false
{
return $this->initializeLazyObject()->hexpire | {
"filepath": "src/Symfony/Component/Cache/Traits/RedisCluster63ProxyTrait.php",
"language": "php",
"file_size": 5425,
"cut_index": 716,
"middle_length": 229
} |
unction _redir(): ?string
{
return $this->initializeLazyObject()->_redir(...\func_get_args());
}
public function _serialize($value): bool|string
{
return $this->initializeLazyObject()->_serialize(...\func_get_args());
}
public function _uncompress($value): string
{
... | {
return $this->initializeLazyObject()->acl(...\func_get_args());
}
public function append($key, $value): \RedisCluster|bool|int
{
return $this->initializeLazyObject()->append(...\func_get_args());
}
public function | et_args());
}
public function _unserialize($value): mixed
{
return $this->initializeLazyObject()->_unserialize(...\func_get_args());
}
public function acl($key_or_address, $subcmd, ...$args): mixed
| {
"filepath": "src/Symfony/Component/Cache/Traits/RedisClusterProxy.php",
"language": "php",
"file_size": 37558,
"cut_index": 2151,
"middle_length": 229
} |
blic function _unpack($value): mixed
{
return $this->initializeLazyObject()->_unpack(...\func_get_args());
}
public function _unserialize($value): mixed
{
return $this->initializeLazyObject()->_unserialize(...\func_get_args());
}
public function acl($subcmd, ...$args): mixed
... | \Redis|bool
{
return $this->initializeLazyObject()->bgSave(...\func_get_args());
}
public function bgrewriteaof(): \Redis|bool
{
return $this->initializeLazyObject()->bgrewriteaof(...\func_get_args());
}
public fun | ->append(...\func_get_args());
}
public function auth(#[\SensitiveParameter] $credentials): \Redis|bool
{
return $this->initializeLazyObject()->auth(...\func_get_args());
}
public function bgSave(): | {
"filepath": "src/Symfony/Component/Cache/Traits/RedisProxy.php",
"language": "php",
"file_size": 40845,
"cut_index": 2151,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.