prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
tion\PseudoTypes\Generic;
use phpDocumentor\Reflection\PseudoTypes\List_;
use phpDocumentor\Reflection\PseudoTypes\Scalar;
use phpDocumentor\Reflection\Type as DocType;
use phpDocumentor\Reflection\Types\Array_;
use phpDocumentor\Reflection\Types\Collection;
use phpDocumentor\Reflection\Types\Compound;
use phpDocumento... | autoloader here, so we don't need to trigger it inside the loop later.
class_exists(List_::class);
/**
* Transforms a php doc type to a {@link Type} instance.
*
* @author Kévin Dunglas <dunglas@gmail.com>
* @author Guilhem N. <egetick@gmail.com>
*/
| Reflection\Types\String_;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\Type\BuiltinType;
use Symfony\Component\TypeInfo\TypeIdentifier;
// Workaround for phpdocumentor/type-resolver < 1.6
// We trigger the | {
"filepath": "src/Symfony/Component/PropertyInfo/Util/PhpDocTypeHelper.php",
"language": "php",
"file_size": 9733,
"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\PropertyInfo\Tests\Fixtures;
use Symfony\Component\PropertyInfo\Extractor\ConstructorArgumentTypeExtract... | vin Dunglas <dunglas@gmail.com>
*/
class DummyExtractor implements PropertyListExtractorInterface, PropertyDescriptionExtractorInterface, PropertyTypeExtractorInterface, PropertyAccessExtractorInterface, PropertyInitializableExtractorInterface, Constructo | ropertyInitializableExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\TypeInfo\Type;
/**
* @author Ké | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/DummyExtractor.php",
"language": "php",
"file_size": 2043,
"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\PropertyInfo\Tests\Fixtures;
/**
* @author Martin Rademacher <... | * Foo.
*
* @param
*/
public function setFoo($foo)
{
}
/**
* Bar.
*
* @return
*/
public function getBar()
{
return 'bar';
}
/**
* @param $baz
*/
public function setB |
/**
| {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/InvalidDummy.php",
"language": "php",
"file_size": 815,
"cut_index": 522,
"middle_length": 14
} |
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\PropertyInfo\Tests\Fixtures;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class ... | /
public ?array $nullableTypedCollection = null;
public function addStringCollection(string $string): void
{
}
public function removeStringCollection(string $string): void
{
}
public function addNullableTypedCollection(Du | rray $collection = [];
/** @var Dummy[]|null * | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/Php74Dummy.php",
"language": "php",
"file_size": 888,
"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\PropertyInfo\Tests\Fixtures;
class Php80Dummy
{
public mixed ... | t,
/**
* @var int
*/
private mixed $promotedWithDocCommentAndType,
private array $collection,
)
{
}
public function getFoo(): array|null
{
}
public function setBar(int|null $bar)
{ | collection
*/
public function __construct(
private mixed $promoted,
private mixed $promotedAndMutated,
/**
* Comment without @var.
*/
private mixed $promotedWithDocCommen | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/Php80Dummy.php",
"language": "php",
"file_size": 1326,
"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\PropertyInfo\Tests\Fixtures\TraitUsage;
use Symfony\Compone... | /**
* @return string
*/
public function getMethodInTraitPrimitiveType()
{
return 'value';
}
/**
* @return DummyUsedInTrait
*/
public function getMethodInTraitObjectSameNamespace()
{
return new | private $propertyInTraitPrimitiveType;
/**
* @var DummyUsedInTrait
*/
private $propertyInTraitObjectSameNamespace;
/**
* @var Dummy
*/
private $propertyInTraitObjectDifferentNamespace;
| {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/TraitUsage/DummyTrait.php",
"language": "php",
"file_size": 1173,
"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\PropertyInfo\Tests\Fixtures\Extractor;
class ParentWithSelfDocBlock
{
/**
... | * @return self
*/
public function getSelfTraitAccessor()
{
return $this;
}
/**
* @param self $value
*/
public function setSelfTraitMutator($value)
{
}
}
class ClassUsingTraitWithSelfDocBlock
{
us | */
public function setSelfMutator($value)
{
}
}
class ChildWithSelfDocBlock extends ParentWithSelfDocBlock
{
}
trait TraitWithSelfDocBlock
{
/**
* @var self
*/
public $selfTraitProp;
/**
| {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/Extractor/ParentWithSelfDocBlock.php",
"language": "php",
"file_size": 1664,
"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\PropertyInfo;
use Symfony\Component\TypeInfo\Type;
/**
* Default {@see PropertyInfoExtractorInterface} implementation.
*
* @author Kévin Dunglas <dungl... | * @param iterable<mixed, PropertyAccessExtractorInterface> $accessExtractors
* @param iterable<mixed, PropertyInitializableExtractorInterface> $initializableExtractors
*/
public function __construct(
private readonly iterab | stExtractorInterface> $listExtractors
* @param iterable<mixed, PropertyTypeExtractorInterface> $typeExtractors
* @param iterable<mixed, PropertyDescriptionExtractorInterface> $descriptionExtractors
| {
"filepath": "src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php",
"language": "php",
"file_size": 3482,
"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\PropertyInfo\Tests\Fixtures;
interface IFace {}
class ... | */
public $basicInterface;
/**
* @var ?IFace<Dummy>
*/
public $nullableInterface;
/**
* @var Clazz<int, Dummy>
*/
public $twoGenerics;
/**
* @var Clazz<int, Dummy, string>
*/
public $threeGeneric | e<Dummy>
| {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/DummyGeneric.php",
"language": "php",
"file_size": 789,
"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\PropertyInfo\Tests\Fixtures;
class SnakeCaseDummy
{
private ... | $this->snake_readOnly;
}
public function setSnakeProperty($snake_property)
{
$this->snake_property = $snake_property;
}
public function setSnake_method($snake_method)
{
$this->snake_method = $snake_method;
}
} | lic function getSnakeReadOnly()
{
return | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/SnakeCaseDummy.php",
"language": "php",
"file_size": 832,
"cut_index": 523,
"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\PropertyInfo;
/**
* The write mutator defines how a property can be written.
*
* @author Joel Wurtz <jwurtz@jolicode.com>
*/
final class PropertyWriteI... | o = null;
private ?self $removerInfo = null;
private array $errors = [];
public function __construct(
private readonly string $type = self::TYPE_NONE,
private readonly ?string $name = null,
private readonly ?string $vis | public const TYPE_CONSTRUCTOR = 'constructor';
public const VISIBILITY_PUBLIC = 'public';
public const VISIBILITY_PROTECTED = 'protected';
public const VISIBILITY_PRIVATE = 'private';
private ?self $adderInf | {
"filepath": "src/Symfony/Component/PropertyInfo/PropertyWriteInfo.php",
"language": "php",
"file_size": 3068,
"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\PropertyInfo\Tests\Fixtures;
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
use Sy... | r implements PropertyListExtractorInterface, PropertyDescriptionExtractorInterface, PropertyTypeExtractorInterface, PropertyAccessExtractorInterface, PropertyInitializableExtractorInterface
{
public function getShortDescription($class, $property, array | xtractorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\TypeInfo\Type;
/**
* Not able to guess anything.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class NullExtracto | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/NullExtractor.php",
"language": "php",
"file_size": 2678,
"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\PropertyInfo\Tests\Fixtures;
/**
* PhpDocExtractor should ... | n int
*/
public function getProtAcc(): int
{
return $this->protAcc;
}
public function setProt($protAcc)
{
$this->protAcc = $protAcc;
}
public function getProtMut()
{
return $this->protMut;
| c $pub = 'pub';
protected $protAcc;
protected $protMut;
public function getPub()
{
return $this->pub;
}
public function setPub($pub)
{
$this->pub = $pub;
}
/**
* @retur | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/DockBlockFallback.php",
"language": "php",
"file_size": 1140,
"cut_index": 518,
"middle_length": 229
} |
nt\Ldap\Adapter\ExtLdap\Adapter;
use Symfony\Component\Ldap\Adapter\ExtLdap\Collection;
use Symfony\Component\Ldap\Adapter\ExtLdap\Query;
use Symfony\Component\Ldap\Entry;
use Symfony\Component\Ldap\Exception\LdapException;
use Symfony\Component\Ldap\Exception\NotBoundException;
use Symfony\Component\Ldap\LdapInterface... | $h = @ldap_connect('ldap://'.getenv('LDAP_HOST').':'.getenv('LDAP_PORT'));
@ldap_set_option($h, \LDAP_OPT_PROTOCOL_VERSION, 3);
if (!$h || !@ldap_bind($h)) {
$this->markTestSkipped('No server is listening on LDAP_HOST:LD | $ldap = new Adapter();
$this->assertEquals('\20foo\3dbar\0d(baz)*\20', $ldap->escape(" foo=bar\r(baz)* ", '', LdapInterface::ESCAPE_DN));
}
#[Group('functional')]
public function testSaslBind()
{
| {
"filepath": "src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php",
"language": "php",
"file_size": 9773,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\VarExporter\Internal;
use Symfony\Component\VarExporter\Exception\ClassNotFoundException;
use Symfony\Component\VarExporter\Exception\NotInstantiableTypeException;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
class Registry
{
publi... | serialize_callback_func', __CLASS__.'::getClassReflector');
try {
foreach ($serializables as $k => $v) {
$objects[$k] = unserialize($v);
}
} finally {
ini_set('unserialize_callback_func', | leWithoutConstructor = [];
public function __construct(
public readonly array $classes,
) {
}
public static function unserialize($objects, $serializables)
{
$unserializeCallback = ini_set('un | {
"filepath": "src/Symfony/Component/VarExporter/Internal/Registry.php",
"language": "php",
"file_size": 5403,
"cut_index": 716,
"middle_length": 229
} |
= FooUnitEnum::Bar;
$this->assertSame($enum, DeepCloner::deepClone($enum));
}
public function testSimpleObject()
{
$obj = new \stdClass();
$obj->foo = 'bar';
$obj->baz = 123;
$clone = DeepCloner::deepClone($obj);
$this->assertNotSame($obj, $clone);
... | ame($outer, $clone);
$this->assertNotSame($inner, $clone->child);
$this->assertSame('inner', $clone->child->value);
$this->assertSame('outer', $clone->name);
// Mutating original doesn't affect clone
$inner->value = | er = new \stdClass();
$inner->value = 'inner';
$outer = new \stdClass();
$outer->child = $inner;
$outer->name = 'outer';
$clone = DeepCloner::deepClone($outer);
$this->assertNotS | {
"filepath": "src/Symfony/Component/VarExporter/Tests/DeepCloneTest.php",
"language": "php",
"file_size": 35494,
"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\VarExporter\Tests;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\TestCase;
use Symfony... | is->assertSame(123, $object->getValue());
$this->assertSame('hydrated', $object->status);
}
public function testHydrateInitializedReadonlyPropertyDifferentValueThrows()
{
$object = new HydratorTestClass(123);
$this->ex | InitializedReadonlyPropertySameValueIsIdempotent()
{
$object = new HydratorTestClass(123);
Hydrator::hydrate($object, [
'value' => 123,
'status' => 'hydrated',
]);
$th | {
"filepath": "src/Symfony/Component/VarExporter/Tests/HydratorTest.php",
"language": "php",
"file_size": 3235,
"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\VarExporter\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\IgnoreDeprecatio... | $this->expectExceptionMessage('Class "SomeNotExistingClass" not found.');
Instantiator::instantiate('SomeNotExistingClass');
}
#[DataProvider('provideFailingInstantiation')]
public function testFailingInstantiation(string $class) | mponent\VarExporter\Instantiator;
#[Group('legacy')]
#[IgnoreDeprecations]
class InstantiatorTest extends TestCase
{
public function testNotFoundClass()
{
$this->expectException(ClassNotFoundException::class);
| {
"filepath": "src/Symfony/Component/VarExporter/Tests/InstantiatorTest.php",
"language": "php",
"file_size": 3207,
"cut_index": 614,
"middle_length": 229
} |
t\Serializer\Mapping\Loader\AttributeLoader;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\VarExporter\Exception\LogicException;
use Symfony\Component\VarExporter\ProxyHelper;
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\AbstractHooked;
use Symfony\Component\VarExport... | ;
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\StringMagicGetClass;
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\TestClass;
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\TestOverwritePropClass;
use Symfony\Component | inalPublicClass;
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\Hooked;
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\ReadOnlyClass;
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\RegularClass | {
"filepath": "src/Symfony/Component/VarExporter/Tests/LazyProxyTraitTest.php",
"language": "php",
"file_size": 14232,
"cut_index": 921,
"middle_length": 229
} |
r;
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\Hooked;
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\Php82NullStandaloneReturnType;
class ProxyHelperTest extends TestCase
{
#[DataProvider('provideExportSignature')]
public function testExportSignature(string $expected, \ReflectionMet... | -(1 + $method->isAbstract()));
$expected = str_replace(['.', ' . . . ', '\'$a\', \'$a\n\', "\$a\n"'], [' . ', '...', '\'$a\', "\$a\\\n", "\$a\n"'], $expected);
$expected = str_replace('Bar', '\\'.Bar::class, $expected);
| tionClass(TestForProxyHelper::class))->getMethods();
$source = file(__FILE__);
foreach ($methods as $method) {
$expected = substr($source[$method->getStartLine() - 1], $method->isAbstract() ? 13 : 4, | {
"filepath": "src/Symfony/Component/VarExporter/Tests/ProxyHelperTest.php",
"language": "php",
"file_size": 13451,
"cut_index": 921,
"middle_length": 229
} |
erTestTrait;
use Symfony\Component\VarExporter\Exception\ClassNotFoundException;
use Symfony\Component\VarExporter\Exception\NotInstantiableTypeException;
use Symfony\Component\VarExporter\Internal\Registry;
use Symfony\Component\VarExporter\Tests\Fixtures\BackedProperty;
use Symfony\Component\VarExporter\Tests\Fixture... | xporter\Tests\Fixtures\PrivateFCC;
use Symfony\Component\VarExporter\Tests\Fixtures\SleepUninitialized;
use Symfony\Component\VarExporter\VarExporter;
$errorHandler = set_error_handler(static function (int $errno, string $errstr) use (&$errorHandler) {
| GoodNight;
use Symfony\Component\VarExporter\Tests\Fixtures\MySerializable;
use Symfony\Component\VarExporter\Tests\Fixtures\MyWakeup;
use Symfony\Component\VarExporter\Tests\Fixtures\Php74Serializable;
use Symfony\Component\VarE | {
"filepath": "src/Symfony/Component/VarExporter/Tests/VarExporterTest.php",
"language": "php",
"file_size": 13209,
"cut_index": 921,
"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\VarExporter\Tests\Fixtures;
class Php74Serializable implements \Serializable
{
public $foo;
public function __serialize(): array
{
... | public function __wakeup(): void
{
throw new \BadMethodCallException();
}
public function serialize(): string
{
throw new \BadMethodCallException();
}
public function unserialize($ser)
{
throw new \Ba | throw new \BadMethodCallException();
}
| {
"filepath": "src/Symfony/Component/VarExporter/Tests/Fixtures/Php74Serializable.php",
"language": "php",
"file_size": 946,
"cut_index": 606,
"middle_length": 52
} |
from_array([
'classes' => ['DateTime', 'DateTimeImmutable', 'DateTimeZone', 'DateInterval', 'DatePeriod'],
'objectMeta' => [
[0, -1],
[1, -2],
[2, -3],
[3, -4],
[4, -7],
[1, -5],
[3, -6],
],
'prepared' => [0, 1, 2, 3, 4],
'mask' => [true, true,... | [
3,
['y' => 0, 'm' => 0, 'd' => 7, 'h' => 0, 'i' => 0, 's' => 0, 'f' => 0.0, 'invert' => 0, 'days' => 7, 'from_string' => false],
],
[
5,
['date' => '2009-10-11 00:00:00.000000', 'timezon | 1,
['date' => '1970-01-01 00:00:00.000000', 'timezone_type' => 1, 'timezone' => '+00:00'],
],
[
2,
['timezone_type' => 3, 'timezone' => 'Europe/Paris'],
],
| {
"filepath": "src/Symfony/Component/VarExporter/Tests/Fixtures/datetime.php",
"language": "php",
"file_size": 1508,
"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\PropertyAccess;
/**
* Entry point of the PropertyAccess component.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
final class PropertyA... | }
public static function createPropertyAccessorBuilder(): PropertyAccessorBuilder
{
return new PropertyAccessorBuilder();
}
/**
* This class cannot be instantiated.
*/
private function __construct()
{
}
} | tePropertyAccessorBuilder()->getPropertyAccessor();
| {
"filepath": "src/Symfony/Component/PropertyAccess/PropertyAccess.php",
"language": "php",
"file_size": 915,
"cut_index": 606,
"middle_length": 52
} |
nt\PropertyAccess\Exception\UnexpectedTypeException;
use Symfony\Component\PropertyAccess\Exception\UninitializedPropertyException;
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
use Symfony\Component\PropertyInfo\PropertyReadInfo;
use Symfony\Component\PropertyInfo\PropertyReadInfoExtractorInterface... | Allow none of the magic methods */
public const DISALLOW_MAGIC_METHODS = ReflectionExtractor::DISALLOW_MAGIC_METHODS;
/** @var int Allow magic __get methods */
public const MAGIC_GET = ReflectionExtractor::ALLOW_MAGIC_GET;
/** @var int Allo | ce}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
* @author Kévin Dunglas <dunglas@gmail.com>
* @author Nicolas Grekas <p@tchwork.com>
*/
class PropertyAccessor implements PropertyAccessorInterface
{
/** @var int | {
"filepath": "src/Symfony/Component/PropertyAccess/PropertyAccessor.php",
"language": "php",
"file_size": 30847,
"cut_index": 1331,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\PropertyAccess;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\PropertyInfo\PropertyReadInfoExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyWriteInfoExtractorInterface;
/**
* A configurable builder to create a PropertyAccessor.... | $readInfoExtractor = null;
private ?PropertyWriteInfoExtractorInterface $writeInfoExtractor = null;
/**
* Enables the use of all magic methods by the PropertyAccessor.
*
* @return $this
*/
public function enableMagicMethods | ET;
private bool $throwExceptionOnInvalidIndex = false;
private bool $throwExceptionOnInvalidPropertyPath = true;
private ?CacheItemPoolInterface $cacheItemPool = null;
private ?PropertyReadInfoExtractorInterface | {
"filepath": "src/Symfony/Component/PropertyAccess/PropertyAccessorBuilder.php",
"language": "php",
"file_size": 7618,
"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\PropertyAccess;
/**
* Writes and reads values to/from an object/array graph.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface PropertyA... | en');
*
* This method first tries to find a public setter for each property in the
* path. The name of the setter must be the camel-cased property name
* prefixed with "set".
*
* If the setter does not exist, this method tries | ss;
*
* $propertyAccessor = PropertyAccess::createPropertyAccessor();
*
* echo $propertyAccessor->setValue($object, 'child.name', 'Fabien');
* // equals echo $object->getChild()->setName('Fabi | {
"filepath": "src/Symfony/Component/PropertyAccess/PropertyAccessorInterface.php",
"language": "php",
"file_size": 3980,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\PropertyAccess;
use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException;
use Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException;
use Symfony\Component\PropertyAccess\Exception\OutOfBoundsException;
/**
* Default implem... |
* @var list<string>
*/
private array $elements = [];
/**
* The number of elements in the property path.
*/
private int $length;
/**
* Contains a Boolean for each property in $elements denoting whether this
* | gregate, PropertyPathInterface
{
/**
* Character used for separating between plural and singular of an element.
*/
public const SINGULAR_SEPARATOR = '|';
/**
* The elements of the property path.
* | {
"filepath": "src/Symfony/Component/PropertyAccess/PropertyPath.php",
"language": "php",
"file_size": 7226,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\PropertyAccess;
use Symfony\Component\PropertyAccess\Exception\OutOfBoundsException;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class PropertyPathBuilder
{
private array $elements = [];
private array $isIndex = [];
public funct... | PropertyPathInterface|string $path, int $offset = 0, int $length = 0): void
{
if (\is_string($path)) {
$path = new PropertyPath($path);
}
if (0 === $length) {
$end = $path->getLength();
} else {
| he current path.
*
* @param int $offset The offset where the appended piece starts in $path
* @param int $length The length of the appended piece; if 0, the full path is appended
*/
public function append( | {
"filepath": "src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php",
"language": "php",
"file_size": 8432,
"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\PropertyAccess;
/**
* A sequence of property names or array indices.
*
* @author Bernhard Schussek <b... | property path.
*
* The parent property path is the one that contains the same items as
* this one except for the last one.
*
* If this property path only contains one item, null is returned.
*/
public function getParent(): | perty path.
*/
public function __toString(): string;
/**
* Returns the length of the property path, i.e. the number of elements.
*/
public function getLength(): int;
/**
* Returns the parent | {
"filepath": "src/Symfony/Component/PropertyAccess/PropertyPathInterface.php",
"language": "php",
"file_size": 2162,
"cut_index": 563,
"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\PropertyAccess;
/**
* Traverses a property path and provides additional methods to find out
* information about the curre... | protected PropertyPathInterface $path,
) {
parent::__construct($path->getElements());
}
public function isIndex(): bool
{
return $this->path->isIndex($this->key());
}
public function isProperty(): bool
{
| orInterface
{
public function __construct(
| {
"filepath": "src/Symfony/Component/PropertyAccess/PropertyPathIterator.php",
"language": "php",
"file_size": 949,
"cut_index": 582,
"middle_length": 52
} |
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\PropertyAccess\Exception;
/**
* Thrown when a type of given value does not match an expected type.
*
* @author Farhad Sa... | y string $propertyPath,
?\Throwable $previous = null,
) {
parent::__construct(
\sprintf('Expected argument of type "%s", "%s" given at property path "%s".', $expectedType, 'NULL' === $actualType ? 'null' : $actualType, $prop | readonly string $actualType,
public readonl | {
"filepath": "src/Symfony/Component/PropertyAccess/Exception/InvalidTypeException.php",
"language": "php",
"file_size": 953,
"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\PropertyAccess\Exception;
use Symfony\Component\PropertyAcc... | construct(mixed $value, PropertyPathInterface $path, int $pathIndex)
{
$message = \sprintf(
'PropertyAccessor requires a graph of objects or arrays to operate on, '.
'but it found type "%s" while trying to traverse path | xception
{
/**
* @param mixed $value The unexpected value found while traversing property path
* @param int $pathIndex The property path index when the unexpected value was found
*/
public function __ | {
"filepath": "src/Symfony/Component/PropertyAccess/Exception/UnexpectedTypeException.php",
"language": "php",
"file_size": 1187,
"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\PropertyAccess\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use... | ected static function getContainer(array $array);
public static function getValidPropertyPaths(): array
{
return [
[static::getContainer(['firstName' => 'Bernhard']), '[firstName]', 'Bernhard'],
[static::getContaine | opertyAccessorArrayAccessTestCase extends TestCase
{
protected PropertyAccessor $propertyAccessor;
protected function setUp(): void
{
$this->propertyAccessor = new PropertyAccessor();
}
abstract prot | {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTestCase.php",
"language": "php",
"file_size": 3042,
"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\PropertyAccess\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\PropertyAccess\PropertyAccess... | public function testEnableMagicGet()
{
$this->assertSame($this->builder, $this->builder->enableMagicGet());
$this->assertTrue($this->builder->isMagicGetEnabled());
}
public function testDisableMagicGet()
{
$this->a | ractorInterface;
class PropertyAccessorBuilderTest extends TestCase
{
protected PropertyAccessorBuilder $builder;
protected function setUp(): void
{
$this->builder = new PropertyAccessorBuilder();
}
| {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorBuilderTest.php",
"language": "php",
"file_size": 4343,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\PropertyAccess\Tests;
use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
class PropertyAccessorCollectionTestCase_Car
{
private $axes;
public function __construct($axes = null)
{
$this->axes = $axes;
}
// ... | urn $this->axes;
}
}
class PropertyAccessorCollectionTestCase_CarOnlyAdder
{
public function addAxis($axis)
{
}
public function getAxes()
{
}
}
class PropertyAccessorCollectionTestCase_CarOnlyRemover
{
public function rem | foreach ($this->axes as $key => $value) {
if ($value === $axis) {
unset($this->axes[$key]);
return;
}
}
}
public function getAxes()
{
ret | {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTestCase.php",
"language": "php",
"file_size": 6016,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Filesystem\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Filesystem\Filesystem;
class FilesystemTestCase extends TestCase
{
protected array $longPathNamesWindows = [];
protected Filesystem $filesystem;
protected string $workspace... | ink($originFile, $targetFile)) {
$report = error_get_last();
if (\is_array($report) && str_contains($report['message'], 'error code(1314)')) {
self::$linkOnWindows = false;
}
} | if ('\\' === \DIRECTORY_SEPARATOR) {
self::$linkOnWindows = true;
$originFile = tempnam(sys_get_temp_dir(), 'li');
$targetFile = tempnam(sys_get_temp_dir(), 'li');
if (true !== @l | {
"filepath": "src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php",
"language": "php",
"file_size": 5109,
"cut_index": 716,
"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\VarExporter;
interface LazyObjectInterface
{
/**
* Returns wh... | es initialization of a lazy object and returns it.
*/
public function initializeLazyObject(): object;
/**
* @return bool Returns false when the object cannot be reset, ie when it's not a lazy object
*/
public function resetLazyO | d(bool $partial = false): bool;
/**
* Forc | {
"filepath": "src/Symfony/Component/VarExporter/LazyObjectInterface.php",
"language": "php",
"file_size": 854,
"cut_index": 529,
"middle_length": 52
} |
ny\Component\PropertyAccess\Tests\Fixtures\TestClassTypedProperty;
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassTypeErrorInsideCall;
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestIgnoreVoidAccessor;
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestPublicPropertyDynamicallyCreated;
use S... | cess\Tests\Fixtures\UninitializedObjectProperty;
use Symfony\Component\PropertyAccess\Tests\Fixtures\UninitializedPrivateProperty;
use Symfony\Component\PropertyAccess\Tests\Fixtures\UninitializedProperty;
class PropertyAccessorTest extends TestCase
{
| nent\PropertyAccess\Tests\Fixtures\TestSingularAndPluralProps;
use Symfony\Component\PropertyAccess\Tests\Fixtures\Ticket5775Object;
use Symfony\Component\PropertyAccess\Tests\Fixtures\TypeHinted;
use Symfony\Component\PropertyAc | {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php",
"language": "php",
"file_size": 47066,
"cut_index": 2151,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\PropertyAccess\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\PropertyAccess\PropertyPath;
use Symfony\Component\PropertyAccess\PropertyPathBuilder;
/**
* @author Bernhard Schussek <bschussek@gm... | ilder->getPropertyPath());
}
public function testCreateCopyPath()
{
$this->assertEquals(new PropertyPath(self::PREFIX), $this->builder->getPropertyPath());
}
public function testAppendIndex()
{
$this->builder->appe | setUp(): void
{
$this->builder = new PropertyPathBuilder(new PropertyPath(self::PREFIX));
}
public function testCreateEmpty()
{
$builder = new PropertyPathBuilder();
$this->assertNull($bu | {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php",
"language": "php",
"file_size": 8574,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\PropertyAccess\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException;
use Symfony\Component\PropertyAccess\PropertyPath;
class PropertyPathTest exte... | function testDotCannotBePresentAtTheBeginning()
{
$this->expectException(InvalidPropertyPathException::class);
new PropertyPath('.property');
}
public static function providePathsContainingUnexpectedCharacters()
{
| operty', $path->__toString());
}
public function testDotIsRequiredBeforeProperty()
{
$this->expectException(InvalidPropertyPathException::class);
new PropertyPath('[index]property');
}
public | {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/PropertyPathTest.php",
"language": "php",
"file_size": 7222,
"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\PropertyAccess\Tests;
class TestPluralAdderRemoverAndS... | $this->aircraft = ['plane'];
}
public function addAircraft($aircraft)
{
$this->aircraft[] = $aircraft;
}
public function removeAircraft($aircraft)
{
$this->aircraft = array_diff($this->aircraft, [$aircraft]);
} | {
| {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/TestPluralAdderRemoverAndSetterSameSingularAndPlural.php",
"language": "php",
"file_size": 786,
"cut_index": 513,
"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\PropertyAccess\Tests\Fixtures;
/**
* This class is a hand writte... | set, $this->array);
}
public function offsetGet($offset): mixed
{
return $this->array[$offset];
}
public function offsetSet($offset, $value): void
{
if (null === $offset) {
$this->array[] = $value;
| \Countable
{
private $array;
public function __construct(?array $array = null)
{
$this->array = $array ?: [];
}
public function offsetExists($offset): bool
{
return \array_key_exists($off | {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/Fixtures/NonTraversableArrayObject.php",
"language": "php",
"file_size": 1444,
"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\PropertyAccess\Tests\Fixtures;
class TestClass
{
public $publicProperty;
protected $protectedProperty;
private $privateProperty;
private $... | {
$this->publicProperty = $value;
$this->publicAccessor = $value;
$this->publicMethodAccessor = $value;
$this->publicGetSetter = $value;
$this->publicAccessorWithDefaultValue = $value;
$this->publicAccessor | e $publicAccessorWithMoreRequiredParameters;
private $publicIsAccessor;
private $publicHasAccessor;
private $publicCanAccessor;
private $publicGetter;
private $date;
public function __construct($value)
| {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClass.php",
"language": "php",
"file_size": 4609,
"cut_index": 614,
"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\PropertyAccess\Tests\Fixtures;
class TestClassMagicCall
{
private $magicCallProperty;
publi... | }
if ('getConstantMagicCallProperty' === $method) {
return 'constant value';
}
if ('setMagicCallProperty' === $method) {
$this->magicCallProperty = reset($args);
}
return null;
| hod) {
return $this->magicCallProperty;
| {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassMagicCall.php",
"language": "php",
"file_size": 871,
"cut_index": 559,
"middle_length": 52
} |
\CollectionInterface;
use Symfony\Component\Ldap\Adapter\QueryInterface;
use Symfony\Component\Ldap\Entry;
use Symfony\Component\Ldap\Exception\ConnectionException;
use Symfony\Component\Ldap\LdapInterface;
use Symfony\Component\Ldap\Security\LdapUser;
use Symfony\Component\Ldap\Security\LdapUserProvider;
use Symfony\C... | on(ConnectionException::class);
$ldap = $this->createMock(LdapInterface::class);
$ldap
->expects($this->once())
->method('bind')
->willThrowException(new ConnectionException())
;
$provid | curity\Core\Exception\UserNotFoundException;
#[RequiresPhpExtension('ldap')]
class LdapUserProviderTest extends TestCase
{
public function testLoadUserByIdentifierFailsIfCantConnectToLdap()
{
$this->expectExcepti | {
"filepath": "src/Symfony/Component/Ldap/Tests/Security/LdapUserProviderTest.php",
"language": "php",
"file_size": 14926,
"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\PropertyAccess\Tests\Fixtures;
class TestIgnoreVoidAccessor
{
public bool $setValue = false;
public bool $setterVal... | e = true;
}
public function setNeverValue(): never
{
// Simulate a setter that does not return anything and exits
$this->neverValue = true;
exit;
}
public function setUndefinedValue(): void
{
// Thi | tSetterValue(): void
{
$this->setterValu | {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestIgnoreVoidAccessor.php",
"language": "php",
"file_size": 964,
"cut_index": 582,
"middle_length": 52
} |
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\PropertyAccess\Tests\Fixtures;
/**
* Notice we don't have getter/setter for emails
* because we count on adder/remover.
... | il(?string $email)
{
$this->email = $email;
}
public function getEmails(): array
{
return $this->emails;
}
public function addEmail(string $email)
{
$this->emails[] = $email;
}
public function | turn $this->email;
}
public function setEma | {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestSingularAndPluralProps.php",
"language": "php",
"file_size": 992,
"cut_index": 582,
"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\Ldap\Security;
use Symfony\Component\Ldap\Entry;
use Symfony\Component\Security\Core\User\EquatableInter... | sitiveParameter] private ?string $password,
private array $roles = [],
private array $extraFields = [],
) {
if (!$identifier) {
throw new \InvalidArgumentException('The username cannot be empty.');
}
}
|
*
* @final
*/
class LdapUser implements UserInterface, PasswordAuthenticatedUserInterface, EquatableInterface
{
public function __construct(
private Entry $entry,
private string $identifier,
#[\Sen | {
"filepath": "src/Symfony/Component/Ldap/Security/LdapUser.php",
"language": "php",
"file_size": 2355,
"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\Ldap\Security;
use Symfony\Component\Ldap\Entry;
final class Mem... | try): array
{
if (!$entry->hasAttribute($this->attributeName)) {
return [];
}
$roles = [];
foreach ($entry->getAttribute($this->attributeName) as $group) {
$groupName = $this->getGroupName($group | ate readonly string $attributeName = 'ismemberof',
private readonly string $groupNameRegex = '/^CN=(?P<group>[^,]+),ou.*$/i',
) {
}
/**
* @return string[]
*/
public function fetchRoles(Entry $en | {
"filepath": "src/Symfony/Component/Ldap/Security/MemberOfRoles.php",
"language": "php",
"file_size": 1411,
"cut_index": 524,
"middle_length": 229
} |
written only when the
* $overwriteNewerFiles option is set to true.
*
* @throws FileNotFoundException When originFile doesn't exist
* @throws IOException When copy fails
*/
public function copy(string $originFile, string $targetFile, bool $overwriteNewerFiles = false): void
{
... | ($originFile, \PHP_URL_HOST) && is_file($targetFile)) {
$doCopy = filemtime($originFile) > filemtime($targetFile);
}
if ($doCopy) {
// https://bugs.php.net/64634
if (!$source = self::box('fopen', $origin | on(\sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
}
$this->mkdir(\dirname($targetFile));
$doCopy = true;
if (!$overwriteNewerFiles && !parse_url | {
"filepath": "src/Symfony/Component/Filesystem/Filesystem.php",
"language": "php",
"file_size": 30520,
"cut_index": 1331,
"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\Filesystem\Exception;
/**
* Exception class thrown when a file couldn't be found.
*
* @author Fabien Potencier <fabien@s... | $path = null)
{
if (null === $message) {
if (null === $path) {
$message = 'File could not be found.';
} else {
$message = \sprintf('File "%s" could not be found.', $path);
}
| int $code = 0, ?\Throwable $previous = null, ?string | {
"filepath": "src/Symfony/Component/Filesystem/Exception/FileNotFoundException.php",
"language": "php",
"file_size": 973,
"cut_index": 582,
"middle_length": 52
} |
th = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
file_put_contents($sourceFilePath, 'SOURCE FILE');
file_put_contents($targetFilePath, 'TARGET FILE');
// make sure both files have the same modification time
$modificationTime = time() - 1000;
touch($sourceFilePath,... | $targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
file_put_contents($sourceFilePath, 'SOURCE FILE');
file_put_contents($targetFilePath, 'TARGET FILE');
// make sure both files have the same modifica | $this->assertStringEqualsFile($targetFilePath, 'TARGET FILE');
}
public function testCopyOverridesExistingFileIfForced()
{
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
| {
"filepath": "src/Symfony/Component/Filesystem/Tests/FilesystemTest.php",
"language": "php",
"file_size": 68214,
"cut_index": 3790,
"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\Filesystem\Tests\Fixtures\MockStream;
/**
* Mock stream class to... | )
* @param int $options Holds additional flags set by the streams API
* @param string|null $opened_path If the path is opened successfully, and STREAM_USE_PATH is set in options,
* opened_path shou | /**
* Opens file or URL.
*
* @param string $path Specifies the URL that was passed to the original function
* @param string $mode The mode used to open the file, as detailed for fopen( | {
"filepath": "src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php",
"language": "php",
"file_size": 1476,
"cut_index": 524,
"middle_length": 229
} |
se Symfony\Component\VarExporter\Exception\NotInstantiableTypeException;
/**
* Deep-clones PHP values while preserving copy-on-write benefits for strings and arrays.
*
* Unlike unserialize(serialize()), this approach does not reallocate strings and scalar-only
* arrays, allowing PHP's copy-on-write mechanism to sh... | than serialize($value) itself.
*
* The heavy lifting is delegated to deepclone_to_array() / deepclone_from_array(), which
* come from either the native `deepclone` PHP extension (for a 4-5x speedup) or the
* `symfony/polyfill-deepclone` package when th | for encoding with
* json_encode(), var_export(), or any serializer that handles plain PHP arrays.
* The format uses a compact representation that deduplicates class and property names,
* typically producing a payload smaller | {
"filepath": "src/Symfony/Component/VarExporter/DeepCloner.php",
"language": "php",
"file_size": 10422,
"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\VarExporter;
use Symfony\Component\VarExporter\Exception\ClassNotFoundException;
use Symfony\Component\VarExporter\Exception\ExceptionInterface;
use Symfon... | m the deepclone extension instead
*/
final class Instantiator
{
/**
* Creates an object and sets its properties without calling its constructor nor any other methods.
*
* @see Hydrator::hydrate() for examples
*
* @template T o | extension instead.', Instantiator::class);
/**
* A utility class to create objects without calling their constructor.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @deprecated since Symfony 8.1, use deepclone_hydrate() fro | {
"filepath": "src/Symfony/Component/VarExporter/Instantiator.php",
"language": "php",
"file_size": 3138,
"cut_index": 614,
"middle_length": 229
} |
rray $interfaces = []): string
{
if (!class_exists($class?->name ?? \stdClass::class, false)) {
throw new LogicException(\sprintf('Cannot generate lazy proxy: "%s" is not a class.', $class->name));
}
if ($class?->isFinal()) {
throw new LogicException(\sprintf('Cannot ... | e lazy proxy: leverage native lazy objects instead for class "%s".', $class->name));
}
}
$propertyScopes = $class ? LazyObjectRegistry::$propertyScopes[$class->name] ??= LazyObjectRegistry::getPropertyScopes($class->name) : []; | ernalClass = $parent->isInternal();
} while (!$extendsInternalClass && $parent = $parent->getParentClass());
if (!$extendsInternalClass) {
throw new LogicException(\sprintf('Cannot generat | {
"filepath": "src/Symfony/Component/VarExporter/ProxyHelper.php",
"language": "php",
"file_size": 19477,
"cut_index": 1331,
"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\VarExporter\Internal;
use Symfony\Component\Serializer\Attribute\Ignore;
use Symfony\Component\VarExporter\Internal\LazyObjectRegistry as Registry;
/**
*... | e ? $instance::class : static::class;
if (self::class === $class && \defined($class.'::LAZY_OBJECT_PROPERTY_SCOPES')) {
Registry::$propertyScopes[$class] ??= $class::LAZY_OBJECT_PROPERTY_SCOPES;
}
$instance ??= (Regist | :object $initializer Returns the proxied object
* @param static|null $instance
*/
public static function createLazyProxy(\Closure $initializer, ?object $instance = null): static
{
$class = $instanc | {
"filepath": "src/Symfony/Component/VarExporter/Internal/LazyDecoratorTrait.php",
"language": "php",
"file_size": 4701,
"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\VarExporter\Internal;
/**
* Keeps the state of lazy object... | unset($this->cloneInstance);
}
} elseif (isset($this->realInstance)) {
$this->realInstance = clone $this->realInstance;
}
}
public function __get($name)
{
if ('realInstance' !== $name) {
| public object $cloneInstance;
public function __clone()
{
if (isset($this->cloneInstance)) {
try {
$this->realInstance = $this->cloneInstance;
} finally {
| {
"filepath": "src/Symfony/Component/VarExporter/Internal/LazyObjectState.php",
"language": "php",
"file_size": 1184,
"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\Ldap\Tests\Adapter\ExtLdap;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCas... | Message('Entry "$$$$$$" malformed, could not parse RDN.');
$entry = new Entry('$$$$$$');
$entryManager = new EntryManager(new Connection());
$entryManager->move($entry, 'a');
}
public function testGetResources()
{
| ception;
use Symfony\Component\Ldap\Exception\NotBoundException;
class EntryManagerTest extends TestCase
{
public function testMove()
{
$this->expectException(LdapException::class);
$this->expectException | {
"filepath": "src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/EntryManagerTest.php",
"language": "php",
"file_size": 2473,
"cut_index": 563,
"middle_length": 229
} |
nt\Ldap\Adapter\CollectionInterface;
use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter;
use Symfony\Component\Ldap\Adapter\ExtLdap\UpdateOperation;
use Symfony\Component\Ldap\Entry;
use Symfony\Component\Ldap\Exception\LdapException;
use Symfony\Component\Ldap\Exception\NotBoundException;
use Symfony\Component\Ldap\Ex... | roup('functional')]
public function testLdapAddAndRemove()
{
$this->executeSearchQuery(1);
$entry = new Entry('cn=Charles Sarrazin,dc=symfony,dc=com', [
'sn' => ['csarrazi'],
'objectclass' => [
| te Adapter $adapter;
protected function setUp(): void
{
$this->adapter = new Adapter($this->getLdapConfig());
$this->adapter->getConnection()->bind('cn=admin,dc=symfony,dc=com', 'symfony');
}
#[G | {
"filepath": "src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php",
"language": "php",
"file_size": 12110,
"cut_index": 921,
"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\PropertyAccess\Tests\Fixtures;
class TestClassMagicGet... | return $this->magicProperty;
}
if ('constantMagicProperty' === $property) {
return 'constant value';
}
}
public function __isset(string $property): bool
{
return \in_array($property, ['magic | rty, $value): void
{
if ('magicProperty' === $property) {
$this->magicProperty = $value;
}
}
public function __get(string $property)
{
if ('magicProperty' === $property) {
| {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassMagicGet.php",
"language": "php",
"file_size": 1050,
"cut_index": 513,
"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\Ldap\Security;
use Psr\Container\ContainerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Ldap\Exception\I... | tEvent;
/**
* Verifies password credentials using an LDAP service whenever the
* LdapBadge is attached to the Security passport.
*
* @author Wouter de Jong <wouter@wouterj.nl>
*/
class CheckLdapCredentialsListener implements EventSubscriberInterface
| redentialsException;
use Symfony\Component\Security\Core\Exception\LogicException;
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
use Symfony\Component\Security\Http\Event\CheckPasspor | {
"filepath": "src/Symfony/Component/Ldap/Security/CheckLdapCredentialsListener.php",
"language": "php",
"file_size": 4711,
"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\Ldap\Security;
use Symfony\Component\Security\Http\Authenticator\Passport\Badg... | private string $dnString = '{user_identifier}',
private string $searchDn = '',
private string $searchPassword = '',
?string $queryString = null,
) {
$this->queryString = $queryString ?? '';
}
public function get | outer@wouterj.nl>
*
* @final
*/
class LdapBadge implements BadgeInterface
{
private bool $resolved = false;
private string $queryString;
public function __construct(
private string $ldapServiceId,
| {
"filepath": "src/Symfony/Component/Ldap/Security/LdapBadge.php",
"language": "php",
"file_size": 1633,
"cut_index": 537,
"middle_length": 229
} |
<bschussek@gmail.com>
* @author Thomas Schulz <mail@king2500.net>
* @author Théo Fidry <theo.fidry@gmail.com>
*/
final class Path
{
/**
* The number of buffer entries that triggers a cleanup operation.
*/
private const CLEANUP_THRESHOLD = 1250;
/**
* The buffer size after the cleanup ope... | ning of relative paths are not removed.
* On Windows, backward slashes are replaced by forward slashes ("/").
*
* ```php
* echo Path::canonicalize("../css/./style.css");
* // => ../css/style.css
* ```
*
* This method | $buffer = [];
private static int $bufferSize = 0;
/**
* Canonicalizes the given path.
*
* During normalization, all "." and ".." segments are removed as far as
* possible. ".." segments at the begin | {
"filepath": "src/Symfony/Component/Filesystem/Path.php",
"language": "php",
"file_size": 26306,
"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\Filesystem\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Com... | $e = new FileNotFoundException(null, 0, null, '/foo');
$this->assertEquals('/foo', $e->getPath());
$this->assertEquals('File "/foo" could not be found.', $e->getMessage(), 'A message should be generated.');
}
public function tes | lic function testGetPath()
{
$e = new IOException('', 0, null, '/foo');
$this->assertEquals('/foo', $e->getPath(), 'The pass should be returned.');
}
public function testGeneratedMessage()
{
| {
"filepath": "src/Symfony/Component/Filesystem/Tests/ExceptionTest.php",
"language": "php",
"file_size": 1422,
"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\VarExporter;
trigger_deprecation('symfony/var-exporter', '8.1', 'The "%s" class is deprecated, use "deepclone_hydrate()" from the deepclone extension inste... | object->propertyName property
* Hydrator::hydrate($object, ['propertyName' => $propertyValue]);
*
* // Sets a private property defined on its parent Bar class:
* Hydrator::hydrate($object, ["\0Bar\0privateBarProperty" => $pr | from the deepclone extension instead
*/
final class Hydrator
{
/**
* Sets the properties of an object, including private and protected ones.
*
* For example:
*
* // Sets the public or protected $ | {
"filepath": "src/Symfony/Component/VarExporter/Hydrator.php",
"language": "php",
"file_size": 3562,
"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\VarExporter;
use Symfony\Component\VarExporter\Exception\ExceptionInterface;
use Symfony\Component\VarEx... | th unserialize().
*
* @author Nicolas Grekas <p@tchwork.com>
*/
final class VarExporter
{
/**
* Exports a serializable PHP value to PHP code.
*
* @param bool &$isStaticValue Set to true after execution if | P data structures to plain PHP code (like var_export())
* while preserving all the semantics associated with serialize() (unlike var_export()).
*
* By leveraging OPcache, the generated PHP code is faster than doing the same wi | {
"filepath": "src/Symfony/Component/VarExporter/VarExporter.php",
"language": "php",
"file_size": 2482,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\VarExporter\Internal;
/**
* Stores the state of lazy objects and caches related reflection information.
*
* As a micro-optimization, this class uses no type declarations.
*
* @internal
*/
class LazyObjectRegistry
{
public const PROPERTY_HAS_HOOKS ... | ass-string, array{get: \Closure, set: \Closure, isset: \Closure, unset: \Closure}>
*/
public static array $classAccessors = [];
/**
* @var array<class-string, int>
*/
public static array $parentGet = [];
public static array | s-string, array<string, mixed>>
*/
public static array $defaultProperties = [];
/**
* @var array<class-string, list<\Closure>>
*/
public static array $classResetters = [];
/**
* @var array<cl | {
"filepath": "src/Symfony/Component/VarExporter/Internal/LazyObjectRegistry.php",
"language": "php",
"file_size": 5231,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Ldap\Tests\Security;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Ldap... | Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\Core\User\InMemoryUser;
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterfac | \Component\Ldap\LdapInterface;
use Symfony\Component\Ldap\Security\CheckLdapCredentialsListener;
use Symfony\Component\Ldap\Security\LdapBadge;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\ | {
"filepath": "src/Symfony/Component/Ldap/Tests/Security/CheckLdapCredentialsListenerTest.php",
"language": "php",
"file_size": 9029,
"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\Ldap\Tests\Security;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Htt... | rt\Passport;
class LdapAuthenticatorTest extends TestCase
{
public function testAuthenticate()
{
$decorated = $this->createMock(AuthenticatorInterface::class);
$passport = new Passport(new UserBadge('test'), new PasswordCredentials | ace;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
use Symfony\Component\Security\Http\Authenticator\Passpo | {
"filepath": "src/Symfony/Component/Ldap/Tests/Security/LdapAuthenticatorTest.php",
"language": "php",
"file_size": 1539,
"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\Ldap\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authenticat... | mponent\Security\Http\EntryPoint\Exception\NotAnEntryPointException;
/**
* This class decorates internal authenticators to add the LDAP integration.
*
* In your own authenticators, it is recommended to directly use the
* LdapBadge in the authenticate( | \Security\Http\Authenticator\InteractiveAuthenticatorInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
use Symfony\Co | {
"filepath": "src/Symfony/Component/Ldap/Security/LdapAuthenticator.php",
"language": "php",
"file_size": 3438,
"cut_index": 614,
"middle_length": 229
} |
tyle.css'];
yield ['./../css/style.css', '../css/style.css'];
yield ['.././css/style.css', '../css/style.css'];
yield ['../../css/style.css', '../../css/style.css'];
yield ['', ''];
yield ['.', ''];
yield ['..', '..'];
yield ['./..', '..'];
yield ['../.', ... | ['/../css/style.css', '/css/style.css'];
yield ['/./../css/style.css', '/css/style.css'];
yield ['/.././css/style.css', '/css/style.css'];
yield ['/../../css/style.css', '/css/style.css'];
// absolute paths (stream, UNIX)
| '];
yield ['/css/../style.css', '/style.css'];
yield ['/css/./../style.css', '/style.css'];
yield ['/css/.././style.css', '/style.css'];
yield ['/./css/style.css', '/css/style.css'];
yield | {
"filepath": "src/Symfony/Component/Filesystem/Tests/PathTest.php",
"language": "php",
"file_size": 51750,
"cut_index": 2151,
"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\Ldap\Tests;
use PHPUnit\Framework\TestCase;
class Ldap... | bind($h)) {
$this->markTestSkipped('No server is listening on LDAP_HOST:LDAP_PORT');
}
ldap_unbind($h);
return [
'host' => getenv('LDAP_HOST'),
'port' => getenv('LDAP_PORT'),
];
}
}
| PT_PROTOCOL_VERSION, 3);
if (!$h || !@ldap_ | {
"filepath": "src/Symfony/Component/Ldap/Tests/LdapTestCase.php",
"language": "php",
"file_size": 822,
"cut_index": 514,
"middle_length": 52
} |
buted with this source code.
*/
namespace Symfony\Component\Ldap\Security;
use Symfony\Component\Ldap\Entry;
use Symfony\Component\Ldap\Exception\ExceptionInterface;
use Symfony\Component\Ldap\Exception\InvalidCredentialsException;
use Symfony\Component\Ldap\Exception\InvalidSearchCredentialsException;
use Symfony\C... | e\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
/**
* LdapUserProvider is a simple user provider on top of LDAP.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
* @author Charles Sarrazin <charles@sarraz.in>
* @ | nt\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
use Symfony\Component\Security\Cor | {
"filepath": "src/Symfony/Component/Ldap/Security/LdapUserProvider.php",
"language": "php",
"file_size": 6048,
"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\VarExporter\Internal;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
class Exporter
{
public static function export($value, $indent ... | ltrim(var_export($value, true), '\\');
}
$subIndent = $indent.' ';
if (\is_string($value)) {
$code = \sprintf("'%s'", addcslashes($value, "'\\"));
$code = preg_replace_callback("/((?:[\\0\\r\\n]|\u{202A | === $value: return 'false';
case true === $value: return 'true';
case null === $value: return 'null';
case '' === $value: return "''";
case $value instanceof \UnitEnum: return '\\'. | {
"filepath": "src/Symfony/Component/VarExporter/Internal/Exporter.php",
"language": "php",
"file_size": 4627,
"cut_index": 614,
"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\Filesystem\Exception;
/**
* Exception class thrown when a filesystem operation failure happens.
*
* @author Romain Neutron <imprec@gmail.com>
*... | g $message,
int $code = 0,
?\Throwable $previous = null,
private ?string $path = null,
) {
parent::__construct($message, $code, $previous);
}
public function getPath(): ?string
{
return $this->path;
| ace
{
public function __construct(
strin | {
"filepath": "src/Symfony/Component/Filesystem/Exception/IOException.php",
"language": "php",
"file_size": 923,
"cut_index": 606,
"middle_length": 52
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\PropertyAccess\Tests\Fixtures;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class TypeHinted
{
private $date;
/**
* @var \Cou... | ction getDate()
{
return $this->date;
}
public function getCountable(): \Countable
{
return $this->countable;
}
public function setCountable(\Countable $countable)
{
$this->countable = $countable;
} | {
$this->date = $date;
}
public fun | {
"filepath": "src/Symfony/Component/PropertyAccess/Tests/Fixtures/TypeHinted.php",
"language": "php",
"file_size": 918,
"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\Translation\Loader;
use Symfony\Component\Config\Resource\FileResource;
use Sy... | f (!stream_is_local($resource)) {
throw new InvalidResourceException(\sprintf('This is not a local file "%s".', $resource));
}
if (!file_exists($resource)) {
throw new NotFoundResourceException(\sprintf('File "%s" n | * @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
*/
abstract class FileLoader extends ArrayLoader
{
public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue
{
i | {
"filepath": "src/Symfony/Component/Translation/Loader/FileLoader.php",
"language": "php",
"file_size": 1728,
"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\Loader;
use Symfony\Component\Config\Resource\FileResource;
use Sy... | MessageCatalogue
{
if (!stream_is_local($resource.'.dat')) {
throw new InvalidResourceException(\sprintf('This is not a local file "%s".', $resource));
}
if (!file_exists($resource.'.dat')) {
throw new N | * IcuResFileLoader loads translations from a resource bundle.
*
* @author stealth35
*/
class IcuDatFileLoader extends IcuResFileLoader
{
public function load(mixed $resource, string $locale, string $domain = 'messages'): | {
"filepath": "src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php",
"language": "php",
"file_size": 1831,
"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\Translation\Loader;
use Symfony\Component\Config\Resource\DirectoryResource;
use Symfony\Component\Trans... | {
if (!stream_is_local($resource)) {
throw new InvalidResourceException(\sprintf('This is not a local file "%s".', $resource));
}
if (!is_dir($resource)) {
throw new NotFoundResourceException(\sprintf('Fil | oads translations from a resource bundle.
*
* @author stealth35
*/
class IcuResFileLoader implements LoaderInterface
{
public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue
| {
"filepath": "src/Symfony/Component/Translation/Loader/IcuResFileLoader.php",
"language": "php",
"file_size": 2793,
"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\Loader;
use Symfony\Component\Translation\Exception\InvalidResourc... | dResourceException('Error parsing JSON: '.$this->getJSONErrorMessage($errorCode));
}
}
return $messages;
}
/**
* Translates JSON_ERROR_* constant into meaningful message.
*/
private function getJSONErrorM | e): array
{
$messages = [];
if ($data = file_get_contents($resource)) {
$messages = json_decode($data, true);
if (0 < $errorCode = json_last_error()) {
throw new Invali | {
"filepath": "src/Symfony/Component/Translation/Loader/JsonFileLoader.php",
"language": "php",
"file_size": 1529,
"cut_index": 537,
"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\Translation\Loader;
use Symfony\Component\Translation\Exception\InvalidResourceException;
use Symfony\Component\Translation... | nterface
{
/**
* Loads a locale.
*
* @throws NotFoundResourceException when the resource cannot be found
* @throws InvalidResourceException when the resource cannot be loaded
*/
public function load(mixed $resource, string | Potencier <fabien@symfony.com>
*/
interface LoaderI | {
"filepath": "src/Symfony/Component/Translation/Loader/LoaderInterface.php",
"language": "php",
"file_size": 950,
"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\Translation\Loader;
use Symfony\Component\Translation\Exception\InvalidResourceException;
/**
* @copyright Copyright (c) 2010, Union of RAD http://union-... | file was big endian.
*/
public const MO_BIG_ENDIAN_MAGIC = 0xDE120495;
/**
* The size of the header of an MO file in bytes.
*/
public const MO_HEADER_SIZE = 28;
/**
* Parses machine object (MO) format, independent of t | create that file was little endian.
*/
public const MO_LITTLE_ENDIAN_MAGIC = 0x950412DE;
/**
* Magic used for validating the format of an MO file as well as
* detecting if the machine used to create that | {
"filepath": "src/Symfony/Component/Translation/Loader/MoFileLoader.php",
"language": "php",
"file_size": 4267,
"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\Translation\Loader;
/**
* PhpFileLoader loads transla... | API, ['cli', 'phpdbg', 'embed'], true) || filter_var(\ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOL))) {
self::$cache = null;
}
if (null === self::$cache) {
return require $resource;
}
return |
protected function loadResource(string $resource): array
{
if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOL) && (!\in_array(\PHP_S | {
"filepath": "src/Symfony/Component/Translation/Loader/PhpFileLoader.php",
"language": "php",
"file_size": 1054,
"cut_index": 513,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Translation\Loader;
/**
* @copyright Copyright (c) 2010, Union of RAD https://github.com/UnionOfRAD/lithium
* @copyright Copyright (c) 2012, Clemens Tolboom
*/
class PoFileLoader extends FileLoader
{
/**
* Parses portable object (PO) format.
... | * #| msgctxt previous-context
* #| msgid previous-untranslated-string
* msgctxt context
*
* #| msgid previous-untranslated-string-singular
* #| msgid_plural previous-untranslated-string-plural
* msgid untranslated-string-sing | #. extracted-comments
* #: reference...
* #, flag...
* #| msgid previous-untranslated-string
* msgid untranslated-string
* msgstr translated-string
*
* extra or different lines are:
*
| {
"filepath": "src/Symfony/Component/Translation/Loader/PoFileLoader.php",
"language": "php",
"file_size": 5114,
"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\Translation\Loader;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Config\Uti... | ents LoaderInterface
{
public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue
{
if (!class_exists(XmlUtils::class)) {
throw new RuntimeException('Loading translations from the QT for | tion\RuntimeException;
use Symfony\Component\Translation\MessageCatalogue;
/**
* QtFileLoader loads translations from QT Translations XML files.
*
* @author Benjamin Eberlei <kontakt@beberlei.de>
*/
class QtFileLoader implem | {
"filepath": "src/Symfony/Component/Translation/Loader/QtFileLoader.php",
"language": "php",
"file_size": 2769,
"cut_index": 563,
"middle_length": 229
} |
ymfony\Component\Config\Util\Exception\XmlParsingException;
use Symfony\Component\Config\Util\XmlUtils;
use Symfony\Component\Translation\Exception\InvalidResourceException;
use Symfony\Component\Translation\Exception\NotFoundResourceException;
use Symfony\Component\Translation\Exception\RuntimeException;
use Symfony\C... | ue
{
if (!class_exists(XmlUtils::class)) {
throw new RuntimeException('Loading translations from the Xliff format requires the Symfony Config component.');
}
if (!$this->isXmlString($resource)) {
if (!st | s from XLIFF files.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class XliffFileLoader implements LoaderInterface
{
public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalog | {
"filepath": "src/Symfony/Component/Translation/Loader/XliffFileLoader.php",
"language": "php",
"file_size": 15863,
"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\Translation\Loader;
use Symfony\Component\Translation\Exception\InvalidResourc... | on loadResource(string $resource): array
{
if (!isset($this->yamlParser)) {
if (!class_exists(YamlParser::class)) {
throw new LogicException('Loading translations from the YAML format requires the Symfony Yaml compon | ent\Yaml\Yaml;
/**
* YamlFileLoader loads translations from Yaml files.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class YamlFileLoader extends FileLoader
{
private YamlParser $yamlParser;
protected functi | {
"filepath": "src/Symfony/Component/Translation/Loader/YamlFileLoader.php",
"language": "php",
"file_size": 1604,
"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\Reader;
use Symfony\Component\Finder\Finder;
use Symfony\Component... | /**
* Adds a loader to the translation extractor.
*
* @param string $format The format of the loader
*/
public function addLoader(string $format, LoaderInterface $loader): void
{
$this->loaders[$format] = $loader;
| <michelsalib@hotmail.com>
*/
class TranslationReader implements TranslationReaderInterface
{
/**
* Loaders used for import.
*
* @var array<string, LoaderInterface>
*/
private array $loaders = [];
| {
"filepath": "src/Symfony/Component/Translation/Reader/TranslationReader.php",
"language": "php",
"file_size": 1734,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Translation\Catalogue;
use Symfony\Component\Translation\Exception\InvalidArgumentException;
use Symfony\Component\Translation\Exception\LogicException;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\MessageCatalogueIn... | = 'all';
protected MessageCatalogue $result;
/**
* This array stores 'all', 'new' and 'obsolete' messages for all valid domains.
*
* The data structure of this array is as follows:
*
* [
* 'domain 1' => [ | * @author Jean-François Simon <contact@jfsimon.fr>
*/
abstract class AbstractOperation implements OperationInterface
{
public const OBSOLETE_BATCH = 'obsolete';
public const NEW_BATCH = 'new';
public const ALL_BATCH | {
"filepath": "src/Symfony/Component/Translation/Catalogue/AbstractOperation.php",
"language": "php",
"file_size": 5944,
"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\Translation\Catalogue;
use Symfony\Component\Translation\MessageCatalogueInterface;
/**
* Merge operat... | ocessDomain(string $domain): void
{
$this->messages[$domain] = [
'all' => [],
'new' => [],
'obsolete' => [],
];
$intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX;
fo | ∧ x ∉ source ∧ x ∉ target} = ∅
* Basically, the result contains messages from both catalogues.
*
* @author Jean-François Simon <contact@jfsimon.fr>
*/
class MergeOperation extends AbstractOperation
{
protected function pr | {
"filepath": "src/Symfony/Component/Translation/Catalogue/MergeOperation.php",
"language": "php",
"file_size": 2664,
"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\Catalogue;
use Symfony\Component\Translation\MessageCatalogueInter... | ration is performed.
*
* New Messages: also called 'new' (new = all ∖ source = {x: x ∈ all ∧ x ∉ source}).
*
* Obsolete Messages: also called 'obsolete' (obsolete = source ∖ all = {x: x ∈ source ∧ x ∉ all}).
*
* Result: also called 'result', is the r | peration.
*
* The first catalogue in its argument(s) is called the 'source catalogue' or 'source' and
* the following results are stored:
*
* Messages: also called 'all', are valid messages for the given domain after the ope | {
"filepath": "src/Symfony/Component/Translation/Catalogue/OperationInterface.php",
"language": "php",
"file_size": 1857,
"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\Catalogue;
use Symfony\Component\Translation\MessageCatalogueInterface;
/**
* Target operation between two catalogues:
* intersection = sour... | function processDomain(string $domain): void
{
$this->messages[$domain] = [
'all' => [],
'new' => [],
'obsolete' => [],
];
$intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX;
| arget = {x: x ∈ source ∧ x ∉ target}
* Basically, the result contains messages from the target catalogue.
*
* @author Michael Lee <michael.lee@zerustech.com>
*/
class TargetOperation extends AbstractOperation
{
protected | {
"filepath": "src/Symfony/Component/Translation/Catalogue/TargetOperation.php",
"language": "php",
"file_size": 3709,
"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.
*/
return [
'az_Cyrl' => 'root',
'bs_Cyrl' => 'root',
'en_150' => 'en_001',
'en_AG' => 'en_001',
'en_AI' => 'en_001',
'en_AT' => 'en_150',
'en_AU' => 'en_001',... | 01',
'en_EE' => 'en_150',
'en_ER' => 'en_001',
'en_ES' => 'en_150',
'en_FI' => 'en_150',
'en_FJ' => 'en_001',
'en_FK' => 'en_001',
'en_FM' => 'en_001',
'en_FR' => 'en_150',
'en_GB' => 'en_001',
'en_GD' => 'en_001',
| en_150',
'en_CK' => 'en_001',
'en_CM' => 'en_001',
'en_CX' => 'en_001',
'en_CY' => 'en_001',
'en_CZ' => 'en_150',
'en_DE' => 'en_150',
'en_DG' => 'en_001',
'en_DK' => 'en_150',
'en_DM' => 'en_0 | {
"filepath": "src/Symfony/Component/Translation/Resources/data/parents.php",
"language": "php",
"file_size": 4162,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
if ('cli' !== \PHP_SAPI) {
throw new Exception('This script must be run from the command line.');
}
$usageInstructions = <<<END
Usage instructions
-------------------------------------------------------------------------------
$ cd symfony-code-root-directory/
... | cale
$ php translation-status.php fr
# show the status of a single locale, missing translations and mismatches between trans-unit id and source
$ php translation-status.php fr -v
END;
$config = [
// if TRUE, the full list of mi | us.php --incomplete
# show the translation status of all locales, all their missing translations and mismatches between trans-unit id and source
$ php translation-status.php -v
# show the status of a single lo | {
"filepath": "src/Symfony/Component/Translation/Resources/bin/translation-status.php",
"language": "php",
"file_size": 8986,
"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\Translation\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Comple... | ony\Contracts\Translation\TranslatorInterface;
/**
* Lint translations files syntax and outputs encountered errors.
*
* @author Hugo Alliaume <hugo@alliau.me>
*/
#[AsCommand(name: 'lint:translations', description: 'Lint translations files syntax and o | ymfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Translation\Exception\ExceptionInterface;
use Symfony\Component\Translation\TranslatorBagInterface;
use Symf | {
"filepath": "src/Symfony/Component/Translation/Command/TranslationLintCommand.php",
"language": "php",
"file_size": 4484,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Translation\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Comp... | tion;
use Symfony\Component\Translation\Reader\TranslationReaderInterface;
use Symfony\Component\Translation\Writer\TranslationWriterInterface;
/**
* @author Mathieu Santostefano <msantostefano@protonmail.com>
*/
#[AsCommand(name: 'translation:pull', de | e Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Translation\Catalogue\TargetOperation;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\Provider\TranslationProviderCollec | {
"filepath": "src/Symfony/Component/Translation/Command/TranslationPullCommand.php",
"language": "php",
"file_size": 7745,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Translation\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Comp... | nProviderCollection;
use Symfony\Component\Translation\Reader\TranslationReaderInterface;
use Symfony\Component\Translation\TranslatorBag;
/**
* @author Mathieu Santostefano <msantostefano@protonmail.com>
*/
#[AsCommand(name: 'translation:push', descrip | utOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Translation\Provider\FilteringProvider;
use Symfony\Component\Translation\Provider\Translatio | {
"filepath": "src/Symfony/Component/Translation/Command/TranslationPushCommand.php",
"language": "php",
"file_size": 7670,
"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\Translation\Command;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translati... | $this->reader->read($path, $catalogue);
}
if ($domains) {
foreach ($domains as $domain) {
$bag->addCatalogue($this->filterCatalogue($catalogue, $domain));
}
| domains, array $transPaths): TranslatorBag
{
$bag = new TranslatorBag();
foreach ($locales as $locale) {
$catalogue = new MessageCatalogue($locale);
foreach ($transPaths as $path) {
| {
"filepath": "src/Symfony/Component/Translation/Command/TranslationTrait.php",
"language": "php",
"file_size": 2389,
"cut_index": 563,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.