prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
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\Translation\Dumper;
use Symfony\Component\Translation\MessageCatalogue;
/**
* IniFileDumper generates an ini formatted st... | = '';
foreach ($messages->all($domain) as $source => $target) {
$escapeTarget = str_replace('"', '\"', $target);
$output .= $source.'="'.$escapeTarget."\"\n";
}
return $output;
}
protected function | array $options = []): string
{
$output | {
"filepath": "src/Symfony/Component/Translation/Dumper/IniFileDumper.php",
"language": "php",
"file_size": 950,
"cut_index": 582,
"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\Translation\Dumper;
use Symfony\Component\Translation\Message... | ng $domain, array $options = []): string
{
$flags = $options['json_encoding'] ?? \JSON_PRETTY_PRINT;
return json_encode($messages->all($domain), $flags);
}
protected function getExtension(): string
{
return 'json'; | ion formatCatalogue(MessageCatalogue $messages, stri | {
"filepath": "src/Symfony/Component/Translation/Dumper/JsonFileDumper.php",
"language": "php",
"file_size": 837,
"cut_index": 520,
"middle_length": 52
} |
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\Translation\Dumper;
use Symfony\Component\Translation\Loader\MoFileLoader;
use Symfony\Component\Transla... | foreach ($messages->all($domain) as $source => $target) {
$offsets[] = array_map('strlen', [$sources, $source, $targets, $target]);
$sources .= "\0".$source;
$targets .= "\0".$target;
++$size;
}
| public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string
{
$sources = $targets = $sourceOffsets = $targetOffsets = '';
$offsets = [];
$size = 0;
| {
"filepath": "src/Symfony/Component/Translation/Dumper/MoFileDumper.php",
"language": "php",
"file_size": 2243,
"cut_index": 563,
"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\Translation\Dumper;
use Symfony\Component\Translation\M... | matCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string
{
return "<?php\n\nreturn ".var_export($messages->all($domain), true).";\n";
}
protected function getExtension(): string
{
return 'php';
| c function for | {
"filepath": "src/Symfony/Component/Translation/Dumper/PhpFileDumper.php",
"language": "php",
"file_size": 792,
"cut_index": 514,
"middle_length": 14
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Translation\Dumper;
use Symfony\Component\Translation\MessageCatalogue;
/**
* PoFileDumper generates a gettext formatted string representation of a messa... | '"Language: '.$messages->getLocale().'\n"'."\n";
$output .= "\n";
$newLine = false;
foreach ($messages->all($domain) as $source => $target) {
if ($newLine) {
$output .= "\n";
} else {
| {
$output = 'msgid ""'."\n";
$output .= 'msgstr ""'."\n";
$output .= '"Content-Type: text/plain; charset=UTF-8\n"'."\n";
$output .= '"Content-Transfer-Encoding: 8bit\n"'."\n";
$output .= | {
"filepath": "src/Symfony/Component/Translation/Dumper/PoFileDumper.php",
"language": "php",
"file_size": 4137,
"cut_index": 614,
"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\Translation\Dumper;
use Symfony\Component\Translation\MessageCatalogue;
/**
... | $context = $ts->appendChild($dom->createElement('context'));
$context->appendChild($dom->createElement('name', $domain));
foreach ($messages->all($domain) as $source => $target) {
$message = $context->appendChild($dom->creat | (MessageCatalogue $messages, string $domain, array $options = []): string
{
$dom = new \DOMDocument('1.0', 'utf-8');
$dom->formatOutput = true;
$ts = $dom->appendChild($dom->createElement('TS'));
| {
"filepath": "src/Symfony/Component/Translation/Dumper/QtFileDumper.php",
"language": "php",
"file_size": 1884,
"cut_index": 537,
"middle_length": 229
} |
/**
* XliffFileDumper generates xliff files from a message catalogue.
*
* @author Michel Salib <michelsalib@hotmail.com>
*/
class XliffFileDumper extends FileDumper
{
public function __construct(
private string $extension = 'xlf',
) {
}
public function formatCatalogue(MessageCatalogue $mes... | if ('1.2' === $xliffVersion) {
return $this->dumpXliff1($defaultLocale, $messages, $domain, $options);
}
if ('2.0' === $xliffVersion) {
return $this->dumpXliff2($defaultLocale, $messages, $domain);
}
| _version'];
}
if (\array_key_exists('default_locale', $options)) {
$defaultLocale = $options['default_locale'];
} else {
$defaultLocale = \Locale::getDefault();
}
| {
"filepath": "src/Symfony/Component/Translation/Dumper/XliffFileDumper.php",
"language": "php",
"file_size": 9480,
"cut_index": 921,
"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\Translation\Dumper;
use Symfony\Component\Translation\Exception\L... | blic function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string
{
if (!class_exists(Yaml::class)) {
throw new LogicException('Dumping translations in the YAML format requires the Symfony Yaml c | files from a message catalogue.
*
* @author Michel Salib <michelsalib@hotmail.com>
*/
class YamlFileDumper extends FileDumper
{
public function __construct(
private string $extension = 'yml',
) {
}
pu | {
"filepath": "src/Symfony/Component/Translation/Dumper/YamlFileDumper.php",
"language": "php",
"file_size": 1485,
"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\Translation\DependencyInjection;
use Symfony\Component\Depe... | )) {
return;
}
$translatorClass = $container->getParameterBag()->resolveValue($container->findDefinition('translator')->getClass());
if (!is_subclass_of($translatorClass, TranslatorBagInterface::class)) {
$ | Flothmann <christian.flothmann@sensiolabs.de>
*/
class DataCollectorTranslatorPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (!$container->has('translator' | {
"filepath": "src/Symfony/Component/Translation/DependencyInjection/DataCollectorTranslatorPass.php",
"language": "php",
"file_size": 1151,
"cut_index": 518,
"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\Translation\DependencyInjection;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterfac... | uilder $container): void
{
if (!$container->hasAlias('logger') || !$container->hasAlias('translator')) {
return;
}
if (!$container->hasParameter('translator.logging') || !$container->getParameter('translator.logging | rface;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
*/
class LoggingTranslatorPass implements CompilerPassInterface
{
public function process(ContainerB | {
"filepath": "src/Symfony/Component/Translation/DependencyInjection/LoggingTranslatorPass.php",
"language": "php",
"file_size": 2357,
"cut_index": 563,
"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\Translation\DependencyInjection;
use Symfony\Component\D... | tion.writer')) {
return;
}
$definition = $container->getDefinition('translation.writer');
foreach ($container->findTaggedServiceIds('translation.dumper', true) as $id => $attributes) {
$definition->addMetho | ion.formatter services to translation writer.
*/
class TranslationDumperPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition('transla | {
"filepath": "src/Symfony/Component/Translation/DependencyInjection/TranslationDumperPass.php",
"language": "php",
"file_size": 1085,
"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\Translation\DependencyInjection;
use Symfony\Component\D... | ranslation.extractor')) {
return;
}
$definition = $container->getDefinition('translation.extractor');
foreach ($container->findTaggedServiceIds('translation.extractor', true) as $id => $attributes) {
$defin | ion.extractor services to translation extractor.
*/
class TranslationExtractorPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition('t | {
"filepath": "src/Symfony/Component/Translation/DependencyInjection/TranslationExtractorPass.php",
"language": "php",
"file_size": 1110,
"cut_index": 515,
"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\Translation\DependencyInjection;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compil... | ach ($container->findTaggedServiceIds('translation.loader', true) as $id => $attributes) {
$loaderRefs[$id] = new Reference($id);
$loaders[$id][] = $attributes[0]['alias'];
if (isset($attributes[0]['legacy-alias'])) {
| e
{
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition('translator.default')) {
return;
}
$loaders = [];
$loaderRefs = [];
fore | {
"filepath": "src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php",
"language": "php",
"file_size": 3769,
"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\Translation\DependencyInjection;
use Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass;
use Symfony\Component\DependencyInjection\Contai... | private int $level = 0;
/**
* @var array<string, bool>
*/
private array $paths = [];
/**
* @var array<int, Definition>
*/
private array $definitions = [];
/**
* @var array<string, array<string, bool>>
* | ponent\HttpKernel\Controller\ArgumentResolver\TraceableValueResolver;
/**
* @author Yonel Ceruto <yonelceruto@gmail.com>
*/
class TranslatorPathsPass extends AbstractRecursivePass
{
protected bool $skipScalars = true;
| {
"filepath": "src/Symfony/Component/Translation/DependencyInjection/TranslatorPathsPass.php",
"language": "php",
"file_size": 4812,
"cut_index": 614,
"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\Translation\Extractor;
use Symfony\Component\Translation\Exception\InvalidArgu... | ted($file)) {
$files[] = $this->toSplFileInfo($file);
}
}
} elseif (is_file($resource)) {
$files = $this->canBeExtracted($resource) ? [$this->toSplFileInfo($resource)] : [];
} else | tor
{
protected function extractFiles(string|iterable $resource): iterable
{
if (is_iterable($resource)) {
$files = [];
foreach ($resource as $file) {
if ($this->canBeExtrac | {
"filepath": "src/Symfony/Component/Translation/Extractor/AbstractFileExtractor.php",
"language": "php",
"file_size": 1683,
"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\Translation\Extractor;
use Symfony\Component\Translation\MessageC... | mat, ExtractorInterface $extractor): void
{
$this->extractors[$format] = $extractor;
}
public function setPrefix(string $prefix): void
{
foreach ($this->extractors as $extractor) {
$extractor->setPrefix($prefix) | {
/**
* The extractors.
*
* @var ExtractorInterface[]
*/
private array $extractors = [];
/**
* Adds a loader to the translation extractor.
*/
public function addExtractor(string $for | {
"filepath": "src/Symfony/Component/Translation/Extractor/ChainExtractor.php",
"language": "php",
"file_size": 1252,
"cut_index": 524,
"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\Translation\Extractor;
use Symfony\Component\Translat... | a file or a directory
*/
public function extract(string|iterable $resource, MessageCatalogue $catalogue): void;
/**
* Sets the prefix that should be used for new found messages.
*/
public function setPrefix(string $prefix): void | el Salib <michelsalib@hotmail.com>
*/
interface ExtractorInterface
{
/**
* Extracts translation messages from files, a file or a directory to the catalogue.
*
* @param string|iterable<string> $resource Files, | {
"filepath": "src/Symfony/Component/Translation/Extractor/ExtractorInterface.php",
"language": "php",
"file_size": 1001,
"cut_index": 512,
"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\Translation\Extractor;
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitor;
use PhpParser\Parser;
use... | vate Parser $parser;
public function __construct(
/**
* @param iterable<AbstractVisitor&NodeVisitor> $visitors
*/
private readonly iterable $visitors,
private string $prefix = '',
) {
if (!class_ex | PhpAstExtractor extracts translation messages from a PHP AST.
*
* @author Mathieu Santostefano <msantostefano@protonmail.com>
*/
final class PhpAstExtractor extends AbstractFileExtractor implements ExtractorInterface
{
pri | {
"filepath": "src/Symfony/Component/Translation/Extractor/PhpAstExtractor.php",
"language": "php",
"file_size": 2886,
"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\Translation\Extractor\Visitor;
use PhpParser\Node;
use Symfony\Component\Translation\MessageCatalogue;
/**
* @author Mathieu Santostefano <msantostefano@... | addMessageToCatalogue(string $message, ?string $domain, int $line): void
{
$domain ??= 'messages';
$this->catalogue->set($message, $this->messagePrefix.$message, $domain);
$metadata = $this->catalogue->getMetadata($message, $do | (MessageCatalogue $catalogue, \SplFileInfo $file, string $messagePrefix): void
{
$this->catalogue = $catalogue;
$this->file = $file;
$this->messagePrefix = $messagePrefix;
}
protected function | {
"filepath": "src/Symfony/Component/Translation/Extractor/Visitor/AbstractVisitor.php",
"language": "php",
"file_size": 4526,
"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\Translation\Extractor\Visitor;
use PhpParser\Node;
use PhpParser\NodeVisitor;
/**
* @author Mathieu Sa... | return null;
}
public function enterNode(Node $node): ?Node
{
return null;
}
public function leaveNode(Node $node): ?Node
{
if (!$node instanceof Node\Expr\New_ && !$node instanceof Node\Attribute) {
| tVisitor extends AbstractVisitor implements NodeVisitor
{
public function __construct(
private readonly array $constraintClassNames = [],
) {
}
public function beforeTraverse(array $nodes): ?Node
{
| {
"filepath": "src/Symfony/Component/Translation/Extractor/Visitor/ConstraintVisitor.php",
"language": "php",
"file_size": 2879,
"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\Translation\Extractor\Visitor;
use PhpParser\Node;
use PhpParser\NodeVisitor;
... | ethodCall && !$node instanceof Node\Expr\FuncCall) {
return null;
}
if (!\is_string($node->name) && !$node->name instanceof Node\Identifier && !$node->name instanceof Node\Name) {
return null;
}
$na | $nodes): ?Node
{
return null;
}
public function enterNode(Node $node): ?Node
{
return null;
}
public function leaveNode(Node $node): ?Node
{
if (!$node instanceof Node\Expr\M | {
"filepath": "src/Symfony/Component/Translation/Extractor/Visitor/TransMethodVisitor.php",
"language": "php",
"file_size": 1783,
"cut_index": 537,
"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\Translation\Extractor\Visitor;
use PhpParser\Node;
use PhpParser\NodeVisitor;
... | e\Expr\New_) {
return null;
}
if (!($className = $node->class) instanceof Node\Name) {
return null;
}
if (!\in_array('TranslatableMessage', $className->getParts(), true)) {
return null;
| se(array $nodes): ?Node
{
return null;
}
public function enterNode(Node $node): ?Node
{
return null;
}
public function leaveNode(Node $node): ?Node
{
if (!$node instanceof Nod | {
"filepath": "src/Symfony/Component/Translation/Extractor/Visitor/TranslatableMessageVisitor.php",
"language": "php",
"file_size": 1619,
"cut_index": 537,
"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\Asset;
use Symfony\Component\Asset\Context\ContextInterface;
use Symfony\Compo... | rsionStrategy,
?ContextInterface $context = null,
) {
$this->context = $context ?? new NullContext();
}
public function getVersion(string $path): string
{
return $this->versionStrategy->getVersion($path);
}
| s@symfony.com>
* @author Fabien Potencier <fabien@symfony.com>
*/
class Package implements PackageInterface
{
private ContextInterface $context;
public function __construct(
private VersionStrategyInterface $ve | {
"filepath": "src/Symfony/Component/Asset/Package.php",
"language": "php",
"file_size": 1584,
"cut_index": 537,
"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\Asset;
use Symfony\Component\Asset\Exception\InvalidArgumentException;
use Symfony\Component\Asset\Excep... | [],
) {
foreach ($packages as $name => $package) {
$this->addPackage($name, $package);
}
}
public function setDefaultPackage(PackageInterface $defaultPackage): void
{
$this->defaultPackage = $defaultPac | ackages = [];
/**
* @param PackageInterface[] $packages Additional packages indexed by name
*/
public function __construct(
private ?PackageInterface $defaultPackage = null,
iterable $packages = | {
"filepath": "src/Symfony/Component/Asset/Packages.php",
"language": "php",
"file_size": 2868,
"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\Asset;
use Symfony\Component\Asset\Context\ContextInterface;
use Symfony\Compo... | fony.com>
*/
class PathPackage extends Package
{
private string $basePath;
/**
* @param string $basePath The base path to be prepended to relative paths
*/
public function __construct(string $basePath, VersionStrategyInterface $vers | o automatically
* prepends the current request base path if a Context is available to
* allow a website to be hosted easily under any given path under the Web
* Server root directory.
*
* @author Fabien Potencier <fabien@sym | {
"filepath": "src/Symfony/Component/Asset/PathPackage.php",
"language": "php",
"file_size": 1926,
"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\Asset;
use Symfony\Component\Asset\Context\ContextInterface;
use Symfony\Component\Asset\Exception\InvalidArgumentException;
use Symfony\Component\Asset\Ex... | quest context is available, this package can choose the
* best base URL to use based on the current request scheme:
*
* * For HTTP request, it chooses between all base URLs;
* * For HTTPs requests, it chooses between HTTPs base URLs and relative prot | ows to use more than one base URLs in which case
* it randomly chooses one for each asset; it also guarantees that
* any given path will always use the same base URL to be nice with
* HTTP caching mechanisms.
*
* When the re | {
"filepath": "src/Symfony/Component/Asset/UrlPackage.php",
"language": "php",
"file_size": 3773,
"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\Asset\Exception;
/**
* Represents an asset not found... | essage,
private array $alternatives = [],
int $code = 0,
?\Throwable $previous = null,
) {
parent::__construct($message, $code, $previous);
}
public function getAlternatives(): array
{
return $this-> | t of similar defined names
* @param int $code Exception code
* @param \Throwable $previous Previous exception used for the exception chaining
*/
public function __construct(
string $m | {
"filepath": "src/Symfony/Component/Asset/Exception/AssetNotFoundException.php",
"language": "php",
"file_size": 1019,
"cut_index": 512,
"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\Asset\Context;
use Symfony\Component\HttpFoundation\Requ... | ->requestStack->getMainRequest()) {
return $this->basePath;
}
return $request->getBasePath();
}
public function isSecure(): bool
{
if (!$request = $this->requestStack->getMainRequest()) {
return | on __construct(
private RequestStack $requestStack,
private string $basePath = '',
private bool $secure = false,
) {
}
public function getBasePath(): string
{
if (!$request = $this | {
"filepath": "src/Symfony/Component/Asset/Context/RequestStackContext.php",
"language": "php",
"file_size": 1072,
"cut_index": 515,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Asset\VersionStrategy;
use Symfony\Component\Asset\Exception\AssetNotFoundException;
use Symfony\Component\Asset\Exception\LogicException;
use Symfony\Component\Asset\Exception\RuntimeException;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInte... | in.js" or "css/styles.css".
*/
class JsonManifestVersionStrategy implements VersionStrategyInterface
{
private array $manifestData;
/**
* @param string $manifestPath Absolute path to the manifest file
* @param bool $strictMode Throw | ifest file.
*
* For example, the manifest file might look like this:
* {
* "main.js": "main.abc123.js",
* "css/styles.css": "css/styles.555abc.css"
* }
*
* You could then ask for the version of "ma | {
"filepath": "src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php",
"language": "php",
"file_size": 5405,
"cut_index": 716,
"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\Asset\VersionStrategy;
/**
* Returns the same version for ... |
public function getVersion(string $path): string
{
return $this->version;
}
public function applyVersion(string $path): string
{
$versionized = \sprintf($this->format, ltrim($path, '/'), $this->getVersion($path));
| $version Version number
* @param string $format Url format
*/
public function __construct(
private string $version,
?string $format = null,
) {
$this->format = $format ?: '%s?%s';
}
| {
"filepath": "src/Symfony/Component/Asset/VersionStrategy/StaticVersionStrategy.php",
"language": "php",
"file_size": 1126,
"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\Asset\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framew... | w EmptyVersionStrategy());
$this->assertSame($expected, $package->getUrl($path));
}
public static function getConfigs()
{
return [
['v1', '', 'http://example.com/foo', 'http://example.com/foo'],
['v1', ' | ackageTest extends TestCase
{
#[DataProvider('getConfigs')]
public function testGetUrl($version, $format, $path, $expected)
{
$package = new Package($version ? new StaticVersionStrategy($version, $format) : ne | {
"filepath": "src/Symfony/Component/Asset/Tests/PackageTest.php",
"language": "php",
"file_size": 1780,
"cut_index": 537,
"middle_length": 229
} |
\Translation\Exception\ProviderException;
use Symfony\Component\Translation\Loader\LoaderInterface;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\Provider\ProviderInterface;
use Symfony\Component\Translation\TranslatorBag;
use Symfony\Component\Translation\TranslatorBagInterface;... | rface $client,
private LoaderInterface $loader,
private LoggerInterface $logger,
private string $defaultLocale,
private string $endpoint,
private ?TranslatorBagInterface $translatorBag = null,
private ?string | * Assets refers to Symfony's translation keys
* * Translations refers to Symfony's translated messages
*/
final class LocoProvider implements ProviderInterface
{
public function __construct(
private HttpClientInte | {
"filepath": "src/Symfony/Component/Translation/Bridge/Loco/LocoProvider.php",
"language": "php",
"file_size": 16664,
"cut_index": 921,
"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\Translation\Bridge\Loco\Tests;
use Psr\Log\NullLogger;
use Symfo... | viderFactoryWithoutTranslatorBagTest extends LocoProviderFactoryTest
{
public function createFactory(): ProviderFactoryInterface
{
return new LocoProviderFactory(new MockHttpClient(), new NullLogger(), 'en', new ArrayLoader(), null);
}
| on\Provider\ProviderFactoryInterface;
class LocoPro | {
"filepath": "src/Symfony/Component/Translation/Bridge/Loco/Tests/LocoProviderFactoryWithoutTranslatorBagTest.php",
"language": "php",
"file_size": 833,
"cut_index": 523,
"middle_length": 52
} |
buted with this source code.
*/
namespace Symfony\Component\Translation\Bridge\Loco\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\HttpClient\Response\MockResponse;
use Symfony\Component\Translation\Bridge\Loco... | iderWithoutTranslatorBagTest extends LocoProviderTest
{
public static function createProvider(HttpClientInterface $client, LoaderInterface $loader, LoggerInterface $logger, string $defaultLocale, string $endpoint, ?TranslatorBagInterface $translatorBag |
use Symfony\Component\Translation\TranslatorBag;
use Symfony\Component\Translation\TranslatorBagInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
class LocoProv | {
"filepath": "src/Symfony/Component/Translation/Bridge/Loco/Tests/LocoProviderWithoutTranslatorBagTest.php",
"language": "php",
"file_size": 5208,
"cut_index": 716,
"middle_length": 229
} |
tostefano <msantostefano@protonmail.com>
*
* In Lokalise:
* * Filenames refers to Symfony's translation domains;
* * Keys refers to Symfony's translation keys;
* * Translations refers to Symfony's translated messages
*/
final class LokaliseProvider implements ProviderInterface
{
private const LOKALISE_GET_... | oint,
) {
}
public function __toString(): string
{
return \sprintf('lokalise://%s', $this->endpoint);
}
/**
* Lokalise API recommends sending payload in chunks of up to 500 keys per request.
*
* @see https:/ |
public function __construct(
private HttpClientInterface $client,
private LoaderInterface $loader,
private LoggerInterface $logger,
private string $defaultLocale,
private string $endp | {
"filepath": "src/Symfony/Component/Translation/Bridge/Lokalise/LokaliseProvider.php",
"language": "php",
"file_size": 17852,
"cut_index": 1331,
"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\Translation\Bridge\Lokalise\Tests;
use Psr\Log\NullLogger;
use Symfony\Component\HttpClient\MockHttpClie... | IncompleteDsnTestTrait;
class LokaliseProviderFactoryTest extends AbstractProviderFactoryTestCase
{
use IncompleteDsnTestTrait;
public static function supportsProvider(): iterable
{
yield [true, 'lokalise://PROJECT_ID:API_KEY@default' |
use Symfony\Component\Translation\Provider\Dsn;
use Symfony\Component\Translation\Provider\ProviderFactoryInterface;
use Symfony\Component\Translation\Test\AbstractProviderFactoryTestCase;
use Symfony\Component\Translation\Test\ | {
"filepath": "src/Symfony/Component/Translation/Bridge/Lokalise/Tests/LokaliseProviderFactoryTest.php",
"language": "php",
"file_size": 2331,
"cut_index": 563,
"middle_length": 229
} |
mfony\Component\Mime\Part\Multipart\FormDataPart;
use Symfony\Component\Translation\Dumper\XliffFileDumper;
use Symfony\Component\Translation\Exception\ProviderException;
use Symfony\Component\Translation\Loader\LoaderInterface;
use Symfony\Component\Translation\Provider\ProviderInterface;
use Symfony\Component\Transla... | private readonly LoggerInterface $logger,
private readonly LoaderInterface $loader,
private readonly XliffFileDumper $xliffFileDumper,
private readonly CacheItemPoolInterface $cache,
private readonly string $defaultLocal | @author wicliff <wicliff.wolda@gmail.com>
*/
class PhraseProvider implements ProviderInterface
{
private array $phraseLocales = [];
public function __construct(
private readonly HttpClientInterface $client,
| {
"filepath": "src/Symfony/Component/Translation/Bridge/Phrase/PhraseProvider.php",
"language": "php",
"file_size": 9916,
"cut_index": 921,
"middle_length": 229
} |
$readConfig;
private array $writeConfig;
#[DataProvider('toStringProvider')]
public function testToString(?string $endpoint, string $expected)
{
$provider = $this->createProvider(endpoint: $endpoint);
self::assertSame($expected, (string) $provider);
}
#[DataProvider('readProvi... | use ($responseContent) {
$this->assertSame('W/"625d11cf081b1697cbc216edf6ebb13c"', $item['etag']);
$this->assertSame('Wed, 28 Dec 2022 13:16:45 GMT', $item['modified']);
$this->assertSame($responseContent, $i | heItemInterface::class);
$item->expects(self::once())->method('isHit')->willReturn(false);
$item
->expects(self::once())
->method('set')
->with(self::callback(function ($item) | {
"filepath": "src/Symfony/Component/Translation/Bridge/Phrase/Tests/PhraseProviderTest.php",
"language": "php",
"file_size": 45290,
"cut_index": 2151,
"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\Translation\Test;
use PHPUnit\Framework\Attributes\DataP... | nction testIncompleteDsnException(string $dsn, ?string $message = null)
{
$factory = $this->createFactory();
$dsn = new Dsn($dsn);
$this->expectException(IncompleteDsnException::class);
if (null !== $message) {
| ay{0: string, 1?: string|null}>
*/
abstract public static function incompleteDsnProvider(): iterable;
/**
* @dataProvider incompleteDsnProvider
*/
#[DataProvider('incompleteDsnProvider')]
public fu | {
"filepath": "src/Symfony/Component/Translation/Test/IncompleteDsnTestTrait.php",
"language": "php",
"file_size": 1097,
"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\Translation\Formatter;
use Symfony\Component\Translation\Exception\InvalidArgumentException;
use Symfony... | ormatter constructor throws an exception if the message is empty
if ('' === $message) {
return '';
}
if (!$formatter = $this->cache[$locale][$message] ?? null) {
if (!$this->hasMessageFormatter ??= class_exi | implements IntlFormatterInterface
{
private bool $hasMessageFormatter;
private array $cache = [];
public function formatIntl(string $message, string $locale, array $parameters = []): string
{
// MessageF | {
"filepath": "src/Symfony/Component/Translation/Formatter/IntlFormatter.php",
"language": "php",
"file_size": 2127,
"cut_index": 563,
"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\Translation\Formatter;
/**
* @author Guilherme Blanco <guilhermeblanc... | also be an object that can be cast to string)
* @param string $locale The message locale
* @param array $parameters An array of parameters for the message
*/
public function format(string $message, string $locale, array $parameters | *
* @param string $message The message (may | {
"filepath": "src/Symfony/Component/Translation/Formatter/MessageFormatterInterface.php",
"language": "php",
"file_size": 854,
"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\Translation\Dumper;
use Symfony\Component\Translation\MessageCata... | ch ($messages->all($domain) as $source => $target) {
fputcsv($handle, [$source, $target], $this->delimiter, $this->enclosure, '\\');
}
rewind($handle);
$output = stream_get_contents($handle);
fclose($handle);
| limiter = ';';
private string $enclosure = '"';
public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string
{
$handle = fopen('php://memory', 'r+');
forea | {
"filepath": "src/Symfony/Component/Translation/Dumper/CsvFileDumper.php",
"language": "php",
"file_size": 1374,
"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\Translation\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyI... | ->addTag('translation.extractor', ['alias' => 'bar.alias']);
$translationDumperPass = new TranslationExtractorPass();
$translationDumperPass->process($container);
$this->assertEquals([['addExtractor', ['bar.alias', new Ref | est extends TestCase
{
public function testProcess()
{
$container = new ContainerBuilder();
$extractorDefinition = $container->register('translation.extractor');
$container->register('foo.id')
| {
"filepath": "src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php",
"language": "php",
"file_size": 2215,
"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\Translation\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfo... | DependencyInjection\Fixtures\ServiceArguments;
use Symfony\Component\Translation\Tests\DependencyInjection\Fixtures\ServiceMethodCalls;
use Symfony\Component\Translation\Tests\DependencyInjection\Fixtures\ServiceProperties;
use Symfony\Component\Translatio | jection\ServiceLocator;
use Symfony\Component\Translation\DependencyInjection\TranslatorPathsPass;
use Symfony\Component\Translation\Tests\DependencyInjection\Fixtures\ControllerArguments;
use Symfony\Component\Translation\Tests\ | {
"filepath": "src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationPathsPassTest.php",
"language": "php",
"file_size": 4313,
"cut_index": 614,
"middle_length": 229
} |
ataProvider('resourcesProvider')]
public function testExtraction(iterable|string $resource)
{
$extractor = new PhpAstExtractor([
new TransMethodVisitor(),
new TranslatableMessageVisitor(),
new ConstraintVisitor([
'NotBlank',
'Isbn',
... | and nonescaped \$\n sequences
EOF;
$expectedCatalogue = [
'messages' => [
'translatable single-quoted key' => 'prefixtranslatable single-quoted key',
'translatable double-quoted key' => 'prefi | or->extract($resource, $catalogue);
$expectedHeredoc = <<<EOF
heredoc key with whitespace and escaped \$\n sequences
EOF;
$expectedNowdoc = <<<'EOF'
nowdoc key with whitespace | {
"filepath": "src/Symfony/Component/Translation/Tests/Extractor/PhpAstExtractorTest.php",
"language": "php",
"file_size": 18184,
"cut_index": 1331,
"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\Translation\Bridge\Crowdin;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpClient\Retry\GenericR... | n;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* @author Andrii Bodnar <andrii.bodnar@crowdin.com>
*/
final class CrowdinProviderFactory extends AbstractProviderFactory
{
private const HOST = 'api.crowdin.com';
public function __c | mponent\Translation\Exception\UnsupportedSchemeException;
use Symfony\Component\Translation\Loader\LoaderInterface;
use Symfony\Component\Translation\Provider\AbstractProviderFactory;
use Symfony\Component\Translation\Provider\Ds | {
"filepath": "src/Symfony/Component/Translation/Bridge/Crowdin/CrowdinProviderFactory.php",
"language": "php",
"file_size": 2294,
"cut_index": 563,
"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\Translation\Bridge\Loco;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpClient\Retry\GenericRetr... | use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* @author Mathieu Santostefano <msantostefano@protonmail.com>
*/
final class LocoProviderFactory extends AbstractProviderFactory
{
private const HOST = 'localise.biz';
public function __ | Symfony\Component\Translation\Loader\LoaderInterface;
use Symfony\Component\Translation\Provider\AbstractProviderFactory;
use Symfony\Component\Translation\Provider\Dsn;
use Symfony\Component\Translation\TranslatorBagInterface;
| {
"filepath": "src/Symfony/Component/Translation/Bridge/Loco/LocoProviderFactory.php",
"language": "php",
"file_size": 2269,
"cut_index": 563,
"middle_length": 229
} |
us);
}
public static function toStringProvider(): iterable
{
yield [
self::createProvider((new MockHttpClient())->withOptions([
'base_uri' => 'https://localise.biz/api/',
'headers' => [
'Authorization' => 'Loco API_KEY',
... | NullLogger(), 'en', 'example.com'),
'loco://example.com',
];
yield [
self::createProvider((new MockHttpClient())->withOptions([
'base_uri' => 'https://example.com:99',
'headers' => [ | MockHttpClient())->withOptions([
'base_uri' => 'https://example.com',
'headers' => [
'Authorization' => 'Loco API_KEY',
],
]), new ArrayLoader(), new | {
"filepath": "src/Symfony/Component/Translation/Bridge/Loco/Tests/LocoProviderTest.php",
"language": "php",
"file_size": 61941,
"cut_index": 2151,
"middle_length": 229
} |
, $loader, $logger, $defaultLocale, $endpoint);
}
public static function toStringProvider(): iterable
{
yield [
self::createProvider((new MockHttpClient())->withOptions([
'base_uri' => 'https://api.lokalise.com/api2/projects/PROJECT_ID/',
'headers' => ['X... | example.com'),
'lokalise://example.com',
];
yield [
self::createProvider((new MockHttpClient())->withOptions([
'base_uri' => 'https://example.com:99',
'headers' => ['X-Api-Token' => ' | lf::createProvider((new MockHttpClient())->withOptions([
'base_uri' => 'https://example.com',
'headers' => ['X-Api-Token' => 'API_KEY'],
]), new ArrayLoader(), new NullLogger(), 'en', ' | {
"filepath": "src/Symfony/Component/Translation/Bridge/Lokalise/Tests/LokaliseProviderTest.php",
"language": "php",
"file_size": 49642,
"cut_index": 2151,
"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\Translation\Bridge\Phrase;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Translation\Dumper\XliffFileDumper;
use... | raseProviderFactory extends AbstractProviderFactory
{
private const HOST = 'api.phrase.com';
private const READ_CONFIG_DEFAULT = [
'file_format' => 'symfony_xliff',
'include_empty_translations' => '1',
'tags' => [],
| y;
use Symfony\Component\Translation\Provider\Dsn;
use Symfony\Component\Translation\Provider\ProviderInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* @author wicliff <wicliff.wolda@gmail.com>
*/
class Ph | {
"filepath": "src/Symfony/Component/Translation/Bridge/Phrase/PhraseProviderFactory.php",
"language": "php",
"file_size": 3988,
"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\Translation\Test;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Sym... | ion supportsProvider(): iterable;
/**
* @return iterable<array{0: string, 1: string}>
*/
abstract public static function createProvider(): iterable;
/**
* @return iterable<array{0: string, 1?: string|null}>
*/
abstract | class AbstractProviderFactoryTestCase extends TestCase
{
abstract public function createFactory(): ProviderFactoryInterface;
/**
* @return iterable<array{0: bool, 1: string}>
*/
abstract public static funct | {
"filepath": "src/Symfony/Component/Translation/Test/AbstractProviderFactoryTestCase.php",
"language": "php",
"file_size": 2204,
"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\Translation\Dumper;
use Symfony\Component\Translation\Exception\InvalidArgumentException;
use Symfony\Component\Translation\Exception\RuntimeException;
use... | ected string $relativePathTemplate = '%domain%.%locale%.%extension%';
/**
* Sets the template for the relative paths to files.
*/
public function setRelativePathTemplate(string $relativePathTemplate): void
{
$this->relativePa | directory where the files should be saved
*
* @author Michel Salib <michelsalib@hotmail.com>
*/
abstract class FileDumper implements DumperInterface
{
/**
* A template for the relative paths to files.
*/
prot | {
"filepath": "src/Symfony/Component/Translation/Dumper/FileDumper.php",
"language": "php",
"file_size": 3481,
"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\Translation\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\De... | );
$container->register('monolog.logger');
$container->setAlias('logger', 'monolog.logger');
$container->register('translator.default', '%translator.class%');
$container->register('translator.logging', '%translator.class%'); | TestCase
{
public function testProcess()
{
$container = new ContainerBuilder();
$container->setParameter('translator.logging', true);
$container->setParameter('translator.class', Translator::class | {
"filepath": "src/Symfony/Component/Translation/Tests/DependencyInjection/LoggingTranslatorPassTest.php",
"language": "php",
"file_size": 3181,
"cut_index": 614,
"middle_length": 229
} |
Interface;
/**
* @author Andrii Bodnar <andrii.bodnar@crowdin.com>
*
* In Crowdin:
* * Filenames refer to Symfony's translation domains;
* * Identifiers refer to Symfony's translation keys;
* * Translations refer to Symfony's translated messages
*/
final class CrowdinProvider implements ProviderInterface
{
... | ion __toString(): string
{
return \sprintf('crowdin://%s', $this->endpoint);
}
public function write(TranslatorBagInterface $translatorBag): void
{
$fileList = $this->getFileList();
$languageMapping = $this->getLang | private readonly LoggerInterface $logger,
private readonly XliffFileDumper $xliffFileDumper,
private readonly string $defaultLocale,
private readonly string $endpoint,
) {
}
public funct | {
"filepath": "src/Symfony/Component/Translation/Bridge/Crowdin/CrowdinProvider.php",
"language": "php",
"file_size": 17627,
"cut_index": 1331,
"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\Translation\Bridge\Loco\Tests;
use Psr\Log\NullLogger;
use Symfony\Component\H... | ctoryTest extends AbstractProviderFactoryTestCase
{
use IncompleteDsnTestTrait;
public static function supportsProvider(): iterable
{
yield [true, 'loco://API_KEY@default'];
yield [false, 'somethingElse://API_KEY@default'];
| oviderFactoryInterface;
use Symfony\Component\Translation\Test\AbstractProviderFactoryTestCase;
use Symfony\Component\Translation\Test\IncompleteDsnTestTrait;
use Symfony\Component\Translation\TranslatorBag;
class LocoProviderFa | {
"filepath": "src/Symfony/Component/Translation/Bridge/Loco/Tests/LocoProviderFactoryTest.php",
"language": "php",
"file_size": 1793,
"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\Translation\Bridge\Phrase\Tests;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Symfony\Component\Cache\Ada... | vider\Dsn;
use Symfony\Component\Translation\Test\AbstractProviderFactoryTestCase;
use Symfony\Component\Translation\Test\IncompleteDsnTestTrait;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* @author wicliff <wicliff.wolda@gmail.com>
*/
cl | er;
use Symfony\Component\Translation\Exception\MissingRequiredOptionException;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\Loader\LoaderInterface;
use Symfony\Component\Translation\Pro | {
"filepath": "src/Symfony/Component/Translation/Bridge/Phrase/Tests/PhraseProviderFactoryTest.php",
"language": "php",
"file_size": 4715,
"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\Translation\Test;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\MockObject\MockOb... | use Symfony\Component\Translation\TranslatorBagInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* A test case to ease testing a translation provider.
*
* @author Mathieu Santostefano <msantostefano@protonmail.com>
*/
abstract class | mper;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\Loader\LoaderInterface;
use Symfony\Component\Translation\Provider\ProviderInterface;
use Symfony\Component\Translation\TranslatorBag;
| {
"filepath": "src/Symfony/Component/Translation/Test/ProviderTestCase.php",
"language": "php",
"file_size": 2714,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Translation\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definitio... | ts\TimeValidator;
class TranslatorPassTest extends TestCase
{
public function testValidCollector()
{
$loader = (new Definition())
->addTag('translation.loader', ['alias' => 'xliff', 'legacy-alias' => 'xlf']);
$reader = | tor;
use Symfony\Component\Validator\Constraints\IsbnValidator;
use Symfony\Component\Validator\Constraints\LengthValidator;
use Symfony\Component\Validator\Constraints\NotBlankValidator;
use Symfony\Component\Validator\Constrain | {
"filepath": "src/Symfony/Component/Translation/Tests/DependencyInjection/TranslatorPassTest.php",
"language": "php",
"file_size": 6352,
"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\Translation\Formatter;
use Symfony\Component\Translation\IdentityTranslator;
u... | slatorInterface|null $translator An identity translator to use as selector for pluralization
*/
public function __construct(?TranslatorInterface $translator = null, ?IntlFormatterInterface $intlFormatter = null)
{
$this->translator = $ | udad@gmail.com>
*/
class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterface
{
private TranslatorInterface $translator;
private IntlFormatterInterface $intlFormatter;
/**
* @param Tran | {
"filepath": "src/Symfony/Component/Translation/Formatter/MessageFormatter.php",
"language": "php",
"file_size": 1514,
"cut_index": 537,
"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\Translation\Bridge\Lokalise;
use Psr\Log\LoggerInterface;
use Symfony\Componen... |
private const HOST = 'api.lokalise.com';
public function __construct(
private HttpClientInterface $client,
private LoggerInterface $logger,
private string $defaultLocale,
private LoaderInterface $loader,
) {
| mponent\Translation\Provider\Dsn;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* @author Mathieu Santostefano <msantostefano@protonmail.com>
*/
final class LokaliseProviderFactory extends AbstractProviderFactory
{ | {
"filepath": "src/Symfony/Component/Translation/Bridge/Lokalise/LokaliseProviderFactory.php",
"language": "php",
"file_size": 1856,
"cut_index": 537,
"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\Translation\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
use Sym... | 'foo.id')
->addTag('translation.dumper', ['alias' => 'bar.alias']);
$translationDumperPass = new TranslationDumperPass();
$translationDumperPass->process($container);
$this->assertEquals([['addDumper', ['bar.alias', ne | anslationDumperPassTest extends TestCase
{
public function testProcess()
{
$container = new ContainerBuilder();
$writerDefinition = $container->register('translation.writer');
$container->register( | {
"filepath": "src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationDumperPassTest.php",
"language": "php",
"file_size": 1670,
"cut_index": 537,
"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\Translation\Bridge\Crowdin\Tests;
use Psr\Log\NullLogger;
use Symfony\Componen... | ass CrowdinProviderFactoryTest extends AbstractProviderFactoryTestCase
{
use IncompleteDsnTestTrait;
public static function supportsProvider(): iterable
{
yield [true, 'crowdin://PROJECT_ID:API_TOKEN@default'];
yield [false, 's | n\Loader\ArrayLoader;
use Symfony\Component\Translation\Provider\ProviderFactoryInterface;
use Symfony\Component\Translation\Test\AbstractProviderFactoryTestCase;
use Symfony\Component\Translation\Test\IncompleteDsnTestTrait;
cl | {
"filepath": "src/Symfony/Component/Translation/Bridge/Crowdin/Tests/CrowdinProviderFactoryTest.php",
"language": "php",
"file_size": 1877,
"cut_index": 537,
"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\HttpFoundation;
/**
* RedirectResponse represents an HTTP response doing a redirect.
*
* @author Fabi... | well
* @param int $status The HTTP status code (302 "Found" by default)
* @param array $headers The headers (Location is always set to the given URL)
*
* @throws \InvalidArgumentException
*
* @see https://tools.ietf.org/ | fined for a redirect status code.
*
* @param string $url The URL to redirect to. The URL should be a full URL, with schema etc.,
* but practically every browser redirects on paths only as | {
"filepath": "src/Symfony/Component/HttpFoundation/RedirectResponse.php",
"language": "php",
"file_size": 2629,
"cut_index": 563,
"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\HttpFoundation\RateLimiter;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\RateLimi... | return $this->doConsume($request, 1);
}
public function peek(Request $request): RateLimit
{
return $this->doConsume($request, 0);
}
private function doConsume(Request $request, int $tokens): RateLimit
{
$lim | fits most use-cases.
*
* @author Wouter de Jong <wouter@wouterj.nl>
*/
abstract class AbstractRequestRateLimiter implements PeekableRequestRateLimiterInterface
{
public function consume(Request $request): RateLimit
{
| {
"filepath": "src/Symfony/Component/HttpFoundation/RateLimiter/AbstractRequestRateLimiter.php",
"language": "php",
"file_size": 2443,
"cut_index": 563,
"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\HttpFoundation\RateLimiter;
use Symfony\Component\HttpFo... | gh, and
* only consume if the request failed (1 backend op). This is compared
* to always consuming and then resetting the limit if the request
* is successful (2 backend ops).
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
interface PeekableRequ | e a login when we only want to consume a token on login failure,
* and where the majority of requests will be successful and thus not
* need to consume a token.
*
* This way we can peek ahead before allowing the request throu | {
"filepath": "src/Symfony/Component/HttpFoundation/RateLimiter/PeekableRequestRateLimiterInterface.php",
"language": "php",
"file_size": 1119,
"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\HttpFoundation\RequestMatcher;
use Symfony\Component\HttpFo... | ion matches(Request $request): bool
{
foreach ($this->regexps as $key => $regexp) {
$attribute = $request->attributes->get($key);
if (!\is_string($attribute)) {
return false;
}
if | mfony.com>
*/
class AttributesRequestMatcher implements RequestMatcherInterface
{
/**
* @param array<string, string> $regexps
*/
public function __construct(private array $regexps)
{
}
public funct | {
"filepath": "src/Symfony/Component/HttpFoundation/RequestMatcher/AttributesRequestMatcher.php",
"language": "php",
"file_size": 1132,
"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\HttpFoundation\RequestMatcher;
use Symfony\Component\ExpressionLa... | private ExpressionLanguage $language,
private Expression|string $expression,
) {
}
public function matches(Request $request): bool
{
return $this->language->evaluate($this->expression, [
'request' => $reques |
* ExpressionRequestMatcher uses an expression to match a Request.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class ExpressionRequestMatcher implements RequestMatcherInterface
{
public function __construct(
| {
"filepath": "src/Symfony/Component/HttpFoundation/RequestMatcher/ExpressionRequestMatcher.php",
"language": "php",
"file_size": 1285,
"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\HttpFoundation\RequestMatcher;
use Symfony\Component\HttpFoundati... | Strings can contain a comma-delimited list of headers
*/
public function __construct(array|string $headers)
{
$this->headers = array_reduce((array) $headers, static fn (array $headers, string $header) => array_merge($ |
class HeaderRequestMatcher implements RequestMatcherInterface
{
/**
* @var string[]
*/
private array $headers;
/**
* @param string[]|string $headers A header or a list of headers
* | {
"filepath": "src/Symfony/Component/HttpFoundation/RequestMatcher/HeaderRequestMatcher.php",
"language": "php",
"file_size": 1372,
"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\HttpFoundation\RequestMatcher;
use Symfony\Component\HttpF... | /
class HostRequestMatcher implements RequestMatcherInterface
{
public function __construct(private string $regexp)
{
}
public function matches(Request $request): bool
{
return preg_match('{'.$this->regexp.'}i', $request->getHo | ymfony.com>
* | {
"filepath": "src/Symfony/Component/HttpFoundation/RequestMatcher/HostRequestMatcher.php",
"language": "php",
"file_size": 802,
"cut_index": 517,
"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\HttpFoundation\RequestMatcher;
use Symfony\Component\HttpFoundati... | 1.0/24
* Strings can contain a comma-delimited list of IPs/ranges
*/
public function __construct(array|string $ips)
{
$this->ips = array_reduce((array) $ips, static fn (array $ips, string $ip) => array_ | r <fabien@symfony.com>
*/
class IpsRequestMatcher implements RequestMatcherInterface
{
private array $ips;
/**
* @param string[]|string $ips A specific IP address or a range specified using IP/netmask like 192.168. | {
"filepath": "src/Symfony/Component/HttpFoundation/RequestMatcher/IpsRequestMatcher.php",
"language": "php",
"file_size": 1269,
"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\HttpFoundation\RequestMatcher;
use Symfony\Component\HttpFoundati... | Strings can contain a comma-delimited list of methods
*/
public function __construct(array|string $methods)
{
$this->methods = array_reduce(array_map('strtoupper', (array) $methods), static fn (array $methods, string | stMatcher implements RequestMatcherInterface
{
/**
* @var string[]
*/
private array $methods = [];
/**
* @param string[]|string $methods An HTTP method or an array of HTTP methods
* | {
"filepath": "src/Symfony/Component/HttpFoundation/RequestMatcher/MethodRequestMatcher.php",
"language": "php",
"file_size": 1294,
"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\HttpFoundation\RequestMatcher;
use Symfony\Component\HttpFounda... | ss PathRequestMatcher implements RequestMatcherInterface
{
public function __construct(private string $regexp)
{
}
public function matches(Request $request): bool
{
return preg_match('{'.$this->regexp.'}', rawurldecode($request | y.com>
*/
cla | {
"filepath": "src/Symfony/Component/HttpFoundation/RequestMatcher/PathRequestMatcher.php",
"language": "php",
"file_size": 819,
"cut_index": 522,
"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\HttpFoundation\RequestMatcher;
use Symfony\Component\HttpFoundati... | ameters
* Strings can contain a comma-delimited list of query parameters
*/
public function __construct(array|string $parameters)
{
$this->parameters = array_reduce(array_map(strtolower(...), (ar | .com>
*/
class QueryParameterRequestMatcher implements RequestMatcherInterface
{
/**
* @var string[]
*/
private array $parameters;
/**
* @param string[]|string $parameters A parameter or a list of par | {
"filepath": "src/Symfony/Component/HttpFoundation/RequestMatcher/QueryParameterRequestMatcher.php",
"language": "php",
"file_size": 1382,
"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\HttpFoundation\RequestMatcher;
use Symfony\Component\HttpFoundati... | Strings can contain a comma-delimited list of schemes
*/
public function __construct(array|string $schemes)
{
$this->schemes = array_reduce(array_map('strtolower', (array) $schemes), static fn (array $schemes, string $scheme) => array_ | stMatcher implements RequestMatcherInterface
{
/**
* @var string[]
*/
private array $schemes;
/**
* @param string[]|string $schemes A scheme or a list of schemes
* | {
"filepath": "src/Symfony/Component/HttpFoundation/RequestMatcher/SchemeRequestMatcher.php",
"language": "php",
"file_size": 1276,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpFoundation\Session;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\Htt... | );
/**
* @author Fabien Potencier <fabien@symfony.com>
* @author Drak <drak@zikula.org>
*
* @implements \IteratorAggregate<string, mixed>
*/
class Session implements FlashBagAwareSessionInterface, \IteratorAggregate, \Countable
{
protected Sessio | mfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface;
// Help opcache.preload discover always-needed symbols
class_exists(AttributeBag::class);
class_exists(FlashBag::class);
class_exists(SessionBagProxy::class | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Session.php",
"language": "php",
"file_size": 5805,
"cut_index": 716,
"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\HttpFoundation\Session;
/**
* Session Bag store.
*
... | : void;
/**
* Gets the storage key for this bag.
*/
public function getStorageKey(): string;
/**
* Clears out data from bag.
*
* @return mixed Whatever data was contained
*/
public function clear(): mixed;
}
| */
public function initialize(array &$array) | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php",
"language": "php",
"file_size": 820,
"cut_index": 512,
"middle_length": 52
} |
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\HttpFoundation\Session;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
final class Se... | usageReporter = null === $usageReporter ? null : $usageReporter(...);
}
public function getBag(): SessionBagInterface
{
++$this->usageIndex;
if ($this->usageReporter && 0 <= $this->usageIndex) {
($this->usageReporte | ssionBagInterface $bag,
array &$data,
?int &$usageIndex,
?callable $usageReporter,
) {
$this->bag = $bag;
$this->data = &$data;
$this->usageIndex = &$usageIndex;
$this-> | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php",
"language": "php",
"file_size": 2032,
"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\HttpFoundation\Session;
use Symfony\Component\HttpFoundatio... | private SessionStorageFactoryInterface $storageFactory,
?callable $usageReporter = null,
) {
$this->usageReporter = null === $usageReporter ? null : $usageReporter(...);
}
public function createSession(): SessionInterface
| * @author Jérémy Derussé <jeremy@derusse.com>
*/
class SessionFactory implements SessionFactoryInterface
{
private ?\Closure $usageReporter;
public function __construct(
private RequestStack $requestStack,
| {
"filepath": "src/Symfony/Component/HttpFoundation/Session/SessionFactory.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\HttpFoundation\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
/**
* Interface for the session.
*
* @author Drak <drak@zikul... | public function getName(): string;
/**
* Sets the session name.
*/
public function setName(string $name): void;
/**
* Invalidates the current session.
*
* Clears all session attributes and flashes and regenerates the
|
/**
* Returns the session ID.
*/
public function getId(): string;
/**
* Sets the session ID.
*/
public function setId(string $id): void;
/**
* Returns the session name.
*/
| {
"filepath": "src/Symfony/Component/HttpFoundation/Session/SessionInterface.php",
"language": "php",
"file_size": 3671,
"cut_index": 614,
"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\HttpFoundation\Session;
/**
* Session utility functions.
*
* @author Nicola... | okie = null;
$sessionCookiePrefix = \sprintf(' %s=', urlencode($sessionName));
$sessionCookieWithId = \sprintf('%s%s;', $sessionCookiePrefix, urlencode($sessionId));
$otherCookies = [];
foreach (headers_list() as $h) {
| be sent, removes it, and returns
* it so the caller can process it further.
*/
public static function popSessionCookie(string $sessionName, #[\SensitiveParameter] string $sessionId): ?string
{
$sessionCo | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/SessionUtils.php",
"language": "php",
"file_size": 1654,
"cut_index": 537,
"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\HttpFoundation\Session\Attribute;
/**
* This class relates to session attribute storage.
*
* @impleme... | function getName(): string
{
return $this->name;
}
public function setName(string $name): void
{
$this->name = $name;
}
public function initialize(array &$attributes): void
{
$this->attributes = &$attri | = 'attributes';
/**
* @param string $storageKey The key used to store attributes in the session
*/
public function __construct(
private string $storageKey = '_sf2_attributes',
) {
}
public | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php",
"language": "php",
"file_size": 2627,
"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\HttpFoundation\Session\Attribute;
use Symfony\Component\Htt... | .
*/
public function set(string $name, mixed $value): void;
/**
* Returns attributes.
*
* @return array<string, mixed>
*/
public function all(): array;
public function replace(array $attributes): void;
/**
| if an attribute is defined.
*/
public function has(string $name): bool;
/**
* Returns an attribute.
*/
public function get(string $name, mixed $default = null): mixed;
/**
* Sets an attribute | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php",
"language": "php",
"file_size": 1166,
"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\HttpFoundation\Session\Flash;
/**
* AutoExpireFlashBag flash message container.
*
* @author Drak <drak@zikula.org>
*/
class AutoExpireFlashBag implemen... | setName(string $name): void
{
$this->name = $name;
}
public function initialize(array &$flashes): void
{
$this->flashes = &$flashes;
// The logic: messages from the last request will be stored in new, so we move th | s in the session
*/
public function __construct(
private string $storageKey = '_symfony_flashes',
) {
}
public function getName(): string
{
return $this->name;
}
public function | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php",
"language": "php",
"file_size": 3059,
"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\HttpFoundation\Session\Flash;
/**
* FlashBag flash message container.
*
* @author Drak <drak@zikula.o... | on setName(string $name): void
{
$this->name = $name;
}
public function initialize(array &$flashes): void
{
$this->flashes = &$flashes;
}
public function add(string $type, mixed $message): void
{
$this- | shes in the session
*/
public function __construct(
private string $storageKey = '_symfony_flashes',
) {
}
public function getName(): string
{
return $this->name;
}
public functi | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php",
"language": "php",
"file_size": 2338,
"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\HttpFoundation\Session\Flash;
use Symfony\Component\HttpFoundation\Session\Ses... | * Gets flash messages for a given type.
*
* @param string $type Message category type
* @param array $default Default value if $type does not exist
*/
public function peek(string $type, array $default = []): array;
/**
| n type.
*/
public function add(string $type, mixed $message): void;
/**
* Registers one or more messages for a given type.
*/
public function set(string $type, string|array $messages): void;
/**
| {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php",
"language": "php",
"file_size": 1705,
"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\HttpFoundation\Session\Storage;
use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
/**
* Metadata container.
*
* Adds metadata to the se... | store bag in the session
* @param int $updateThreshold The time to wait between two UPDATED updates
* @param int|null $cookieLifetime The configured cookie lifetime; null to read from php.ini
*/
public function __construct(
| l';
protected array $meta = [self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0];
private string $name = '__metadata';
private int $lastUsed;
/**
* @param string $storageKey The key used to | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php",
"language": "php",
"file_size": 3456,
"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\HttpFoundation\Session\Storage;
use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
/**
* MockArraySessionStorage mocks the session for uni... | erface
{
protected string $id = '';
protected bool $started = false;
protected bool $closed = false;
protected array $data = [];
protected MetadataBag $metadataBag;
/**
* @var SessionBagInterface[]
*/
protected array | FileSessionStorage instead.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Bulat Shakirzyanov <mallluhuct@gmail.com>
* @author Drak <drak@zikula.org>
*/
class MockArraySessionStorage implements SessionStorageInt | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php",
"language": "php",
"file_size": 4450,
"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\HttpFoundation\Session\Storage;
/**
* MockFileSessionStorage is used to mock sessions for
* functional testing where you may need to persist session data... | Path;
/**
* @param string|null $savePath Path of directory to save session files
*/
public function __construct(?string $savePath = null, string $name = 'MOCKSESSID', ?MetadataBag $metaBag = null)
{
$savePath ??= sys_get_temp | ute any session related globals, including session_*() functions
* or session.* PHP ini directives.
*
* @author Drak <drak@zikula.org>
*/
class MockFileSessionStorage extends MockArraySessionStorage
{
private string $save | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php",
"language": "php",
"file_size": 3924,
"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\HttpFoundation\Session\Storage;
use Symfony\Component... | ng $name = 'MOCKSESSID',
private ?MetadataBag $metaBag = null,
) {
}
public function createStorage(?Request $request): SessionStorageInterface
{
return new MockFileSessionStorage($this->savePath, $this->name, $this->metaBag | FileSessionStorageFactory implements SessionStorageFactoryInterface
{
/**
* @see MockFileSessionStorage constructor.
*/
public function __construct(
private ?string $savePath = null,
private stri | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorageFactory.php",
"language": "php",
"file_size": 1011,
"cut_index": 512,
"middle_length": 229
} |
\Storage\Handler\StrictSessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
// Help opcache.preload discover always-needed symbols
class_exists(MetadataBag::class);
class_exists(StrictSessionHandler::cl... | rface $saveHandler;
protected MetadataBag $metadataBag;
/**
* Depending on how you want the storage driver to behave you probably
* want to override this constructor entirely.
*
* List of options for $options array with their d | SessionStorageInterface
{
/**
* @var SessionBagInterface[]
*/
protected array $bags = [];
protected bool $started = false;
protected bool $closed = false;
protected AbstractProxy|\SessionHandlerInte | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php",
"language": "php",
"file_size": 13043,
"cut_index": 921,
"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\HttpFoundation\Session\Storage;
use Symfony\Component\HttpFoundat... | private array $options = [],
private AbstractProxy|\SessionHandlerInterface|null $handler = null,
private ?MetadataBag $metaBag = null,
private bool $secure = false,
) {
}
public function createStorage(?Request $reque | * @author Jérémy Derussé <jeremy@derusse.com>
*/
class NativeSessionStorageFactory implements SessionStorageFactoryInterface
{
/**
* @see NativeSessionStorage constructor.
*/
public function __construct(
| {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorageFactory.php",
"language": "php",
"file_size": 1299,
"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\HttpFoundation\Session\Storage;
use Symfony\Component\HttpFoundat... | n('PHP extension "session" is required.');
}
$this->setMetadataBag($metaBag);
$this->setSaveHandler($handler);
}
public function start(): bool
{
if ($this->started) {
return true;
}
| veSessionStorage
{
public function __construct(AbstractProxy|\SessionHandlerInterface|null $handler = null, ?MetadataBag $metaBag = null)
{
if (!\extension_loaded('session')) {
throw new \LogicExceptio | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php",
"language": "php",
"file_size": 1391,
"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\HttpFoundation\Session\Storage;
use Symfony\Component\HttpF... | ull $handler = null,
private ?MetadataBag $metaBag = null,
private bool $secure = false,
) {
}
public function createStorage(?Request $request): SessionStorageInterface
{
$storage = new PhpBridgeSessionStorage($this | );
/**
* @author Jérémy Derussé <jeremy@derusse.com>
*/
class PhpBridgeSessionStorageFactory implements SessionStorageFactoryInterface
{
public function __construct(
private AbstractProxy|\SessionHandlerInterface|n | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorageFactory.php",
"language": "php",
"file_size": 1193,
"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\HttpFoundation\Session\Storage;
use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
/**
* StorageInterface.
*
* @author Fabien Potencier ... | n getId(): string;
/**
* Sets the session ID.
*/
public function setId(string $id): void;
/**
* Returns the session name.
*/
public function getName(): string;
/**
* Sets the session name.
*/
public | g starting the session
*/
public function start(): bool;
/**
* Checks if the session is started.
*/
public function isStarted(): bool;
/**
* Returns the session ID.
*/
public functio | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php",
"language": "php",
"file_size": 3757,
"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\HttpFoundation\Session\Storage\Proxy;
/**
* @author Drak <drak@zikula.org>
*/
abstract class AbstractP... | instanceof \SessionHandlerInterface;
}
/**
* Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.
*/
public function isWrapper(): bool
{
return $this->wrapper;
}
/**
| : ?string
{
return $this->saveHandlerName;
}
/**
* Is this proxy handler and instance of \SessionHandlerInterface.
*/
public function isSessionHandlerInterface(): bool
{
return $this | {
"filepath": "src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php",
"language": "php",
"file_size": 2039,
"cut_index": 563,
"middle_length": 229
} |
st HTTP_UNAUTHORIZED = 401;
public const HTTP_PAYMENT_REQUIRED = 402;
public const HTTP_FORBIDDEN = 403;
public const HTTP_NOT_FOUND = 404;
public const HTTP_METHOD_NOT_ALLOWED = 405;
public const HTTP_NOT_ACCEPTABLE = 406;
public const HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
public const ... | const HTTP_EXPECTATION_FAILED = 417;
public const HTTP_I_AM_A_TEAPOT = 418; // RFC2324
public const HTTP_MISDIRECTED_REQUEST = 421; // RFC7540
public const H | ;
public const HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
public const HTTP_REQUEST_URI_TOO_LONG = 414;
public const HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
public const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
public | {
"filepath": "src/Symfony/Component/HttpFoundation/Response.php",
"language": "php",
"file_size": 40791,
"cut_index": 2151,
"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\HttpFoundation;
/**
* ServerBag is a container for HTTP headers from the $_SERVER variable.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author... | (\in_array($key, ['CONTENT_TYPE', 'CONTENT_LENGTH', 'CONTENT_MD5'], true) && '' !== $value) {
$headers[$key] = $value;
}
}
if (isset($this->parameters['PHP_AUTH_USER'])) {
$headers['PHP_AUTH_USER'] | n getHeaders(): array
{
$headers = [];
foreach ($this->parameters as $key => $value) {
if (str_starts_with($key, 'HTTP_')) {
$headers[substr($key, 5)] = $value;
} elseif | {
"filepath": "src/Symfony/Component/HttpFoundation/ServerBag.php",
"language": "php",
"file_size": 4010,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpFoundation;
/**
* StreamedJsonResponse represents a streamed HTTP response for JSON.
*
* A StreamedJsonResponse uses a structure and generics to create an
* efficient resource-saving JSON response.
*
* It is recommended to use flush() function aft... | ic number of items
* }),
*
* $response = new StreamedJsonResponse(
* // json structure with generators in which will be streamed
* [
* '_embedded' => [
* 'articles' => loadArticles(), // any genera | ator
* // some streamed loading
* yield ['title' => 'Article 1'];
* yield ['title' => 'Article 2'];
* yield ['title' => 'Article 3'];
* // recommended to use flush() after every specif | {
"filepath": "src/Symfony/Component/HttpFoundation/StreamedJsonResponse.php",
"language": "php",
"file_size": 5782,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpFoundation;
use Psr\Clock\ClockInterface;
use Symfony\Component\HttpFoundation\Exception\ExpiredSignedUriException;
use Symfony\Component\HttpFoundation\Exception\LogicException;
use Symfony\Component\HttpFoundation\Exception\SignedUriException;
use Sym... | string parameter to use
* @param string $expirationParameter Query string parameter to use for expiration
*/
public function __construct(
#[\SensitiveParameter] private string $secret,
private string $hashParameter = '_hash', |
*/
class UriSigner
{
private const STATUS_VALID = 1;
private const STATUS_INVALID = 2;
private const STATUS_MISSING = 3;
private const STATUS_EXPIRED = 4;
/**
* @param string $hashParameter Query | {
"filepath": "src/Symfony/Component/HttpFoundation/UriSigner.php",
"language": "php",
"file_size": 7192,
"cut_index": 716,
"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\HttpFoundation\Exception;
/**
* Raised when a session does n... | ds \LogicException implements RequestExceptionInterface
{
public function __construct(string $message = 'There is currently no session available.', int $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previou | erusse.com>
*/
class SessionNotFoundException exten | {
"filepath": "src/Symfony/Component/HttpFoundation/Exception/SessionNotFoundException.php",
"language": "php",
"file_size": 843,
"cut_index": 520,
"middle_length": 52
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.