prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
buted with this source code.
*/
namespace Symfony\Component\Mime\Tests\Part;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Mime\Encoder\ContentEncoderInterface;
use Symfony\Component\Mime\Exception\InvalidArgumentException;
use Symfony\Component\Mime\Exception\R... | }
}
class TextPartTest extends TestCase
{
#[DataProvider('provideTrampolineKeys')]
public function testUnserializeRejectsObjectInTypedStringProperty(string $key)
{
$template = (new TextPart('body content'))->__serialize();
| ime\Part\File;
use Symfony\Component\Mime\Part\TextPart;
class TextPartTestToStringGadget
{
public static bool $fired = false;
public function __toString(): string
{
self::$fired = true;
return '';
| {
"filepath": "src/Symfony/Component/Mime/Tests/Part/TextPartTest.php",
"language": "php",
"file_size": 8198,
"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\Mime;
/**
* Guesses the MIME type of a file.
*
* @autho... | with the given path.
*
* @throws \LogicException If the guesser is not supported
* @throws \InvalidArgumentException If the file does not exist or is not readable
*/
public function guessMimeType(string $path): ?string;
} | l;
/**
* Guesses the MIME type of the file | {
"filepath": "src/Symfony/Component/Mime/MimeTypeGuesserInterface.php",
"language": "php",
"file_size": 826,
"cut_index": 517,
"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\Mime\Tests\Part;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Mime\Email;
use Symfony\Component... | tent', $p->getBody());
$this->assertStringContainsString('content', $p->bodyToString());
$this->assertStringContainsString('content', implode('', iterator_to_array($p->bodyToIterable())));
$this->assertEquals('message', $p->getMedia | rtTest extends TestCase
{
public function testConstructor()
{
$p = new MessagePart((new Email())->from('fabien@symfony.com')->to('you@example.com')->text('content'));
$this->assertStringContainsString('con | {
"filepath": "src/Symfony/Component/Mime/Tests/Part/MessagePartTest.php",
"language": "php",
"file_size": 2061,
"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\Mime\Part\Multipart;
use Symfony\Component\Mime\Part\AbstractMult... | lic function getParts(): array
{
return array_merge([$this->mainPart], parent::getParts());
}
public function getMediaSubtype(): string
{
return 'related';
}
private function generateContentId(): string
{
| _construct(
private AbstractPart $mainPart,
AbstractPart $part,
AbstractPart ...$parts,
) {
$this->prepareParts($part, ...$parts);
parent::__construct($part, ...$parts);
}
pub | {
"filepath": "src/Symfony/Component/Mime/Part/Multipart/RelatedPart.php",
"language": "php",
"file_size": 1361,
"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\Mime\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Mime\Exception\LogicException;
use Symfony... | if ($supportReuse) {
// calling methods more than once work
$this->assertEquals('some string', $message->toString());
$this->assertEquals('some string', implode('', iterator_to_array($message->toIterable())));
}
| $message = new RawMessage($messageParameter);
$this->assertEquals('some string', $message->toString());
$this->assertEquals('some string', implode('', iterator_to_array($message->toIterable())));
| {
"filepath": "src/Symfony/Component/Mime/Tests/RawMessageTest.php",
"language": "php",
"file_size": 3499,
"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\Mime\Part;
use Symfony\Component\Mime\Header\Headers;
/**
* @author Fabien P... | t-Type', $this->getMediaType().'/'.$this->getMediaSubtype());
return $headers;
}
public function toString(): string
{
return $this->getPreparedHeaders()->toString()."\r\n".$this->bodyToString();
}
public function toIt | function getHeaders(): Headers
{
return $this->headers;
}
public function getPreparedHeaders(): Headers
{
$headers = clone $this->headers;
$headers->setHeaderBody('Parameterized', 'Conten | {
"filepath": "src/Symfony/Component/Mime/Part/AbstractPart.php",
"language": "php",
"file_size": 1732,
"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\Mime\Part;
use Symfony\Component\Mime\Header\Headers;
/**
* @author Sebastiaan Stok <s.stok@rollerscap... | is->subtype;
}
public function bodyToString(): string
{
if (\is_string($this->body)) {
return $this->body;
}
$body = '';
foreach ($this->body as $chunk) {
$body .= $chunk;
}
| private array $parameters,
) {
parent::__construct();
}
public function getMediaType(): string
{
return $this->type;
}
public function getMediaSubtype(): string
{
return $th | {
"filepath": "src/Symfony/Component/Mime/Part/SMimePart.php",
"language": "php",
"file_size": 3032,
"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\Scheduler;
use Psr\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Clock\Clock;
use Symfony\Component\Clock\ClockInterface;
use Symfony\Com... | $schedules
*/
public function __construct(
private readonly array $handlers,
array $schedules,
private readonly ClockInterface $clock = new Clock(),
private readonly ?EventDispatcherInterface $dispatcher = null,
| erator;
final class Scheduler
{
/**
* @var array<MessageGenerator>
*/
private array $generators = [];
private int $index = 0;
private bool $shouldStop = false;
/**
* @param iterable<Schedule> | {
"filepath": "src/Symfony/Component/Scheduler/Scheduler.php",
"language": "php",
"file_size": 3538,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Scheduler\Generator;
use Psr\Clock\ClockInterface;
use Symfony\Component\Clock\Clock;
use Symfony\Component\Scheduler\RecurringMessage;
use Symfony\Component\Scheduler\Schedule;
use Symfony\Component\Scheduler\ScheduleProviderInterface;
use Symfony\Componen... | ,
private readonly ClockInterface $clock = new Clock(),
private ?CheckpointInterface $checkpoint = null,
) {
$this->waitUntil = new \DateTimeImmutable('@0');
}
/**
* @return \Generator<MessageContext, object>
|
private bool $heapInitialized = false;
private ?\DateTimeImmutable $waitUntil;
public function __construct(
private readonly ScheduleProviderInterface $scheduleProvider,
private readonly string $name | {
"filepath": "src/Symfony/Component/Scheduler/Generator/MessageGenerator.php",
"language": "php",
"file_size": 5441,
"cut_index": 716,
"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\Scheduler\Generator;
use Symfony\Component\Scheduler\RecurringMessage;
/**
* @internal
*
* @exte... | e, int, RecurringMessage} $value1
* @param array{\DateTimeImmutable, int, RecurringMessage} $value2
*/
protected function compare(mixed $value1, mixed $value2): int
{
return $value2[0] <=> $value1[0] ?: $value2[1] <=> $value1[1];
| }
/**
* @param array{\DateTimeImmutabl | {
"filepath": "src/Symfony/Component/Scheduler/Generator/TriggerHeap.php",
"language": "php",
"file_size": 875,
"cut_index": 559,
"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\Scheduler\Generator;
use Psr\Cache\CacheItemInterface;
use Symfony\Component\Lock\LockInterface;
use Sym... | private readonly ?CacheInterface $cache = null,
) {
}
public function acquire(\DateTimeImmutable $now): bool
{
if ($this->lock && !$this->lock->acquire()) {
// Reset local state if a Lock is acquired by another | ;
private \DateTimeImmutable $time;
private int $index = -1;
private bool $reset = false;
public function __construct(
private readonly string $name,
private readonly ?LockInterface $lock = null,
| {
"filepath": "src/Symfony/Component/Scheduler/Generator/Checkpoint.php",
"language": "php",
"file_size": 2932,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Mime\Crypto;
use Symfony\Component\Mime\Exception\InvalidArgumentException;
use Symfony\Component\Mime\Exception\RuntimeException;
use Symfony\Component\Mime\Header\UnstructuredHeader;
use Symfony\Component\Mime\Message;
use Symfony\Component\Mime\Part\Abst... | or the path to the file containing the private key, should be prefixed with file:// (in PEM format)
* @param string $passphrase A passphrase of the private key (if any)
*/
public function __construct(
string $pk,
private stri | 'relaxed';
public const ALGO_SHA256 = 'rsa-sha256';
public const ALGO_ED25519 = 'ed25519-sha256'; // RFC 8463
private \OpenSSLAsymmetricKey $key;
/**
* @param string $pk The private key as a string | {
"filepath": "src/Symfony/Component/Mime/Crypto/DkimSigner.php",
"language": "php",
"file_size": 8026,
"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\Mime\Crypto;
use Symfony\Component\Mime\Exception\RuntimeException;
use Symfony\Component\Mime\Message;
... | : https://php.net/openssl.ciphers
*/
public function __construct(string|array $certificate, ?int $cipher = null)
{
if (!\extension_loaded('openssl')) {
throw new \LogicException('PHP extension "openssl" is required to use S | |string[] $certificate The path (or array of paths) of the file(s) containing the X.509 certificate(s)
* @param int|null $cipher A set of algorithms used to encrypt the message. Must be one of these PHP constants | {
"filepath": "src/Symfony/Component/Mime/Crypto/SMimeEncrypter.php",
"language": "php",
"file_size": 2223,
"cut_index": 563,
"middle_length": 229
} |
ract class AbstractHeader implements HeaderInterface
{
public const PHRASE_PATTERN = '(?:(?:(?:(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))*(?:(?... | ])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))*(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(? | \r\n))?[ \t])?\)))|(?:(?:[ \t]*(?:\r\n))?[ \t])))?[a-zA-Z0-9!#\$%&\'\*\+\-\/=\?\^_`\{\}\|~]+(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E | {
"filepath": "src/Symfony/Component/Mime/Header/AbstractHeader.php",
"language": "php",
"file_size": 11036,
"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\Mime\Header;
/**
* A MIME Header.
*
* @author Chris Corbyn
*/... |
public function setLanguage(string $lang): void;
public function getLanguage(): ?string;
public function getName(): string;
public function setMaxLineLength(int $lineLength): void;
public function getMaxLineLength(): int;
/**
| Gets the body.
*
* The return type depends on the Header concrete class.
*/
public function getBody(): mixed;
public function setCharset(string $charset): void;
public function getCharset(): ?string;
| {
"filepath": "src/Symfony/Component/Mime/Header/HeaderInterface.php",
"language": "php",
"file_size": 1410,
"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\Mime\Header;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Exception\RfcComplianceExcep... | ram string|string[] $body a string ID or an array of IDs
*
* @throws RfcComplianceException
*/
public function setBody(mixed $body): void
{
$this->setId($body);
}
public function getBody(): array
{
return | private array $ids = [];
private array $idsAsAddresses = [];
public function __construct(string $name, string|array $ids)
{
parent::__construct($name);
$this->setId($ids);
}
/**
* @pa | {
"filepath": "src/Symfony/Component/Mime/Header/IdentificationHeader.php",
"language": "php",
"file_size": 2384,
"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\Mime\Header;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Ex... | ddress $body
*
* @throws RfcComplianceException
*/
public function setBody(mixed $body): void
{
$this->setAddress($body);
}
/**
* @throws RfcComplianceException
*/
public function getBody(): Address
| xtends AbstractHeader
{
private Address $address;
public function __construct(string $name, Address $address)
{
parent::__construct($name);
$this->setAddress($address);
}
/**
* @param A | {
"filepath": "src/Symfony/Component/Mime/Header/MailboxHeader.php",
"language": "php",
"file_size": 1968,
"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\Mime\Header;
use Symfony\Component\Mime\Address;
use Symfony\Comp... | RfcComplianceException
*/
public function setBody(mixed $body): void
{
$this->setAddress($body);
}
public function getBody(): Address
{
return $this->getAddress();
}
public function setAddress(Address $add | Address $address;
public function __construct(string $name, Address $address)
{
parent::__construct($name);
$this->setAddress($address);
}
/**
* @param Address $body
*
* @throws | {
"filepath": "src/Symfony/Component/Mime/Header/PathHeader.php",
"language": "php",
"file_size": 1275,
"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\Mime\Header;
/**
* A Simple MIME Header.
*
* @author Chris Cor... | rn $this->getValue();
}
/**
* Get the (unencoded) value of this header.
*/
public function getValue(): string
{
return $this->value;
}
/**
* Set the (unencoded) value of this header.
*/
public funct | $this->setValue($value);
}
/**
* @param string $body
*/
public function setBody(mixed $body): void
{
$this->setValue($body);
}
public function getBody(): string
{
retu | {
"filepath": "src/Symfony/Component/Mime/Header/UnstructuredHeader.php",
"language": "php",
"file_size": 1279,
"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\Mime\Encoder;
/**
* @author Chris Corbyn
*/
final class Base64M... | eString(string $string, ?string $charset = 'utf-8', int $firstLineOffset = 0, int $maxLineLength = 0): string
{
if ('iso-2022-jp' === strtolower($charset)) {
$old = mb_internal_encoding();
mb_internal_encoding('utf-8');
| nd produces a Base64 encoded string from it.
*
* If the charset is iso-2022-jp, it uses mb_encode_mimeheader instead of
* default encodeString, otherwise pass to the parent method.
*/
public function encod | {
"filepath": "src/Symfony/Component/Mime/Encoder/Base64MimeHeaderEncoder.php",
"language": "php",
"file_size": 1287,
"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\Mime\Encoder;
/**
* An IDN email address encoder.
*
* Encodes ... |
public function encodeString(string $address): string
{
$i = strrpos($address, '@');
if (false !== $i) {
$local = substr($address, 0, $i);
$domain = substr($address, $i + 1);
if (preg_match('/[^ | en it depends on the SMTP Server if this is supported.
*
* @author Christian Schmidt
*/
final class IdnAddressEncoder implements AddressEncoderInterface
{
/**
* Encodes the domain part of an address using IDN.
*/ | {
"filepath": "src/Symfony/Component/Mime/Encoder/IdnAddressEncoder.php",
"language": "php",
"file_size": 1309,
"cut_index": 524,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mime\Encoder;
/**
* @author Lars Strojny
*/
final class QpContentEncoder imp... | am), 'utf-8', 0, $maxLineLength);
}
public function getName(): string
{
return 'quoted-printable';
}
public function encodeString(string $string, ?string $charset = 'utf-8', int $firstLineOffset = 0, int $maxLineLength = 0): s | sprintf('Method "%s" takes a stream as a first argument.', __METHOD__));
}
// we don't use PHP stream filters here as the content should be small enough
yield $this->encodeString(stream_get_contents($stre | {
"filepath": "src/Symfony/Component/Mime/Encoder/QpContentEncoder.php",
"language": "php",
"file_size": 1727,
"cut_index": 537,
"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\Mime\Encoder;
/**
* @author Chris Corbyn
*/
final clas... | rn 'Q';
}
public function encodeString(string $string, ?string $charset = 'utf-8', int $firstLineOffset = 0, int $maxLineLength = 0): string
{
return str_replace([' ', '=20', "=\r\n"], ['_', '_', "\r\n"],
parent::encodeStri | nge(0x41, 0x5A),
range(0x30, 0x39), [0x20, 0x21, 0x2A, 0x2B, 0x2D, 0x2F]
) as $byte) {
$this->safeMap[$byte] = \chr($byte);
}
}
public function getName(): string
{
retu | {
"filepath": "src/Symfony/Component/Mime/Encoder/QpMimeHeaderEncoder.php",
"language": "php",
"file_size": 1075,
"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\Scheduler;
use Symfony\Component\Scheduler\Exception\InvalidArgumentException;
use Symfony\Component\Scheduler\Generator\MessageContext;
use Symfony\Compon... | vate string $id;
private function __construct(
private readonly TriggerInterface $trigger,
private readonly MessageProviderInterface $provider,
) {
}
/**
* Sets the trigger frequency.
*
* Supported frequency | duler\Trigger\PeriodicalTrigger;
use Symfony\Component\Scheduler\Trigger\StaticMessageProvider;
use Symfony\Component\Scheduler\Trigger\TriggerInterface;
final class RecurringMessage implements MessageProviderInterface
{
pri | {
"filepath": "src/Symfony/Component/Scheduler/RecurringMessage.php",
"language": "php",
"file_size": 4391,
"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\Scheduler\Attribute;
/**
* A marker to call a service method from scheduler.
*
* @author valtzu <valt... | in seconds; for example, if set to 60, the cron
* will randomly wait for a number of seconds between 0 and 60 before
* executing which allows to avoid load sp | The cron expression to define the task schedule (i.e. "5 * * * *")
* @param string|null $timezone The timezone used with the cron expression
* @param int|null $jitter The cron jitter, | {
"filepath": "src/Symfony/Component/Scheduler/Attribute/AsCronTask.php",
"language": "php",
"file_size": 2026,
"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\Mime\Crypto;
/**
* A helper providing autocompletion for available DkimSigner... | lic function signatureExpirationDelay(int $show): static
{
$this->options['signature_expiration_delay'] = $show;
return $this;
}
/**
* @return $this
*/
public function bodyMaxLength(int $max): static
{
| ptions;
}
/**
* @return $this
*/
public function algorithm(string $algo): static
{
$this->options['algorithm'] = $algo;
return $this;
}
/**
* @return $this
*/
pub | {
"filepath": "src/Symfony/Component/Mime/Crypto/DkimOptions.php",
"language": "php",
"file_size": 1816,
"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\Mime\Crypto;
use Symfony\Component\Mime\Exception\RuntimeException;
use Symfony\Component\Mime\Message;
... | The path of the file containing the private key (in PEM format)
* @param string|null $privateKeyPassphrase A passphrase of the private key (if any)
* @param string|null $extraCerts The path of the file containing intermediate certificat | int $signOptions;
private ?string $extraCerts;
/**
* @param string $certificate The path of the file containing the signing certificate (in PEM format)
* @param string $privateKey | {
"filepath": "src/Symfony/Component/Mime/Crypto/SMimeSigner.php",
"language": "php",
"file_size": 2731,
"cut_index": 563,
"middle_length": 229
} |
author Fabien Potencier <fabien@symfony.com>
*/
final class Headers
{
private const UNIQUE_HEADERS = [
'date', 'from', 'sender', 'reply-to', 'to', 'cc', 'bcc',
'message-id', 'in-reply-to', 'references', 'subject',
];
private const HEADER_CLASS_MAP = [
'date' => DateHeader::class,
... | rences` are less strict than RFC 2822 (3.6.4) to allow users entering the original email's ...
'references' => [UnstructuredHeader::class, IdentificationHeader::class], // ... `Message-ID`, even if that is no valid `msg-id`
'return-path' => | ilboxListHeader::class,
'bcc' => MailboxListHeader::class,
'message-id' => IdentificationHeader::class,
'in-reply-to' => [UnstructuredHeader::class, IdentificationHeader::class], // `In-Reply-To` and `Refe | {
"filepath": "src/Symfony/Component/Mime/Header/Headers.php",
"language": "php",
"file_size": 9199,
"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\Mime\Header;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Exception\RfcComplianceException;
/**
* A Mailbox list MIME Header for someth... | $body
*
* @throws RfcComplianceException
*/
public function setBody(mixed $body): void
{
$this->setAddresses($body);
}
/**
* @return Address[]
*
* @throws RfcComplianceException
*/
public fun | * @param Address[] $addresses
*/
public function __construct(string $name, array $addresses)
{
parent::__construct($name);
$this->setAddresses($addresses);
}
/**
* @param Address[] | {
"filepath": "src/Symfony/Component/Mime/Header/MailboxListHeader.php",
"language": "php",
"file_size": 3175,
"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\Mime\Encoder;
use Symfony\Component\Mime\Exception\RuntimeExcepti... | filter_append($stream, 'convert.base64-encode', \STREAM_FILTER_READ, [
'line-length' => 0 >= $maxLineLength || 76 < $maxLineLength ? 76 : $maxLineLength,
'line-break-chars' => "\r\n",
]);
if (!\is_resource($filter)) | stream, int $maxLineLength = 0): iterable
{
if (!\is_resource($stream)) {
throw new \TypeError(\sprintf('Method "%s" takes a stream as a first argument.', __METHOD__));
}
$filter = stream_ | {
"filepath": "src/Symfony/Component/Mime/Encoder/Base64ContentEncoder.php",
"language": "php",
"file_size": 1328,
"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\Mime\Encoder;
/**
* @author Fabien Potencier <fabien@symfony.co... | }
}
public function getName(): string
{
return '8bit';
}
public function encodeString(string $string, ?string $charset = 'utf-8', int $firstLineOffset = 0, int $maxLineLength = 0): string
{
return $string;
} | m)) {
yield fread($stream, 16372);
| {
"filepath": "src/Symfony/Component/Mime/Encoder/EightBitContentEncoder.php",
"language": "php",
"file_size": 834,
"cut_index": 523,
"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\Mime\Encoder;
use Symfony\Component\Mime\CharacterStream;
/**
*... | e = &$lines[$lineCount++];
if (0 >= $maxLineLength) {
$maxLineLength = 75;
}
$charStream = new CharacterStream($string, $charset);
$thisLineLength = $maxLineLength - $firstLineOffset;
while (null !== $ |
public function encodeString(string $string, ?string $charset = 'utf-8', int $firstLineOffset = 0, int $maxLineLength = 0): string
{
$lines = [];
$lineCount = 0;
$lines[] = '';
$currentLin | {
"filepath": "src/Symfony/Component/Mime/Encoder/Rfc2231Encoder.php",
"language": "php",
"file_size": 1433,
"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\Scheduler;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Lock\LockInterface;
use Symfony\Component\Scheduler\Event\... | nterface $state = null;
private bool $shouldRestart = false;
private bool $onlyLastMissed = false;
public function __construct(
private readonly ?EventDispatcherInterface $dispatcher = null,
) {
}
public function with(Recu | acts\Cache\CacheInterface;
final class Schedule implements ScheduleProviderInterface
{
/** @var array<string,RecurringMessage> */
private array $messages = [];
private ?LockInterface $lock = null;
private ?CacheI | {
"filepath": "src/Symfony/Component/Scheduler/Schedule.php",
"language": "php",
"file_size": 4964,
"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\Scheduler\Attribute;
/**
* A marker to call a service method from scheduler.
*
* @author valtzu <valt... | 00:00")
* @param string|null $until A string representing the end time of the periodic task (i.e. "20:00:00")
* @param int|null $jitter The cron jitter, in seconds; for example, if set to 60, the cron
* | cy A string (i.e. "every hour") or an integer (the number of seconds) representing the frequency of the task
* @param string|null $from A string representing the start time of the periodic task (i.e. "08: | {
"filepath": "src/Symfony/Component/Scheduler/Attribute/AsPeriodicTask.php",
"language": "php",
"file_size": 2273,
"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\Mime\Header;
/**
* A Date MIME Header.
*
* @author Chris Corby... | on getBody(): \DateTimeImmutable
{
return $this->getDateTime();
}
public function getDateTime(): \DateTimeImmutable
{
return $this->dateTime;
}
/**
* Set the date-time of the Date in this Header.
*
* | _construct($name);
$this->setDateTime($date);
}
/**
* @param \DateTimeInterface $body
*/
public function setBody(mixed $body): void
{
$this->setDateTime($body);
}
public functi | {
"filepath": "src/Symfony/Component/Mime/Header/DateHeader.php",
"language": "php",
"file_size": 1380,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Mime\Header;
use Symfony\Component\Mime\Encoder\Rfc2231Encoder;
/**
* @author Chris Corbyn
*/
final class ParameterizedHeader extends UnstructuredHeader
{
/**
* RFC 2231's definition of a token.
*
* @var string
*/
public const... | e' !== strtolower($name)) {
$this->encoder = new Rfc2231Encoder();
}
}
public function setParameter(string $parameter, ?string $value): void
{
$this->setParameters(array_merge($this->getParameters(), [$parameter => | ruct(string $name, string $value, array $parameters = [])
{
parent::__construct($name, $value);
foreach ($parameters as $k => $v) {
$this->setParameter($k, $v);
}
if ('content-typ | {
"filepath": "src/Symfony/Component/Mime/Header/ParameterizedHeader.php",
"language": "php",
"file_size": 6366,
"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\Mime\Encoder;
/**
* @author Chris Corbyn
*/
class Base64Encoder... | neLength = 0): string
{
if (0 >= $maxLineLength || 76 < $maxLineLength) {
$maxLineLength = 76;
}
$encodedString = base64_encode($string);
$firstLine = '';
if (0 !== $firstLineOffset) {
$f | acters.
* If the first line needs to be shorter, indicate the difference with
* $firstLineOffset.
*/
public function encodeString(string $string, ?string $charset = 'utf-8', int $firstLineOffset = 0, int $maxLi | {
"filepath": "src/Symfony/Component/Mime/Encoder/Base64Encoder.php",
"language": "php",
"file_size": 1281,
"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\Mime\DependencyInjection;
use Symfony\Component\DependencyI... | me_types')) {
return;
}
$definition = $container->findDefinition('mime_types');
$id = null;
foreach ($container->findTaggedServiceIds('mime.mime_type_guesser', true) as $id => $attributes) {
$definiti | essers.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class AddMimeTypeGuesserPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (!$container->has('mi | {
"filepath": "src/Symfony/Component/Mime/DependencyInjection/AddMimeTypeGuesserPass.php",
"language": "php",
"file_size": 1161,
"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\Mime\Crypto;
use Symfony\Component\Mime\Exception\RuntimeException;
use Symfony\Component\Mime\Part\SMimePart;
/**
* @author Sebastiaan Stok <s.stok@roll... | reach ($iterator as $chunk) {
fwrite($stream, $chunk);
}
}
protected function convertMessageToSMimePart($stream, string $type, string $subtype): SMimePart
{
rewind($stream);
$headers = '';
while (! | ception(\sprintf('File does not exist: "%s".', $path));
}
return 'file://'.str_replace('\\', '/', realpath($path));
}
protected function iteratorToFile(iterable $iterator, $stream): void
{
fo | {
"filepath": "src/Symfony/Component/Mime/Crypto/SMime.php",
"language": "php",
"file_size": 3264,
"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\Scheduler\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Comp... | ringMessage::every('1 second', new Message()));
$scheduler = new Scheduler([Message::class => $handler], [$schedule], $clock);
$handler->scheduler = $scheduler;
$scheduler->run(['sleep' => 100]);
$this->assertSame(3, $hand | cheduler;
class SchedulerTest extends TestCase
{
public function testCanRunAndStop()
{
$handler = new Handler();
$handler->clock = $clock = new MockClock();
$schedule = (new Schedule())->add(Recur | {
"filepath": "src/Symfony/Component/Scheduler/Tests/SchedulerTest.php",
"language": "php",
"file_size": 1366,
"cut_index": 524,
"middle_length": 229
} |
ArrayAdapter;
use Symfony\Component\Clock\MockClock;
use Symfony\Component\Scheduler\Generator\Checkpoint;
use Symfony\Component\Scheduler\Generator\MessageContext;
use Symfony\Component\Scheduler\Generator\MessageGenerator;
use Symfony\Component\Scheduler\RecurringMessage;
use Symfony\Component\Scheduler\Schedule;
use... | if (\is_array($s)) {
$schedule[$i] = $this->createMessage(...$s);
}
}
$schedule = (new Schedule())->add(...$schedule);
$schedule->stateful(new ArrayAdapter());
$scheduler = new MessageGenerator | vider')]
public function testGetMessagesFromSchedule(string $startTime, array $runs, array $schedule)
{
$clock = new MockClock(self::makeDateTime($startTime));
foreach ($schedule as $i => $s) {
| {
"filepath": "src/Symfony/Component/Scheduler/Tests/Generator/MessageGeneratorTest.php",
"language": "php",
"file_size": 16264,
"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\Scheduler\Tests\EventListener;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\EventDispatcher\E... | Component\Scheduler\Event\PreRunEvent;
use Symfony\Component\Scheduler\EventListener\DispatchSchedulerEventListener;
use Symfony\Component\Scheduler\Generator\MessageContext;
use Symfony\Component\Scheduler\Messenger\ScheduledStamp;
use Symfony\Component\S | ymfony\Component\Messenger\Event\WorkerMessageReceivedEvent;
use Symfony\Component\Messenger\Stamp\HandledStamp;
use Symfony\Component\Scheduler\Event\FailureEvent;
use Symfony\Component\Scheduler\Event\PostRunEvent;
use Symfony\ | {
"filepath": "src/Symfony/Component/Scheduler/Tests/EventListener/DispatchSchedulerEventListenerTest.php",
"language": "php",
"file_size": 3747,
"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\Scheduler\Tests\Trigger;
use PHPUnit\Framework\TestCase;
use Symfony\Component... | ssageProvider(static fn () => []);
$this->assertEquals([], $messageProvider->getMessages($context));
$this->assertEquals('', $messageProvider->getId());
$messageProvider = new CallbackMessageProvider(static fn () => [new \stdClass( | st extends TestCase
{
public function testToString()
{
$context = new MessageContext('test', 'test', $this->createStub(TriggerInterface::class), new \DateTimeImmutable());
$messageProvider = new CallbackMe | {
"filepath": "src/Symfony/Component/Scheduler/Tests/Trigger/CallbackMessageProviderTest.php",
"language": "php",
"file_size": 1511,
"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\Scheduler\Tests\Trigger;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Scheduler\Trigger\CronExpress... | $this->assertSame($expected, (string) $triggerA);
$this->assertSame((string) $triggerB, (string) $triggerA);
$this->assertNotSame((string) $triggerC, (string) $triggerA);
}
public static function hashedExpressionProvider(): |
{
$triggerA = CronExpressionTrigger::fromSpec($input, 'my task');
$triggerB = CronExpressionTrigger::fromSpec($input, 'my task');
$triggerC = CronExpressionTrigger::fromSpec($input, 'another task');
| {
"filepath": "src/Symfony/Component/Scheduler/Tests/Trigger/CronExpressionTriggerTest.php",
"language": "php",
"file_size": 3233,
"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\Scheduler\Tests\Trigger;
use PHPUnit\Framework\TestCase;
us... | values = array_map(
static fn () => (int) $trigger->getNextRunDate($time)?->getTimestamp(),
array_fill(0, 100, null)
);
foreach ($values as $value) {
$this->assertGreaterThanOrEqual($time->getTimestamp() | )
{
$time = new \DateTimeImmutable();
$inner = $this->createStub(TriggerInterface::class);
$inner->method('getNextRunDate')->willReturn($time);
$trigger = new JitterTrigger($inner);
$ | {
"filepath": "src/Symfony/Component/Scheduler/Tests/Trigger/JitterTriggerTest.php",
"language": "php",
"file_size": 1207,
"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\Scheduler\Tests\Messenger;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
use Symfony\Component\Clock\MockClock;
use Symfony\Compone... | ace;
use Symfony\Component\Scheduler\Tests\Fixtures\SomeScheduleProvider;
use Symfony\Component\Scheduler\Trigger\TriggerInterface;
use Symfony\Contracts\Service\ServiceLocatorTrait;
class SchedulerTransportFactoryTest extends TestCase
{
public functi | mfony\Component\Scheduler\Messenger\SchedulerTransport;
use Symfony\Component\Scheduler\Messenger\SchedulerTransportFactory;
use Symfony\Component\Scheduler\RecurringMessage;
use Symfony\Component\Scheduler\ScheduleProviderInterf | {
"filepath": "src/Symfony/Component/Scheduler/Tests/Messenger/SchedulerTransportFactoryTest.php",
"language": "php",
"file_size": 4212,
"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\Scheduler\Tests\Messenger\Serializer\Normalizer;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Sched... | ew SchedulerTriggerNormalizer();
}
#[DataProvider('normalizeProvider')]
public function testNormalize(mixed $data, mixed $expected)
{
self::assertSame($expected, $this->normalizer->normalize($data));
}
public static functi | \Component\Scheduler\Trigger\TriggerInterface;
class SchedulerTriggerNormalizerTest extends TestCase
{
private SchedulerTriggerNormalizer $normalizer;
protected function setUp(): void
{
$this->normalizer = n | {
"filepath": "src/Symfony/Component/Scheduler/Tests/Messenger/Serializer/Normalizer/SchedulerTriggerNormalizerTest.php",
"language": "php",
"file_size": 3460,
"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\Scheduler\Tests\DependencyInjection;
use PHPUnit\Framework\... | $this->expectException(InvalidArgumentException::class);
$this->expectExceptionCode(1);
$container = new ContainerBuilder();
$container->register('provider_a', SomeScheduleProvider::class)->addTag('scheduler.schedule_provider' | jection\AddScheduleMessengerPass;
use Symfony\Component\Scheduler\Tests\Fixtures\SomeScheduleProvider;
class RegisterProviderTest extends TestCase
{
public function testErrorOnMultipleProvidersForTheSameSchedule()
{
| {
"filepath": "src/Symfony/Component/Scheduler/Tests/DependencyInjection/RegisterProviderTest.php",
"language": "php",
"file_size": 1236,
"cut_index": 518,
"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\Scheduler\Event;
use Symfony\Component\Scheduler\Generat... | return $this->messageContext;
}
public function getSchedule(): ScheduleProviderInterface
{
return $this->schedule;
}
public function getMessage(): object
{
return $this->message;
}
public function get | e,
private readonly MessageContext $messageContext,
private readonly object $message,
private readonly mixed $result = null,
) {
}
public function getMessageContext(): MessageContext
{
| {
"filepath": "src/Symfony/Component/Scheduler/Event/PostRunEvent.php",
"language": "php",
"file_size": 1060,
"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\Scheduler\Trigger;
/**
* @author Kevin Bond <kevinbond@gma... | {
$inner = $this->inner;
while ($inner instanceof self) {
$inner = $inner->inner;
}
return $inner;
}
/**
* @return \Traversable<self>
*/
final public function decorators(): \Traversab | inue(\DateTimeImmutable $startedAt): void
{
if ($this->inner instanceof StatefulTriggerInterface) {
$this->inner->continue($startedAt);
}
}
final public function inner(): TriggerInterface
| {
"filepath": "src/Symfony/Component/Scheduler/Trigger/AbstractDecoratedTrigger.php",
"language": "php",
"file_size": 1188,
"cut_index": 518,
"middle_length": 229
} |
he Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Scheduler\Trigger;
/**
* @author Fabien Potencier <fabien@symfony.com>
*/
final class ... | $this->description = $description ?? spl_object_hash($this->callback);
}
public function __toString(): string
{
return $this->description;
}
public function getNextRunDate(\DateTimeImmutable $run): ?\DateTimeImmutable
|
{
$this->callback = $callback(...);
| {
"filepath": "src/Symfony/Component/Scheduler/Trigger/CallbackTrigger.php",
"language": "php",
"file_size": 906,
"cut_index": 547,
"middle_length": 52
} |
buted with this source code.
*/
namespace Symfony\Component\Mime\Encoder;
use Symfony\Component\Mime\CharacterStream;
/**
* @author Chris Corbyn
*/
class QpEncoder implements EncoderInterface
{
/**
* Pre-computed QP for HUGE optimization.
*/
private const QP_MAP = [
0 => '=00', 1 => '=01... | 1 => '=1F', 32 => '=20', 33 => '=21', 34 => '=22',
35 => '=23', 36 => '=24', 37 => '=25', 38 => '=26', 39 => '=27',
40 => '=28', 41 => '=29', 42 => '=2A', 43 => '=2B', 44 => '=2C',
45 => '=2D', 46 => '=2E', 47 => '=2F', 48 => '=30', | > '=0F', 16 => '=10', 17 => '=11', 18 => '=12', 19 => '=13',
20 => '=14', 21 => '=15', 22 => '=16', 23 => '=17', 24 => '=18',
25 => '=19', 26 => '=1A', 27 => '=1B', 28 => '=1C', 29 => '=1D',
30 => '=1E', 3 | {
"filepath": "src/Symfony/Component/Mime/Encoder/QpEncoder.php",
"language": "php",
"file_size": 7857,
"cut_index": 716,
"middle_length": 229
} |
hp
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Scheduler\Trigger;
/**
* @author Kevin Bond <kevinbond@... | >maxSeconds);
}
public function getNextRunDate(\DateTimeImmutable $run): ?\DateTimeImmutable
{
if (!$nextRun = $this->trigger->getNextRunDate($run)) {
return null;
}
return $nextRun->add(new \DateInterval(\ | face $trigger, private readonly int $maxSeconds = 60)
{
parent::__construct($trigger);
}
public function __toString(): string
{
return \sprintf('%s with 0-%d second jitter', $this->trigger, $this- | {
"filepath": "src/Symfony/Component/Scheduler/Trigger/JitterTrigger.php",
"language": "php",
"file_size": 1062,
"cut_index": 515,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Scheduler\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\I... | ug:scheduler', description: 'List schedules and their recurring messages')]
final class DebugCommand extends Command
{
private array $scheduleNames;
public function __construct(private ServiceProviderInterface $schedules)
{
$this->sche | duler\Schedule;
use Symfony\Contracts\Cache\ItemInterface;
use Symfony\Contracts\Service\ServiceProviderInterface;
/**
* Command to list/debug schedules.
*
* @author Kevin Bond <kevinbond@gmail.com>
*/
#[AsCommand(name: 'deb | {
"filepath": "src/Symfony/Component/Scheduler/Command/DebugCommand.php",
"language": "php",
"file_size": 6546,
"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\Scheduler\EventListener;
use Psr\Container\ContainerInterface;
use Psr\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\Even... | Symfony\Component\Scheduler\Event\PostRunEvent;
use Symfony\Component\Scheduler\Event\PreRunEvent;
use Symfony\Component\Scheduler\Messenger\ScheduledStamp;
class DispatchSchedulerEventListener implements EventSubscriberInterface
{
public function __c |
use Symfony\Component\Messenger\Event\WorkerMessageReceivedEvent;
use Symfony\Component\Messenger\Stamp\HandledStamp;
use Symfony\Component\Messenger\Stamp\StampInterface;
use Symfony\Component\Scheduler\Event\FailureEvent;
use | {
"filepath": "src/Symfony/Component/Scheduler/EventListener/DispatchSchedulerEventListener.php",
"language": "php",
"file_size": 3451,
"cut_index": 614,
"middle_length": 229
} |
se Symfony\Component\Lock\Lock;
use Symfony\Component\Lock\LockInterface;
use Symfony\Component\Lock\NoLock;
use Symfony\Component\Lock\Store\InMemoryStore;
use Symfony\Component\Scheduler\Generator\Checkpoint;
use Symfony\Contracts\Cache\ItemInterface;
class CheckpointTest extends TestCase
{
public function testW... | $checkpoint->time());
$this->assertSame(7, $checkpoint->index());
$checkpoint->release($later, null);
}
public function testWithStateInitStateOnFirstAcquiring()
{
$checkpoint = new Checkpoint('cache', new NoLock(), $c | $this->assertTrue($checkpoint->acquire($now));
$this->assertSame($now, $checkpoint->time());
$this->assertSame(-1, $checkpoint->index());
$checkpoint->save($later, 7);
$this->assertSame($later, | {
"filepath": "src/Symfony/Component/Scheduler/Tests/Generator/CheckpointTest.php",
"language": "php",
"file_size": 10988,
"cut_index": 921,
"middle_length": 229
} |
rayAdapter;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Scheduler\Command\DebugCommand;
use Symfony\Component\Scheduler\RecurringMessage;
use Symfony\Component\Scheduler\Schedule;
use Symfony\Component\Scheduler\Trigger\CallbackTrigger;
use Symfony\Contracts\Cache\ItemInterface;
use Symfon... | $command = new DebugCommand($schedules);
$tester = new CommandTester($command);
$tester->execute([], ['decorated' => false]);
$display = preg_replace('/ +$/m', '', $tester->getDisplay(true));
$this->assertSame("\nSc | edules()
{
$schedules = $this->createMock(ServiceProviderInterface::class);
$schedules
->expects($this->once())
->method('getProvidedServices')
->willReturn([])
;
| {
"filepath": "src/Symfony/Component/Scheduler/Tests/Command/DebugCommandTest.php",
"language": "php",
"file_size": 14219,
"cut_index": 921,
"middle_length": 229
} |
file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Scheduler\Tests\Trigger;
use PHPUnit\Framework\TestCase;
use Symfony\C... | da-f]{32}$/', (string) $trigger);
$trigger = new CallbackTrigger(static fn () => null, '');
$this->assertSame('', (string) $trigger);
$trigger = new CallbackTrigger(static fn () => null, 'foo');
$this->assertSame('foo', (s |
$this->assertMatchesRegularExpression('/^[\ | {
"filepath": "src/Symfony/Component/Scheduler/Tests/Trigger/CallbackTriggerTest.php",
"language": "php",
"file_size": 863,
"cut_index": 529,
"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\Scheduler\Tests\Trigger;
use PHPUnit\Framework\TestCase;
use Symfony\Component... | w ExcludeTimeTrigger(
$inner,
new \DateTimeImmutable('2020-02-20T02:02:02Z'),
new \DateTimeImmutable('2020-02-20T20:20:20Z')
);
$this->assertEquals(new \DateTimeImmutable('2020-02-20T02:02:01Z'), $schedu | $inner = $this->createStub(TriggerInterface::class);
$inner
->method('getNextRunDate')
->willReturnCallback(static fn (\DateTimeImmutable $d) => $d->modify('+1 sec'));
$scheduled = ne | {
"filepath": "src/Symfony/Component/Scheduler/Tests/Trigger/ExcludeTimeTriggerTest.php",
"language": "php",
"file_size": 1559,
"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\Scheduler\Tests\Messenger;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Message\RedispatchMess... | public function testGetFromIterator()
{
$messages = [
(object) ['id' => 'first'],
(object) ['id' => 'second'],
];
$generator = $this->createStub(MessageGeneratorInterface::class);
$generator->meth | e Symfony\Component\Scheduler\Messenger\ScheduledStamp;
use Symfony\Component\Scheduler\Messenger\SchedulerTransport;
use Symfony\Component\Scheduler\Trigger\TriggerInterface;
class SchedulerTransportTest extends TestCase
{
| {
"filepath": "src/Symfony/Component/Scheduler/Tests/Messenger/SchedulerTransportTest.php",
"language": "php",
"file_size": 3689,
"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\Scheduler\Event;
use Symfony\Component\Scheduler\Generator\... | n $this->messageContext;
}
public function getSchedule(): ScheduleProviderInterface
{
return $this->schedule;
}
public function getMessage(): object
{
return $this->message;
}
public function shouldCancel( | ly ScheduleProviderInterface $schedule,
private readonly MessageContext $messageContext,
private readonly object $message,
) {
}
public function getMessageContext(): MessageContext
{
retur | {
"filepath": "src/Symfony/Component/Scheduler/Event/PreRunEvent.php",
"language": "php",
"file_size": 1185,
"cut_index": 518,
"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\Scheduler\Trigger;
use Symfony\Component\Scheduler\Ge... | ages(MessageContext $context): iterable
{
return ($this->callback)($context);
}
public function getId(): string
{
return $this->id;
}
public function __toString(): string
{
return $this->description ?: | iterable<object> $callback
*/
public function __construct(callable $callback, private string $id = '', private string $description = '')
{
$this->callback = $callback(...);
}
public function getMess | {
"filepath": "src/Symfony/Component/Scheduler/Trigger/CallbackMessageProvider.php",
"language": "php",
"file_size": 1016,
"cut_index": 512,
"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\Scheduler\Trigger;
final class ExcludeTimeTrigger extends A... | ::ATOM), $this->until->format(\DateTimeInterface::ATOM));
}
public function getNextRunDate(\DateTimeImmutable $run): ?\DateTimeImmutable
{
$nextRun = $this->inner->getNextRunDate($run);
if ($nextRun >= $this->from && $nextRun < | meImmutable $until,
) {
parent::__construct($inner);
}
public function __toString(): string
{
return \sprintf('%s, excluding from %s until %s', $this->inner, $this->from->format(\DateTimeInterface | {
"filepath": "src/Symfony/Component/Scheduler/Trigger/ExcludeTimeTrigger.php",
"language": "php",
"file_size": 1128,
"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\Scheduler\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Schedul... | cron('#weekly', $object)->getTrigger());
}
public function testHashedCronContextIsRequiredIfMessageIsNotStringable()
{
$this->expectException(InvalidArgumentException::class);
RecurringMessage::cron('#midnight', new \stdClass( | {
$object = new DummyStringableMessage();
$this->assertSame('30 0 * * *', (string) RecurringMessage::cron('#midnight', $object)->getTrigger());
$this->assertSame('30 0 * * 3', (string) RecurringMessage:: | {
"filepath": "src/Symfony/Component/Scheduler/Tests/RecurringMessageTest.php",
"language": "php",
"file_size": 1512,
"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\Scheduler\Tests\Trigger;
use PHPUnit\Framework\TestCase;
use Symf... | $this->assertSame([$trigger], iterator_to_array($trigger->decorators()));
}
public function testCanGetNestedInnerTrigger()
{
$trigger = new ExcludeTimeTrigger(
$jitter = new JitterTrigger($inner = $this->createStub(Trig | ggerTest extends TestCase
{
public function testCanGetInnerTrigger()
{
$trigger = new JitterTrigger($inner = $this->createStub(TriggerInterface::class));
$this->assertSame($inner, $trigger->inner());
| {
"filepath": "src/Symfony/Component/Scheduler/Tests/Trigger/AbstractDecoratedTriggerTest.php",
"language": "php",
"file_size": 1273,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Scheduler\Tests\DependencyInjection;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Dependen... | $definition = new Definition($commandClass);
$definition->addTag('console.command');
$definition->addTag('scheduler.task', $arguments);
$container->setDefinition($commandClass, $definition);
(new AddScheduleMessengerPass()) | rTaskCommandProvider')]
public function testProcessSchedulerTaskCommand(array $arguments, string $expectedCommand, string $commandClass = SchedulableCommand::class)
{
$container = new ContainerBuilder();
| {
"filepath": "src/Symfony/Component/Scheduler/Tests/DependencyInjection/AddScheduleMessengerPassTest.php",
"language": "php",
"file_size": 5261,
"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\Scheduler\Event;
use Symfony\Component\Scheduler\Generator\Messag... | t(): MessageContext
{
return $this->messageContext;
}
public function getSchedule(): ScheduleProviderInterface
{
return $this->schedule;
}
public function getMessage(): object
{
return $this->message;
| heduleProviderInterface $schedule,
private readonly MessageContext $messageContext,
private readonly object $message,
private readonly \Throwable $error,
) {
}
public function getMessageContex | {
"filepath": "src/Symfony/Component/Scheduler/Event/FailureEvent.php",
"language": "php",
"file_size": 1315,
"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\Scheduler\Tests;
use PHPUnit\Framework\TestCase;
use ... | $schedule = new Schedule();
$schedule->add(RecurringMessage::cron('* * * * *', new \stdClass()));
$this->expectException(LogicException::class);
$schedule->add(RecurringMessage::cron('* * * * *', new \stdClass()));
}
}
| lic function testCannotAddDuplicateMessage()
{
| {
"filepath": "src/Symfony/Component/Scheduler/Tests/ScheduleTest.php",
"language": "php",
"file_size": 820,
"cut_index": 512,
"middle_length": 52
} |
ion\InvalidArgumentException;
use Symfony\Component\Scheduler\Trigger\PeriodicalTrigger;
use Symfony\Component\Scheduler\Trigger\TriggerInterface;
class PeriodicalTriggerTest extends TestCase
{
#[DataProvider('provideForConstructor')]
public function testConstructor(PeriodicalTrigger $trigger, bool $optimizabl... | getValue($trigger));
}
}
public static function provideForConstructor(): iterable
{
$from = new \DateTimeImmutable($now = '2022-02-22 13:34:00+01:00');
$until = new \DateTimeImmutable($farFuture = '3000-01-01');
| '));
if ($optimizable) {
// test that we are using the fast algorithm for short period of time
$p = new \ReflectionProperty($trigger, 'intervalInSeconds');
$this->assertNotSame(0, $p-> | {
"filepath": "src/Symfony/Component/Scheduler/Tests/Trigger/PeriodicalTriggerTest.php",
"language": "php",
"file_size": 9737,
"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\Scheduler\Trigger;
use Symfony\Component\Scheduler\Exception\InvalidArgumentException;
class PeriodicalTrigger implements StatefulTriggerInterface
{
p... | \DateTimeImmutable('3000-01-01'),
) {
$this->from = \is_string($from) ? new \DateTimeImmutable($from) : $from;
$this->until = \is_string($until) ? new \DateTimeImmutable($until) : $until;
if (\is_int($interval) || \is_float($in | te string|int|float|\DateInterval $interval;
public function __construct(
string|int|float|\DateInterval $interval,
string|\DateTimeImmutable|null $from = null,
string|\DateTimeImmutable $until = new | {
"filepath": "src/Symfony/Component/Scheduler/Trigger/PeriodicalTrigger.php",
"language": "php",
"file_size": 4910,
"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\Scheduler\Trigger;
use Cron\CronExpression;
use Random\Engine\Xoshiro256StarStar;
use Random\Randomizer;
use Symfony\Component\Scheduler\Exception\LogicExc... | #monthly@midnight' => '# #(0-2) # * *',
'#annually' => '# # # # *',
'#annually@midnight' => '# #(0-2) # # *',
'#yearly' => '# # # # *',
'#yearly@midnight' => '# #(0-2) # # *',
'#midnight' => '# #(0-2) * * *',
];
| private const HASH_ALIAS_MAP = [
'#hourly' => '# * * * *',
'#daily' => '# # * * *',
'#weekly' => '# # * * #',
'#weekly@midnight' => '# #(0-2) * * #',
'#monthly' => '# # # * *',
' | {
"filepath": "src/Symfony/Component/Scheduler/Trigger/CronExpressionTrigger.php",
"language": "php",
"file_size": 3468,
"cut_index": 614,
"middle_length": 229
} |
ng\Exception\MissingMandatoryParametersException;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;
/**
* UrlGenerator can generate a URL or a path for any route in the RouteCollection
* based on the passed par... | // reserved chars that have no special meaning for HTTP URIs in a query or fragment
// this excludes esp. "&", "=" and also "+" because PHP would treat it as a space (form-encoded)
'%40' => '@',
'%3A' => ':',
'%21' => '!', | rface
{
private const QUERY_FRAGMENT_DECODED = [
// RFC 3986 explicitly allows those in the query/fragment to reference other URIs unencoded
'%2F' => '/',
'%252F' => '%2F',
'%3F' => '?',
| {
"filepath": "src/Symfony/Component/Routing/Generator/UrlGenerator.php",
"language": "php",
"file_size": 15555,
"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\Scheduler\Messenger;
use Psr\Clock\ClockInterface;
use Psr\Container\ContainerInterface;
use Symfony\Com... | /
class SchedulerTransportFactory implements TransportFactoryInterface
{
public function __construct(
private readonly ContainerInterface $scheduleProviders,
private readonly ClockInterface $clock = new Clock(),
) {
}
publi | duler\Exception\InvalidArgumentException;
use Symfony\Component\Scheduler\Generator\MessageGenerator;
use Symfony\Component\Scheduler\ScheduleProviderInterface;
/**
* @implements TransportFactoryInterface<SchedulerTransport>
* | {
"filepath": "src/Symfony/Component/Scheduler/Messenger/SchedulerTransportFactory.php",
"language": "php",
"file_size": 2083,
"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\Scheduler\Messenger\Serializer\Normalizer;
use Symfony\Component\Messenger\Transport\Serialization\Seria... | e,
];
}
/**
* @param TriggerInterface $data
*/
public function normalize(mixed $data, ?string $format = null, array $context = []): string
{
return (string) $data;
}
public function supportsNormalization( | ace;
final class SchedulerTriggerNormalizer implements DenormalizerInterface, NormalizerInterface
{
public function getSupportedTypes(?string $format): array
{
return [
TriggerInterface::class => fals | {
"filepath": "src/Symfony/Component/Scheduler/Messenger/Serializer/Normalizer/SchedulerTriggerNormalizer.php",
"language": "php",
"file_size": 2180,
"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\Routing;
use Symfony\Component\Routing\Exception\InvalidArgumentException;
class Alias
{
private ar... | /**
* Whether this alias is deprecated, that means it should not be referenced anymore.
*
* @param string $package The name of the composer package that is triggering the deprecation
* @param string $version The version of the package t | ew->id = $id;
return $new;
}
/**
* Returns the target name of this alias.
*
* @return string The target name
*/
public function getId(): string
{
return $this->id;
}
| {
"filepath": "src/Symfony/Component/Routing/Alias.php",
"language": "php",
"file_size": 2532,
"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\Routing;
/**
* CompiledRoutes are returned by the RouteCompiler class.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class CompiledRoute
{
/... | ostTokens Host tokens
* @param array $hostVariables An array of host variables
* @param array $variables An array of variables (variables defined in the path and in the host patterns)
*/
public function __construct(
| ay $tokens An array of tokens to use to generate URL for this route
* @param array $pathVariables An array of path variables
* @param string|null $hostRegex Host regex
* @param array $h | {
"filepath": "src/Symfony/Component/Routing/CompiledRoute.php",
"language": "php",
"file_size": 3719,
"cut_index": 614,
"middle_length": 229
} |
http://tobion.de>
*/
class Route
{
private string $path = '/';
private string $host = '';
private array $schemes = [];
private array $methods = [];
private array $defaults = [];
private array $requirements = [];
private array $options = [];
private string $condition = '';
private ?C... | f default parameter values
* @param array<string|\Stringable> $requirements An array of requirements for parameters (regexes)
* @param array $options An array of options
* @param string|null $host | default)
* * utf8: Whether UTF-8 matching is enforced or not
*
* @param string $path The path pattern to match
* @param array $defaults An array o | {
"filepath": "src/Symfony/Component/Routing/Route.php",
"language": "php",
"file_size": 13071,
"cut_index": 921,
"middle_length": 229
} |
e;
use Symfony\Component\Config\ConfigCacheInterface;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Generator\CompiledUrlGenerator;
use Symfony\Component\Routi... | cher\Dumper\MatcherDumperInterface;
use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
/**
* The Router class is an example of the integration of all pieces of the
* routing system f | ce;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Matcher\CompiledUrlMatcher;
use Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherDumper;
use Symfony\Component\Routing\Mat | {
"filepath": "src/Symfony/Component/Routing/Router.php",
"language": "php",
"file_size": 11487,
"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\Routing\Exception;
/**
* The resource was found but the re... | e = '', int $code = 0, ?\Throwable $previous = null)
{
$this->allowedMethods = array_map('strtoupper', $allowedMethods);
parent::__construct($message, $code, $previous);
}
/**
* Gets the allowed HTTP methods.
*
| ion extends \RuntimeException implements ExceptionInterface
{
protected array $allowedMethods = [];
/**
* @param string[] $allowedMethods
*/
public function __construct(array $allowedMethods, string $messag | {
"filepath": "src/Symfony/Component/Routing/Exception/MethodNotAllowedException.php",
"language": "php",
"file_size": 1129,
"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\Routing\Exception;
/**
* Exception thrown when a route cannot be... | array $missingParameters = [], int $code = 0, ?\Throwable $previous = null)
{
$this->routeName = $routeName;
$this->missingParameters = $missingParameters;
$message = \sprintf('Some mandatory parameters are missing ("%s") to gen | on implements ExceptionInterface
{
private string $routeName = '';
private array $missingParameters = [];
/**
* @param string[] $missingParameters
*/
public function __construct(string $routeName = '', | {
"filepath": "src/Symfony/Component/Routing/Exception/MissingMandatoryParametersException.php",
"language": "php",
"file_size": 1389,
"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\Routing\Matcher;
use Symfony\Component\ExpressionLanguage\Express... | ServiceProviderInterface $functions,
) {
}
public function getFunctions(): array
{
$functions = [];
foreach ($this->functions->getProvidedServices() as $function => $type) {
$functions[] = new ExpressionFuncti | est context to route conditions.
*
* @author Ahmed TAILOULOUTE <ahmed.tailouloute@gmail.com>
*/
class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface
{
public function __construct(
private | {
"filepath": "src/Symfony/Component/Routing/Matcher/ExpressionLanguageProvider.php",
"language": "php",
"file_size": 1495,
"cut_index": 524,
"middle_length": 229
} |
file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Routing\Matcher;
/**
* RedirectableUrlMatcherInterface knows how to r... | $path The path info to redirect to
* @param string $route The route name that matched
* @param string|null $scheme The URL scheme (null to keep the current one)
*/
public function redirect(string $path, string $route, ?string | s for the redirection.
*
* @param string | {
"filepath": "src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php",
"language": "php",
"file_size": 864,
"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\Routing\Matcher;
use Symfony\Component\HttpFoundation\Reque... | ch a request with a set of routes.
*
* If the matcher cannot find information, it must throw one of the exceptions documented
* below.
*
* @throws NoConfigurationException If no routing configuration could be found
* @throws | dException;
/**
* RequestMatcherInterface is the interface that all request matcher classes must implement.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
interface RequestMatcherInterface
{
/**
* Tries to mat | {
"filepath": "src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php",
"language": "php",
"file_size": 1249,
"cut_index": 518,
"middle_length": 229
} |
sionLanguage;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\NoConfigurationException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RequestContext;
use Symfony\Co... | ld be allowed for the request.
*/
protected array $allow = [];
/**
* Collects URI schemes that would be allowed for the request.
*
* @internal
*/
protected array $allowSchemes = [];
protected ?Request $request = nu | Matcher implements UrlMatcherInterface, RequestMatcherInterface
{
public const REQUIREMENT_MATCH = 0;
public const REQUIREMENT_MISMATCH = 1;
public const ROUTE_MATCH = 2;
/**
* Collects HTTP methods that wou | {
"filepath": "src/Symfony/Component/Routing/Matcher/UrlMatcher.php",
"language": "php",
"file_size": 9676,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Routing\Matcher\Dumper;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\NoConfigurationException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Mat... | ic function match(string $pathinfo): array
{
$allow = $allowSchemes = [];
if ($ret = $this->doMatch($pathinfo, $allow, $allowSchemes)) {
return $ret;
}
if ($allow) {
throw new MethodNotAllowedExce | rait CompiledUrlMatcherTrait
{
private bool $matchHost = false;
private array $staticRoutes = [];
private array $regexpList = [];
private array $dynamicRoutes = [];
private ?\Closure $checkCondition;
publ | {
"filepath": "src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherTrait.php",
"language": "php",
"file_size": 7590,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Routing\Matcher\Dumper;
use Symfony\Component\Routing\RouteCollection;
/**
* Prefix tree of routes preserving routes order.
*
* @author Frank de Jonge <info@frankdejonge.nl>
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
class StaticPrefi... | * @return array[]|self[]
*/
public function getRoutes(): array
{
return $this->items;
}
/**
* Adds a route to a group.
*/
public function addRoute(string $prefix, array|self $route): void
{
[$prefix, | self[]
*/
private array $items = [];
public function __construct(
private string $prefix = '/',
) {
}
public function getPrefix(): string
{
return $this->prefix;
}
/**
| {
"filepath": "src/Symfony/Component/Routing/Matcher/Dumper/StaticPrefixCollection.php",
"language": "php",
"file_size": 7092,
"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\Routing\Generator;
/**
* ConfigurableRequirementsInterface must be implemented by URL generators that
... | e): Don't throw an exception but return an empty string as URL for
* mismatching requirements and log the problem. Useful when you cannot control all
* params because they come from third party libs but don't want to have a 404 in
* production env | ompletely.
*
* The possible configurations and use-cases:
* - setStrictRequirements(true): Throw an exception for mismatching requirements. This
* is mostly useful in development environment.
* - setStrictRequirements(fals | {
"filepath": "src/Symfony/Component/Routing/Generator/ConfigurableRequirementsInterface.php",
"language": "php",
"file_size": 2218,
"cut_index": 563,
"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\Scheduler\Trigger;
use Symfony\Component\Scheduler\Generator\MessageContext;
final class StaticMessageProvider implements MessageProviderInterface... | n getMessages(MessageContext $context): iterable
{
return $this->messages;
}
public function getId(): string
{
return $this->id;
}
public function __toString(): string
{
return $this->description ?: $th | $description = '',
) {
}
public functio | {
"filepath": "src/Symfony/Component/Scheduler/Trigger/StaticMessageProvider.php",
"language": "php",
"file_size": 930,
"cut_index": 606,
"middle_length": 52
} |
<?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\Scheduler\Messenger;
/**
* Represents a service call... | {
return $this->method;
}
public function getArguments(): array
{
return $this->arguments;
}
public function __toString(): string
{
return "@$this->serviceId".('__invoke' !== $this->method ? "::$this->met | donly string $method = '__invoke',
private readonly array $arguments = [],
) {
}
public function getServiceId(): string
{
return $this->serviceId;
}
public function getMethod(): string
| {
"filepath": "src/Symfony/Component/Scheduler/Messenger/ServiceCallMessage.php",
"language": "php",
"file_size": 1017,
"cut_index": 512,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Routing;
use Symfony\Component\HttpFoundation\Request;
/**
* Holds information about the current request.
*
* This class implements a fluent interface.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Tobias Schultze <http://tobion.de>
*/... | int $httpPort = 80, int $httpsPort = 443, string $path = '/', string $queryString = '', ?array $parameters = null)
{
$this->setBaseUrl($baseUrl);
$this->setMethod($method);
$this->setHost($host);
$this->setScheme($scheme | private int $httpsPort;
private string $queryString;
private array $parameters = [];
public function __construct(string $baseUrl = '', string $method = 'GET', string $host = 'localhost', string $scheme = 'http', | {
"filepath": "src/Symfony/Component/Routing/RequestContext.php",
"language": "php",
"file_size": 7089,
"cut_index": 716,
"middle_length": 229
} |
hor Tobias Schultze <http://tobion.de>
*/
class RouteCompiler implements RouteCompilerInterface
{
/**
* This string defines the characters that are automatically considered separators in front of
* optional placeholders (with default and no static text following). Such a single separator
* can be le... | s named _fragment
* @throws \LogicException if a variable is referenced more than once
* @throws \DomainException if a variable name starts with a digit or if it is too long to be successfully used as
* | ubpattern name
* http://pcre.org/current/doc/html/pcre2pattern.html#SEC16.
*
* @internal
*/
public const VARIABLE_MAXIMUM_LENGTH = 32;
/**
* @throws \InvalidArgumentException if a path variable i | {
"filepath": "src/Symfony/Component/Routing/RouteCompiler.php",
"language": "php",
"file_size": 14596,
"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\Routing\Attribute;
/**
* @author Fabien Potencier <fabien@symfony.com>
* @author Alexander M. Turek <me@derrabus.de>
*/
#[\Attribute(\Attribute::IS_REPE... | er/login")
* @param string|null $name The route name (i.e. "app_user_login")
* @param array<string|\Stringable> $requirements Requirements for the route attributes, @see https: | r string[] */
public array $schemes;
/** @var (string|DeprecatedAlias)[] */
public array $aliases = [];
/**
* @param string|array<string,string>|null $path The route path (i.e. "/us | {
"filepath": "src/Symfony/Component/Routing/Attribute/Route.php",
"language": "php",
"file_size": 4296,
"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\Routing\Matcher;
use Symfony\Component\Routing\Exception\ExceptionInterface;
use Symfony\Component\Routi... | ['HEAD', 'GET'], true)) {
throw $e;
}
if ($this->allowSchemes) {
redirect_scheme:
$scheme = $this->context->getScheme();
$this->context->setScheme(current($this->allow | rface
{
public function match(string $pathinfo): array
{
try {
return parent::match($pathinfo);
} catch (ResourceNotFoundException $e) {
if (!\in_array($this->context->getMethod(), | {
"filepath": "src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php",
"language": "php",
"file_size": 2052,
"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\Routing\Matcher;
use Symfony\Component\Routing\Exception\MethodNo... | ace
{
/**
* Tries to match a URL path with a set of routes.
*
* If the matcher cannot find information, it must throw one of the exceptions documented
* below.
*
* @param string $pathinfo The path info to be parsed (raw fo | textAwareInterface;
/**
* UrlMatcherInterface is the interface that all URL matcher classes must implement.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
interface UrlMatcherInterface extends RequestContextAwareInterf | {
"filepath": "src/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php",
"language": "php",
"file_size": 1370,
"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\Routing\Matcher\Dumper;
use Symfony\Component\Routing\RouteCo... | g representation of executable code
* that can then be used to match a request against these routes.
*/
public function dump(array $options = []): string;
/**
* Gets the routes to dump.
*/
public function getRoutes(): Route | ce
{
/**
* Dumps a set of routes to a strin | {
"filepath": "src/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php",
"language": "php",
"file_size": 842,
"cut_index": 520,
"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\Scheduler\Messenger;
use Symfony\Component\Messenger\Envelope;
use Symfony\Com... | * @param int $fetchSize Best-effort hint about how many messages can be received in one call
*/
public function get(/* int $fetchSize = 1 */): iterable
{
foreach ($this->messageGenerator->getMessages() as $context => $message) {
| ler\Generator\MessageGeneratorInterface;
class SchedulerTransport implements TransportInterface
{
public function __construct(
private readonly MessageGeneratorInterface $messageGenerator,
) {
}
/**
| {
"filepath": "src/Symfony/Component/Scheduler/Messenger/SchedulerTransport.php",
"language": "php",
"file_size": 1834,
"cut_index": 537,
"middle_length": 229
} |
y\Component\Routing\Exception\RouteCircularReferenceException;
/**
* A RouteCollection represents a set of Route instances.
*
* When adding a route at the end of the collection, an existing route
* with the same name is removed first. So there can only be one route
* with a given name.
*
* @author Fabien Potenc... | private array $resources = [];
/**
* @var array<string, int>
*/
private array $priorities = [];
public function __clone()
{
foreach ($this->routes as $name => $route) {
$this->routes[$name] = clone $route;
|
/**
* @var array<string, Route>
*/
private array $routes = [];
/**
* @var array<string, Alias>
*/
private array $aliases = [];
/**
* @var array<string, ResourceInterface>
*/
| {
"filepath": "src/Symfony/Component/Routing/RouteCollection.php",
"language": "php",
"file_size": 10940,
"cut_index": 921,
"middle_length": 229
} |
file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Routing\Matcher;
use Symfony\Component\Routing\Matcher\Dumper\Compiled... | edUrlMatcherTrait;
public function __construct(array $compiledRoutes, RequestContext $context)
{
$this->context = $context;
[$this->matchHost, $this->staticRoutes, $this->regexpList, $this->dynamicRoutes, $this->checkCondition] = $ | mpiledUrlMatcher extends UrlMatcher
{
use Compil | {
"filepath": "src/Symfony/Component/Routing/Matcher/CompiledUrlMatcher.php",
"language": "php",
"file_size": 861,
"cut_index": 529,
"middle_length": 52
} |
Dumper extends MatcherDumper
{
private ExpressionLanguage $expressionLanguage;
private ?\Exception $signalingException = null;
/**
* @var ExpressionFunctionProviderInterface[]
*/
private array $expressionLanguageProviders = [];
public function dump(array $options = []): string
{
... | ovider;
}
/**
* Generates the arrays for CompiledUrlMatcher's constructor.
*/
public function getCompiledRoutes(bool $forDump = false): array
{
// Group hosts by same-suffix, re-order when possible
$matchHost = fa | {$this->generateCompiledRoutes()}];
EOF;
}
public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider): void
{
$this->expressionLanguageProviders[] = $pr | {
"filepath": "src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php",
"language": "php",
"file_size": 19503,
"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\Routing\Generator;
use Psr\Log\LoggerInterface;
use Symfony\Component\Routing\Exception\RouteNotFoundExc... | $this->compiledRoutes = $compiledRoutes;
$this->context = $context;
$this->logger = $logger;
}
public function generate(string $name, array $parameters = [], int $referenceType = self::ABSOLUTE_PATH): string
{
$loc | ate array $compiledRoutes = [];
public function __construct(
array $compiledRoutes,
RequestContext $context,
?LoggerInterface $logger = null,
private ?string $defaultLocale = null,
) {
| {
"filepath": "src/Symfony/Component/Routing/Generator/CompiledUrlGenerator.php",
"language": "php",
"file_size": 2508,
"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.