prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\AssetMapper\ImportMap;
use Symfony\Component\AssetMapper\Exception\RuntimeException;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Contracts\Htt... | urn list<ImportMapPackageAudit>
*/
public function audit(): array
{
$entries = $this->configReader->getEntries();
/** @var array<string, ImportMapPackageAudit> $packageAudits */
$packageAudits = [];
/** @var a | ction __construct(
private readonly ImportMapConfigReader $configReader,
?HttpClientInterface $httpClient = null,
) {
$this->httpClient = $httpClient ?? HttpClient::create();
}
/**
* @ret | {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/ImportMapAuditor.php",
"language": "php",
"file_size": 4138,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\ImportMap;
use Symfony\Component\AssetMapper\Exception\RuntimeException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\VarExporter\VarExporter;
/**
* Reads/Writes the importmap.php fi... | tem();
}
public function getEntries(): ImportMapEntries
{
if (isset($this->rootImportMapEntries)) {
return $this->rootImportMapEntries;
}
$configPath = $this->importMapConfigPath;
$importMapConfig = | Filesystem $filesystem;
public function __construct(
private readonly string $importMapConfigPath,
private readonly RemotePackageStorage $remotePackageStorage,
) {
$this->filesystem = new Filesys | {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/ImportMapConfigReader.php",
"language": "php",
"file_size": 7920,
"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\AssetMapper\ImportMap;
/**
* Holds the collection of importmap entries define... | }
public function add(ImportMapEntry $entry): void
{
$this->entries[$entry->importName] = $entry;
}
public function has(string $importName): bool
{
return isset($this->entries[$importName]);
}
public funct | private array $entries = [];
/**
* @param ImportMapEntry[] $entries
*/
public function __construct(array $entries = [])
{
foreach ($entries as $entry) {
$this->add($entry);
}
| {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/ImportMapEntries.php",
"language": "php",
"file_size": 1589,
"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\AssetMapper\ImportMap;
/**
* Represents an item that should be in the importmap.
*
* @author Ryan Wea... | ly).
*/
public readonly ?string $version,
/**
* The full "package-name/path" (remote only).
*/
public readonly ?string $packageModuleSpecifier,
) {
}
public static function createLocal(string | /**
* A logical path, relative path or absolute path to the file.
*/
public readonly string $path,
public readonly bool $isEntrypoint,
/**
* The version of the package (remote on | {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/ImportMapEntry.php",
"language": "php",
"file_size": 2623,
"cut_index": 563,
"middle_length": 229
} |
er;
use Symfony\Component\AssetMapper\Exception\LogicException;
use Symfony\Component\AssetMapper\MappedAsset;
/**
* Provides data needed to write the importmap & preloads.
*/
class ImportMapGenerator
{
public const IMPORT_MAP_CACHE_FILENAME = 'importmap.json';
public const ENTRYPOINT_CACHE_FILENAME_PATTERN ... | r->getEntries();
$entrypointNames = [];
foreach ($rootEntries as $entry) {
if ($entry->isEntrypoint) {
$entrypointNames[] = $entry->importName;
}
}
return $entrypointNames;
}
| ader,
private readonly ImportMapConfigReader $importMapConfigReader,
) {
}
/**
* @internal
*/
public function getEntrypointNames(): array
{
$rootEntries = $this->importMapConfigReade | {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/ImportMapGenerator.php",
"language": "php",
"file_size": 10227,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\ImportMap;
use Symfony\Component\AssetMapper\AssetMapperInterface;
use Symfony\Component\AssetMapper\ImportMap\Resolver\PackageResolverInterface;
use Symfony\Component\AssetMapper\MappedAsset;
/**
* @author Kévin Dunglas <kevin@dunglas.dev>
*... | dates packages.
*
* @param PackageRequireOptions[] $packages
*
* @return ImportMapEntry[]
*/
public function require(array $packages): array
{
return $this->updateImportMapConfig(false, $packages, [], []);
}
| ate readonly ImportMapConfigReader $importMapConfigReader,
private readonly RemotePackageDownloader $packageDownloader,
private readonly PackageResolverInterface $resolver,
) {
}
/**
* Adds or up | {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/ImportMapManager.php",
"language": "php",
"file_size": 7077,
"cut_index": 716,
"middle_length": 229
} |
p
/*
* 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\AssetMapper\ImportMap;
final class ImportMapPackageAudit
... | }
public function withVulnerability(ImportMapPackageAuditVulnerability $vulnerability): self
{
return new self(
$this->package,
$this->version,
[...$this->vulnerabilities, $vulnerability],
);
| ic readonly array $vulnerabilities = [],
) {
| {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/ImportMapPackageAudit.php",
"language": "php",
"file_size": 830,
"cut_index": 516,
"middle_length": 52
} |
\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\WebLink\EventListener\AddLinkHeaderListener;
use Symfony\Component\WebLink\GenericLinkProvider;
use Symfony\Component\WebLink\Link;
/**
* @author Kévin Dunglas <kevin@dunglas.dev>
* @author Ryan Weaver <ryan@symfonycasts.com>
*
* @f... | nc()=>await(await fetch('%s')).json())()";
private const LOADER_CSS = "document.head.appendChild(Object.assign(document.createElement('link'),{rel:'stylesheet',href:'%s'}))";
public function __construct(
private readonly ImportMapGenerator | hims@1.10.0/dist/es-module-shims.js';
private const DEFAULT_ES_MODULE_SHIMS_POLYFILL_INTEGRITY = 'sha384-ie1x72Xck445i0j4SlNJ5W5iGeL3Dpa0zD48MZopgWsjNB/lt60SuG1iduZGNnJn';
private const LOADER_JSON = "export default (asy | {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/ImportMapRenderer.php",
"language": "php",
"file_size": 9492,
"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\AssetMapper\ImportMap;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Contracts\HttpClient\HttpClientInterface;
class ImportMapUpdateChecker
{
... | es
*
* @return PackageUpdateInfo[]
*/
public function getAvailableUpdates(array $packages = []): array
{
$entries = $this->importMapConfigReader->getEntries();
$updateInfos = [];
$responses = [];
forea | tMapConfigReader $importMapConfigReader,
?HttpClientInterface $httpClient = null,
) {
$this->httpClient = new BatchHttpClient($httpClient ?? HttpClient::create());
}
/**
* @param string[] $packag | {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/ImportMapUpdateChecker.php",
"language": "php",
"file_size": 3761,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\ImportMap;
use Composer\Semver\Semver;
use Symfony\Component\AssetMapper\Exception\RuntimeException;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface;
use Symfony\Contracts\HttpClient... | $this->httpClient = new BatchHttpClient($httpClient ?? HttpClient::create());
}
/**
* @return PackageVersionProblem[]
*/
public function checkVersions(): array
{
$entries = $this->importMapConfigReader->getEntries(); | $httpClient;
public function __construct(
private ImportMapConfigReader $importMapConfigReader,
private RemotePackageDownloader $packageDownloader,
?HttpClientInterface $httpClient = null,
) {
| {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/ImportMapVersionChecker.php",
"language": "php",
"file_size": 6392,
"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\AssetMapper\ImportMap;
/**
* Represents a module that... | public function __construct(
public readonly string $importName,
public readonly string $assetLogicalPath,
public readonly string $assetSourcePath,
public readonly bool $isLazy = false,
public bool $addImplicitlyToI | "react"
* @param string $assetLogicalPath Logical path to the mapped ass that was imported
* @param bool $addImplicitlyToImportMap Whether this import should be added to the importmap automatically
*/
| {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/JavaScriptImport.php",
"language": "php",
"file_size": 1032,
"cut_index": 513,
"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\AssetMapper\ImportMap;
/**
* Represents a package that should be installed or updated.
*
* @author Kévin Dunglas <kevin@dunglas.dev>
*/
final c... | public readonly ?string $versionConstraint = null,
?string $importName = null,
public readonly ?string $path = null,
public readonly bool $entrypoint = false,
) {
$this->importName = $importName ?: $packageModuleSpe | public readonly string $packageModuleSpecifier,
| {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/PackageRequireOptions.php",
"language": "php",
"file_size": 931,
"cut_index": 606,
"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\AssetMapper\ImportMap;
class PackageUpdateInfo
{
public const UPDATE_TYPE_DOWNGRADE = 'downgrade';
public const UPD... | ageName,
public readonly string $currentVersion,
public ?string $latestVersion = null,
public ?string $updateType = null,
) {
}
public function hasUpdate(): bool
{
return !\in_array($this->updateType, [self: | on __construct(
public readonly string $pack | {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/PackageUpdateInfo.php",
"language": "php",
"file_size": 989,
"cut_index": 582,
"middle_length": 52
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\ImportMap;
use Symfony\Component\AssetMapper\ImportMap\Resolver\PackageResolverInterface;
use Symfony\Component\Filesystem\Filesystem;
/**
* @final
*/
class RemotePackageDownloader
{
private array $installed;
private readonly Filesys... |
public function downloadPackages(?callable $progressCallback = null): array
{
try {
$installed = $this->loadInstalled();
} catch (\InvalidArgumentException) {
$installed = [];
}
$entries = $t | private readonly PackageResolverInterface $packageResolver,
) {
$this->filesystem = new Filesystem();
}
/**
* Downloads all packages.
*
* @return string[] The downloaded packages
*/ | {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/RemotePackageDownloader.php",
"language": "php",
"file_size": 5889,
"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\AssetMapper\ImportMap;
use Symfony\Component\AssetMapper\Exception\RuntimeException;
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Co... | ownloaded(ImportMapEntry $entry): bool
{
if (!$entry->isRemotePackage()) {
throw new \InvalidArgumentException(\sprintf('The entry "%s" is not a remote package.', $entry->importName));
}
return is_file($this->getDow | function __construct(private readonly string $vendorDir)
{
$this->filesystem = new Filesystem();
}
public function getStorageDir(): string
{
return $this->vendorDir;
}
public function isD | {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/RemotePackageStorage.php",
"language": "php",
"file_size": 3853,
"cut_index": 614,
"middle_length": 229
} |
ntimeException;
use Symfony\Component\AssetMapper\ImportMap\BatchHttpClient;
use Symfony\Component\AssetMapper\ImportMap\ImportMapEntry;
use Symfony\Component\AssetMapper\ImportMap\ImportMapType;
use Symfony\Component\AssetMapper\ImportMap\PackageRequireOptions;
use Symfony\Component\Filesystem\Path;
use Symfony\Compon... | sdelivr.net/npm/%s@%s%s';
public const URL_PATTERN_DIST = self::URL_PATTERN_DIST_CSS.'/+esm';
public const URL_PATTERN_ENTRYPOINT = 'https://data.jsdelivr.com/v1/packages/npm/%s@%s/entrypoints';
public const IMPORT_REGEX = '#(?:import\s*(?:[\w | erface;
final class JsDelivrEsmResolver implements PackageResolverInterface
{
public const URL_PATTERN_VERSION = 'https://data.jsdelivr.com/v1/packages/npm/%s/resolved';
public const URL_PATTERN_DIST_CSS = 'https://cdn.j | {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/Resolver/JsDelivrEsmResolver.php",
"language": "php",
"file_size": 15169,
"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\AssetMapper\ImportMap\Resolver;
use Symfony\Component\AssetMapper... | *
* @return ResolvedImportMapPackage[] The import map entries that should be added
*/
public function resolvePackages(array $packagesToRequire): array;
/**
* Downloads the contents of the given packages.
*
* The returned | verts them to ImportMapEntry objects.
*
* If "download" is specified in PackageRequireOptions, the resolved package
* contents should be included.
*
* @param PackageRequireOptions[] $packagesToRequire
| {
"filepath": "src/Symfony/Component/AssetMapper/ImportMap/Resolver/PackageResolverInterface.php",
"language": "php",
"file_size": 1472,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\Command;
use Symfony\Component\AssetMapper\AssetMapper;
use Symfony\Component\AssetMapper\AssetMapperInterface;
use Symfony\Component\AssetMapper\CompiledAssetMapperConfigReader;
use Symfony\Component\AssetMapper\Event\PreAssetsCompileEvent;
use... | her\EventDispatcherInterface;
/**
* Compiles the assets in the asset mapper to the final output directory.
*
* This command is intended to be used during deployment.
*
* @author Ryan Weaver <ryan@symfonycasts.com>
*/
#[AsCommand(name: 'asset-map:com | ony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Contracts\EventDispatc | {
"filepath": "src/Symfony/Component/AssetMapper/Command/AssetMapperCompileCommand.php",
"language": "php",
"file_size": 5497,
"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\Security\Core\Signature;
use Psr\Cache\CacheItemPoolInte... | che->getItem($key)->get();
}
public function incrementUsages(string $hash): void
{
$item = $this->cache->getItem(rawurlencode($hash));
if (!$item->isHit()) {
$item->expiresAfter($this->lifetime);
}
| vate int $lifetime,
) {
}
public function countUsages(string $hash): int
{
$key = rawurlencode($hash);
if (!$this->cache->hasItem($key)) {
return 0;
}
return $this->ca | {
"filepath": "src/Symfony/Component/Security/Core/Signature/ExpiredSignatureStorage.php",
"language": "php",
"file_size": 1087,
"cut_index": 515,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Dumper;
use Symfony\Component\Security\Core\Role\RoleHierarchy;
use Symfony\Component\Secu... | the flowchart
*/
public function dump(RoleHierarchyInterface $roleHierarchy, MermaidDirection $direction = MermaidDirection::TOP_TO_BOTTOM): string
{
$hierarchy = $this->extractHierarchy($roleHierarchy);
if (!$hierarchy) {
| dDumper
{
/**
* Dumps the role hierarchy as a Mermaid flowchart.
*
* @param RoleHierarchyInterface $roleHierarchy The role hierarchy to dump
* @param MermaidDirection $direction The direction of | {
"filepath": "src/Symfony/Component/Security/Core/Dumper/MermaidDumper.php",
"language": "php",
"file_size": 2650,
"cut_index": 563,
"middle_length": 229
} |
php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Webhook;
use Symfony\Component\Webhook\Exception\Invali... |
throw new InvalidArgumentException('A non-empty secret is required.');
}
}
public function getUrl(): string
{
return $this->url;
}
public function getSecret(): string
{
return $this->secret;
| f (!$secret) { | {
"filepath": "src/Symfony/Component/Webhook/Subscriber.php",
"language": "php",
"file_size": 790,
"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\Webhook\Server;
use Symfony\Component\HttpClient\HttpOptions;
use... | ializer = $payloadSerializer instanceof SerializerInterface ? new SerializerPayloadSerializer($payloadSerializer) : $payloadSerializer;
}
public function configure(RemoteEvent $event, #[\SensitiveParameter] string $secret, HttpOptions $options): v | lements RequestConfiguratorInterface
{
private PayloadSerializerInterface $payloadSerializer;
public function __construct(SerializerInterface|PayloadSerializerInterface $payloadSerializer)
{
$this->payloadSer | {
"filepath": "src/Symfony/Component/Webhook/Server/JsonBodyConfigurator.php",
"language": "php",
"file_size": 1282,
"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\Webhook\Client;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Reque... |
$this->validate($request);
return $this->doParse($request, $secret);
}
public function createSuccessfulResponse(?Request $request = null): Response
{
return new Response('', 202);
}
public function createReje | r Fabien Potencier <fabien@symfony.com>
*/
abstract class AbstractRequestParser implements RequestParserInterface
{
public function parse(Request $request, #[\SensitiveParameter] string $secret): RemoteEvent|array|null
{ | {
"filepath": "src/Symfony/Component/Webhook/Client/AbstractRequestParser.php",
"language": "php",
"file_size": 2353,
"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\Webhook\Client;
use Symfony\Component\HttpFoundation\ChainRequestMatcher;
use Symfony\Component\HttpFoun... | ption\RejectWebhookException;
/**
* @author Fabien Potencier <fabien@symfony.com>
*/
class RequestParser extends AbstractRequestParser
{
public function __construct(
private readonly string $algo = 'sha256',
private readonly string $ | thodRequestMatcher;
use Symfony\Component\HttpFoundation\RequestMatcherInterface;
use Symfony\Component\RemoteEvent\RemoteEvent;
use Symfony\Component\Webhook\Exception\InvalidArgumentException;
use Symfony\Component\Webhook\Exce | {
"filepath": "src/Symfony/Component/Webhook/Client/RequestParser.php",
"language": "php",
"file_size": 2788,
"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\Webhook\Tests\Server;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpClient\HttpOptions;
use ... | loadSerializerInterface::class);
$payloadSerializer
->expects($this->once())
->method('serialize')
->with($payload)
;
$httpOptions = new HttpOptions();
$httpOptions->setHeaders([
| \PayloadSerializerInterface;
class JsonBodyConfiguratorTest extends TestCase
{
public function testPayloadWithPayloadSerializer()
{
$payload = ['foo' => 'bar'];
$payloadSerializer = $this->createMock(Pay | {
"filepath": "src/Symfony/Component/Webhook/Tests/Server/JsonBodyConfiguratorTest.php",
"language": "php",
"file_size": 2139,
"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\Webhook\Test;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony... | ed)
{
$request = $this->createRequest($payload);
$parser = $this->createRequestParser();
$wh = $parser->parse($request, $this->getSecret());
$this->assertEquals($expected, $wh);
}
/**
* @return iterable<arr | com>
*/
abstract class AbstractRequestParserTestCase extends TestCase
{
/**
* @dataProvider getPayloads
*/
#[DataProvider('getPayloads')]
public function testParse(string $payload, RemoteEvent|array $expect | {
"filepath": "src/Symfony/Component/Webhook/Test/AbstractRequestParserTestCase.php",
"language": "php",
"file_size": 2289,
"cut_index": 563,
"middle_length": 229
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Webhook\Messenger;
use Symfony\Component\RemoteEvent\... | er $subscriber,
private readonly RemoteEvent $event,
) {
}
public function getSubscriber(): Subscriber
{
return $this->subscriber;
}
public function getEvent(): RemoteEvent
{
return $this->event;
}
| donly Subscrib | {
"filepath": "src/Symfony/Component/Webhook/Messenger/SendWebhookMessage.php",
"language": "php",
"file_size": 784,
"cut_index": 512,
"middle_length": 14
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event... | EventSubscriberInterface
{
// source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
private const EXTENSIONS_MAP = [
'aac' => 'audio/aac',
'abw' => 'application/x-abiword',
'arc' => | y\Component\HttpKernel\Profiler\Profiler;
/**
* Functions like a controller that returns assets from the asset mapper.
*
* @author Ryan Weaver <ryan@symfonycasts.com>
*/
final class AssetMapperDevServerSubscriber implements | {
"filepath": "src/Symfony/Component/AssetMapper/AssetMapperDevServerSubscriber.php",
"language": "php",
"file_size": 7303,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator;
/**
* Finds assets in the asset mapper.
*
* @author Ryan Weaver <ryan@symfonycasts.com>
*
* @final
*/
class AssetMapperReposit... | nly bool $excludeDotFiles = true,
private readonly bool $debug = true,
) {
}
/**
* Given the logical path - styles/app.css - returns the absolute path to the file.
*/
public function find(string $logicalPath): ?string
| g for no namespace)
*/
public function __construct(
private readonly array $paths,
private readonly string $projectRootDir,
private readonly array $excludedPathPatterns = [],
private reado | {
"filepath": "src/Symfony/Component/AssetMapper/AssetMapperRepository.php",
"language": "php",
"file_size": 5907,
"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\AssetMapper;
use Symfony\Component\Filesystem\Filesystem;
use Sym... | h::join($this->directory, $filename));
}
public function loadConfig(string $filename): array
{
return json_decode($this->filesystem->readFile(Path::join($this->directory, $filename)), true, 512, \JSON_THROW_ON_ERROR);
}
public |
public function __construct(
private readonly string $directory,
) {
$this->filesystem = new Filesystem();
}
public function configExists(string $filename): bool
{
return is_file(Pat | {
"filepath": "src/Symfony/Component/AssetMapper/CompiledAssetMapperConfigReader.php",
"language": "php",
"file_size": 1484,
"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\AssetMapper\Exception;
use Symfony\Component\AssetMap... | he circular reference was detected.
*
* This asset will not be fully initialized: it will be missing some
* properties like digest and content.
*/
public function getIncompleteMappedAsset(): MappedAsset
{
return $this->m | ate MappedAsset $mappedAsset, string $message = '', int $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
/**
* Returns the asset that was being created when t | {
"filepath": "src/Symfony/Component/AssetMapper/Exception/CircularAssetsException.php",
"language": "php",
"file_size": 1017,
"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\AssetMapper\Compressor;
use Psr\Log\LoggerInterface;
/**
* Call... | if (null === $this->compressors) {
$this->compressors = [];
foreach ([new BrotliCompressor(), new ZstandardCompressor(), new GzipCompressor()] as $compressor) {
$unsupportedReason = $compressor->getUnsupportedRe | $compressors
*/
public function __construct(
private ?array $compressors = null,
private readonly ?LoggerInterface $logger = null,
) {
}
public function compress(string $path): void
{
| {
"filepath": "src/Symfony/Component/AssetMapper/Compressor/ChainCompressor.php",
"language": "php",
"file_size": 1372,
"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\AssetMapper\Compressor;
use Symfony\Component\Process\ExecutableFinder;
use Symfony\Component\Process\Process;
/**
* @internal
*
* @author Kévin Dungla... | essWithExtension(...);
return;
}
if (!class_exists(Process::class)) {
if ('' === self::WRAPPER) {
$this->unsupportedReason = \sprintf('%s compression is unsupported. Run "composer require symfony/pr | ;
private ?string $unsupportedReason = null;
private function initialize(): void
{
if ('' !== self::WRAPPER && \in_array(self::WRAPPER, stream_get_wrappers(), true)) {
$this->method = $this->compr | {
"filepath": "src/Symfony/Component/AssetMapper/Compressor/CompressorTrait.php",
"language": "php",
"file_size": 3401,
"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\Security\Core\Test;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use S... | terInterface;
/**
* Abstract test case for access decision strategies.
*
* @author Alexander M. Turek <me@derrabus.de>
*/
abstract class AccessDecisionStrategyTestCase extends TestCase
{
/**
* @dataProvider provideStrategyTests
*
* | DecisionManager;
use Symfony\Component\Security\Core\Authorization\Strategy\AccessDecisionStrategyInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Vote;
use Symfony\Component\Security\Core\Authorization\Voter\Vo | {
"filepath": "src/Symfony/Component/Security/Core/Test/AccessDecisionStrategyTestCase.php",
"language": "php",
"file_size": 2607,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Security\Core\Signature;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\Security\Core\Exception\InvalidArgumentException;
use Symfony\Component\Security\Core\Signature\Exception\ExpiredSignatureException;
use Symfony\C... | rties of the User; the hash is invalidated if these properties change
* @param ExpiredSignatureStorage|null $expiredSignaturesStorage If provided, secures a sequence of hashes that are expired
* @param int|null $maxUses | d remember-me cookies.
*
* @author Wouter de Jong <wouter@wouterj.nl>
* @author Ryan Weaver <ryan@symfonycasts.com>
*/
class SignatureHasher
{
/**
* @param array $signatureProperties Prope | {
"filepath": "src/Symfony/Component/Security/Core/Signature/SignatureHasher.php",
"language": "php",
"file_size": 5467,
"cut_index": 716,
"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\Webhook\Server;
use Symfony\Component\HttpClient\HttpOptions;
use Symfony\Component\RemoteEvent\RemoteEvent;
/**
* @autho... | string $idHeaderName = 'Webhook-Id',
) {
}
public function configure(RemoteEvent $event, #[\SensitiveParameter] string $secret, HttpOptions $options): void
{
$options->setHeaders([
$this->eventHeaderName => $event->getN | derName = 'Webhook-Event',
private readonly | {
"filepath": "src/Symfony/Component/Webhook/Server/HeadersConfigurator.php",
"language": "php",
"file_size": 969,
"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\Webhook\Client;
use Symfony\Component\HttpFoundation\Request;
use... | *
* @throws RejectWebhookException When the payload is rejected (signature issue, parse issue, ...)
*/
public function parse(Request $request, #[\SensitiveParameter] string $secret): RemoteEvent|array|null;
/**
* @param Request|n | ien@symfony.com>
*/
interface RequestParserInterface
{
/**
* Parses an HTTP Request and converts it into a RemoteEvent.
*
* @return RemoteEvent|RemoteEvent[]|null Returns null if the webhook must be ignored
| {
"filepath": "src/Symfony/Component/Webhook/Client/RequestParserInterface.php",
"language": "php",
"file_size": 1393,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Webhook\Tests\Controller;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Messenger\Envelope;
use Symfony\Compo... | $controller = new WebhookController([], new MessageBus());
$response = $controller->handle('foo', new Request());
$this->assertSame(404, $response->getStatusCode());
}
#[DataProvider('rejectedParseProvider')]
public funct | vent;
use Symfony\Component\Webhook\Client\RequestParserInterface;
use Symfony\Component\Webhook\Controller\WebhookController;
class WebhookControllerTest extends TestCase
{
public function testNoParserAvailable()
{
| {
"filepath": "src/Symfony/Component/Webhook/Tests/Controller/WebhookControllerTest.php",
"language": "php",
"file_size": 5518,
"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\AssetMapper;
use Symfony\Component\AssetMapper\Compiler\AssetComp... | Closure $assetMapperFactory)
{
}
public function compile(string $content, MappedAsset $asset): string
{
foreach ($this->assetCompilers as $compiler) {
if (!$compiler->supports($asset)) {
continue;
| * @param iterable<AssetCompilerInterface> $assetCompilers
* @param \Closure(): AssetMapperInterface $assetMapperFactory
*/
public function __construct(private readonly iterable $assetCompilers, private readonly \ | {
"filepath": "src/Symfony/Component/AssetMapper/AssetMapperCompiler.php",
"language": "php",
"file_size": 1423,
"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\AssetMapper;
use Symfony\Component\AssetMapper\ImportMap\JavaScriptImport;
/**
* Represents a single asset in the asset mapper system.
*
* @author Ryan... | ?string $content;
public readonly string $digest;
public readonly bool $isPredigested;
/**
* @param MappedAsset[] $dependencies assets that the content of this asset depends on
* @param string[] $fileDependencies | t;
public readonly string $publicExtension;
/**
* The final content of this asset if different from the sourcePath.
*
* If null, the content should be read from the sourcePath.
*/
public readonly | {
"filepath": "src/Symfony/Component/AssetMapper/MappedAsset.php",
"language": "php",
"file_size": 3214,
"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\AssetMapper\Compressor;
use Symfony\Component\Process\Proce... | ble = null,
) {
$this->executable = $executable;
}
/**
* @return resource
*/
private function createStreamContext()
{
return stream_context_create(['brotli' => ['level' => BROTLI_COMPRESS_LEVEL_MAX]]);
}
|
private const WRAPPER = 'compress.brotli';
private const COMMAND = 'brotli';
private const PHP_EXTENSION = 'brotli';
private const FILE_EXTENSION = 'br';
public function __construct(
?string $executa | {
"filepath": "src/Symfony/Component/AssetMapper/Compressor/BrotliCompressor.php",
"language": "php",
"file_size": 1207,
"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\Security\Core\Authorization\Voter;
use Symfony\Component\Se... | lowing constants:
* ACCESS_GRANTED, ACCESS_DENIED, or ACCESS_ABSTAIN.
*
* @param mixed $subject The subject to secure
* @param mixed[] $attributes An array of attributes associated with the method being invoked
* @param Vo | face
{
public const ACCESS_GRANTED = 1;
public const ACCESS_ABSTAIN = 0;
public const ACCESS_DENIED = -1;
/**
* Returns the vote for the given parameters.
*
* This method must return one of the fol | {
"filepath": "src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php",
"language": "php",
"file_size": 1214,
"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\Webhook\Server;
use Symfony\Component\HttpClient\HttpOptions;
use... | $signatureHeaderName = 'Webhook-Signature',
) {
}
public function configure(RemoteEvent $event, #[\SensitiveParameter] string $secret, HttpOptions $options): void
{
if (!$secret) {
throw new InvalidArgumentException('A | encier <fabien@symfony.com>
*/
final class HeaderSignatureConfigurator implements RequestConfiguratorInterface
{
public function __construct(
private readonly string $algo = 'sha256',
private readonly string | {
"filepath": "src/Symfony/Component/Webhook/Server/HeaderSignatureConfigurator.php",
"language": "php",
"file_size": 1453,
"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\Webhook\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\... | t(
/** @var array<string, array{parser: RequestParserInterface, secret: string}> $parsers */
private readonly array $parsers,
private readonly MessageBusInterface $bus,
) {
}
public function handle(string $type, Request | ent\RequestParserInterface;
/**
* Receives webhooks from a variety of third-party providers.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @internal
*/
final class WebhookController
{
public function __construc | {
"filepath": "src/Symfony/Component/Webhook/Controller/WebhookController.php",
"language": "php",
"file_size": 1809,
"cut_index": 537,
"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\AssetMapper;
/**
* Finds and returns assets in the pi... | Fetches the asset given its source path (i.e. filesystem path).
*/
public function getAssetFromSourcePath(string $sourcePath): ?MappedAsset;
/**
* Returns the public path for this asset, if it can be found.
*/
public function g | t.
*/
public function getAsset(string $logicalPath): ?MappedAsset;
/**
* Returns all mapped assets.
*
* @return iterable<MappedAsset>
*/
public function allAssets(): iterable;
/**
* | {
"filepath": "src/Symfony/Component/AssetMapper/AssetMapperInterface.php",
"language": "php",
"file_size": 1044,
"cut_index": 513,
"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\AssetMapper\Compressor;
/**
* Compresses a file.
*
* @author Kévin ... | 'html',
'js',
'json',
'md',
'otc',
'otf',
'proto',
'rss',
'rtf',
'svg',
'ttc',
'ttf',
'txt',
'wasm',
'xml',
];
public function compress | 'css',
'cur',
'eot',
| {
"filepath": "src/Symfony/Component/AssetMapper/Compressor/CompressorInterface.php",
"language": "php",
"file_size": 862,
"cut_index": 529,
"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\AssetMapper;
use Symfony\Component\AssetMapper\Factory\MappedAssetFactoryInterface;
/**
* Finds and re... | eader $compiledConfigReader,
) {
}
public function getAsset(string $logicalPath): ?MappedAsset
{
$filePath = $this->mapperRepository->find($logicalPath);
if (null === $filePath) {
return null;
}
| ll;
public function __construct(
private readonly AssetMapperRepository $mapperRepository,
private readonly MappedAssetFactoryInterface $mappedAssetFactory,
private readonly CompiledAssetMapperConfigR | {
"filepath": "src/Symfony/Component/AssetMapper/AssetMapper.php",
"language": "php",
"file_size": 2530,
"cut_index": 563,
"middle_length": 229
} |
hp
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\AssetMapper;
use Symfony\Component\Asset\PackageInterfac... | ing
{
return $this->innerPackage->getVersion($path);
}
public function getUrl(string $path): string
{
$publicPath = $this->assetMapper->getPublicPath($path);
if ($publicPath) {
$path = ltrim($publicPath, | ageInterface
{
public function __construct(
private readonly PackageInterface $innerPackage,
private readonly AssetMapperInterface $assetMapper,
) {
}
public function getVersion(string $path): str | {
"filepath": "src/Symfony/Component/AssetMapper/MapperAwareAssetPackage.php",
"language": "php",
"file_size": 1077,
"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\Webhook\Server;
use Symfony\Component\HttpClient\HttpOptions;
use... | RequestConfiguratorInterface $body,
private readonly RequestConfiguratorInterface $signer,
) {
}
public function send(Subscriber $subscriber, RemoteEvent $event): void
{
$options = new HttpOptions();
$this->header | >
*/
class Transport implements TransportInterface
{
public function __construct(
private readonly HttpClientInterface $client,
private readonly RequestConfiguratorInterface $headers,
private readonly | {
"filepath": "src/Symfony/Component/Webhook/Server/Transport.php",
"language": "php",
"file_size": 1314,
"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\AssetMapper\Command;
use Symfony\Component\AssetMapper\Compressor\CompressorInterface;
use Symfony\Compo... | sets:compress', description: 'Pre-compresses files to serve through a web server')]
final class CompressAssetsCommand extends Command
{
public function __construct(
private readonly CompressorInterface $compressor,
) {
parent::__con | ony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
/**
* Pre-compresses files to serve through a web server.
*
* @author Kévin Dunglas <kevin@dunglas.dev>
*/
#[AsCommand(name: 'as | {
"filepath": "src/Symfony/Component/AssetMapper/Command/CompressAssetsCommand.php",
"language": "php",
"file_size": 2157,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\Tests\ImportMap;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\AssetMapper\Exception\RuntimeException;
use Symfony\Component\AssetMapper\ImportMap\ImportMapAuditor;
use Symfony\Component\Ass... | e Symfony\Component\HttpClient\Response\JsonMockResponse;
use Symfony\Component\HttpClient\Response\MockResponse;
use Symfony\Contracts\HttpClient\HttpClientInterface;
class ImportMapAuditorTest extends TestCase
{
private ImportMapConfigReader $import | apper\ImportMap\ImportMapPackageAudit;
use Symfony\Component\AssetMapper\ImportMap\ImportMapPackageAuditVulnerability;
use Symfony\Component\AssetMapper\ImportMap\ImportMapType;
use Symfony\Component\HttpClient\MockHttpClient;
us | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapAuditorTest.php",
"language": "php",
"file_size": 6461,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\Tests\ImportMap;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\AssetMapper\Exception\RuntimeException;
use Symfony\Component\AssetMapper\ImportMap\ImportMapConfigReader;
use Symfony\Componen... | lesystem = new Filesystem();
if (!file_exists(__DIR__.'/../Fixtures/importmap_config_reader/assets')) {
$this->filesystem->mkdir(__DIR__.'/../Fixtures/importmap_config_reader/assets');
}
}
protected function tearDown(): | er\ImportMap\RemotePackageStorage;
use Symfony\Component\Filesystem\Filesystem;
class ImportMapConfigReaderTest extends TestCase
{
private Filesystem $filesystem;
protected function setUp(): void
{
$this->fi | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapConfigReaderTest.php",
"language": "php",
"file_size": 8449,
"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\AssetMapper\Tests\ImportMap;
use PHPUnit\Framework\TestCase;
use Symfony\Compo... | 'path2', false);
$entries = new ImportMapEntries([$entry1]);
$entries->add($entry2);
$this->assertSame([$entry1, $entry2], iterator_to_array($entries));
}
public function testHas()
{
$entries = new ImportMapE | extends TestCase
{
public function testGetIterator()
{
$entry1 = ImportMapEntry::createLocal('entry1', ImportMapType::JS, 'path1', true);
$entry2 = ImportMapEntry::createLocal('entry2', ImportMapType::CSS, | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapEntriesTest.php",
"language": "php",
"file_size": 1717,
"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\AssetMapper\Tests\ImportMap;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCa... | $this->assertSame('foo.js', $entry->path);
$this->assertTrue($entry->isEntrypoint);
$this->assertFalse($entry->isRemotePackage());
}
public function testCreateRemote()
{
$entry = ImportMapEntry::createRemote('foo', Imp | CreateLocal()
{
$entry = ImportMapEntry::createLocal('foo', ImportMapType::JS, 'foo.js', true);
$this->assertSame('foo', $entry->importName);
$this->assertSame(ImportMapType::JS, $entry->type);
| {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapEntryTest.php",
"language": "php",
"file_size": 2832,
"cut_index": 563,
"middle_length": 229
} |
ny\Component\AssetMapper\ImportMap\JavaScriptImport;
use Symfony\Component\AssetMapper\MappedAsset;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Path;
class ImportMapGeneratorTest extends TestCase
{
private AssetMapperInterface $assetMapper;
private CompiledAssetMapperConfigRea... | }
}
protected function tearDown(): void
{
$this->filesystem->remove(self::$writableRoot);
}
public function testGetEntrypointNames()
{
$manager = $this->createImportMapGenerator();
$this->mockImportMap( | ator';
protected function setUp(): void
{
$this->filesystem = new Filesystem();
if (!file_exists(self::$writableRoot.'/assets')) {
$this->filesystem->mkdir(self::$writableRoot.'/assets');
| {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapGeneratorTest.php",
"language": "php",
"file_size": 31052,
"cut_index": 1331,
"middle_length": 229
} |
\ImportMap\PackageRequireOptions;
use Symfony\Component\AssetMapper\ImportMap\RemotePackageDownloader;
use Symfony\Component\AssetMapper\ImportMap\Resolver\PackageResolverInterface;
use Symfony\Component\AssetMapper\ImportMap\Resolver\ResolvedImportMapPackage;
use Symfony\Component\AssetMapper\MappedAsset;
use Symfony\... | r';
protected function setUp(): void
{
$this->filesystem = new Filesystem();
if (!file_exists(__DIR__.'/../Fixtures/importmap_manager/assets')) {
$this->filesystem->mkdir(self::$writableRoot.'/assets');
}
}
| e ImportMapConfigReader&MockObject $configReader;
private RemotePackageDownloader $remotePackageDownloader;
private Filesystem $filesystem;
private static string $writableRoot = __DIR__.'/../Fixtures/importmap_manage | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapManagerTest.php",
"language": "php",
"file_size": 18680,
"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\AssetMapper\Tests\ImportMap;
use PHPUnit\Framework\Attributes\Dat... | rmat = null)
{
$updateChecker = $this->createStub(ImportMapUpdateChecker::class);
$command = new ImportMapOutdatedCommand($updateChecker);
$commandTester = new CommandTester($command);
$commandTester->execute(\is_string | omponent\Console\Tester\CommandTester;
class ImportMapOutdatedCommandTest extends TestCase
{
#[DataProvider('provideNoOutdatedPackageCases')]
public function testCommandWhenNoOutdatedPackages(string $display, ?string $fo | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapOutdatedCommandTest.php",
"language": "php",
"file_size": 1492,
"cut_index": 524,
"middle_length": 229
} |
\ImportMapGenerator;
use Symfony\Component\AssetMapper\ImportMap\ImportMapRenderer;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\WebLink\GenericLinkProvider;
class ImportMapRendererTest extends TestCase
{
public function testBasicRender()
... | ,
'app_js_no_preload' => [
'path' => '/assets/app-nopreload-d1g35t.js',
'type' => 'js',
],
'app_css_preload' => [
'path' => '/assets/styles/app-prel | ['app'])
->willReturn([
'app_js_preload' => [
'path' => '/assets/app-preload-d1g35t.js',
'type' => 'js',
'preload' => true,
] | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapRendererTest.php",
"language": "php",
"file_size": 11034,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\Tests\ImportMap;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\AssetMapper\ImportMap\ImportMapConfigReader;
use Symfony\Component\AssetMapper\ImportMap\ImportMapEntries;
use Symfony\Componen... | kerTest extends TestCase
{
private ImportMapConfigReader $importMapConfigReader;
private ImportMapUpdateChecker $updateChecker;
protected function setUp(): void
{
$this->importMapConfigReader = $this->createStub(ImportMapConfigRead | etMapper\ImportMap\PackageUpdateInfo;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\HttpClient\Response\JsonMockResponse;
use Symfony\Component\HttpClient\Response\MockResponse;
class ImportMapUpdateChec | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapUpdateCheckerTest.php",
"language": "php",
"file_size": 7766,
"cut_index": 716,
"middle_length": 229
} |
ImportMap\ImportMapConfigReader;
use Symfony\Component\AssetMapper\ImportMap\ImportMapEntries;
use Symfony\Component\AssetMapper\ImportMap\ImportMapEntry;
use Symfony\Component\AssetMapper\ImportMap\ImportMapType;
use Symfony\Component\AssetMapper\ImportMap\ImportMapVersionChecker;
use Symfony\Component\AssetMapper\Imp... | pectedProblems)
{
$configReader = $this->createMock(ImportMapConfigReader::class);
$configReader->expects($this->once())
->method('getEntries')
->willReturn(new ImportMapEntries($importMapEntries));
$rem | ckResponse;
class ImportMapVersionCheckerTest extends TestCase
{
#[DataProvider('getCheckVersionsTests')]
public function testCheckVersions(array $importMapEntries, array $dependencies, array $expectedRequests, array $ex | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapVersionCheckerTest.php",
"language": "php",
"file_size": 13070,
"cut_index": 921,
"middle_length": 229
} |
he Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\AssetMapper\Tests\ImportMap;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Asset... | his->assertSame('the-import', $import->importName);
$this->assertTrue($import->isLazy);
$this->assertSame('the-asset', $import->assetLogicalPath);
$this->assertSame('/path/to/the-asset', $import->assetSourcePath);
$this->ass | set', '/path/to/the-asset', true, true);
$t | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/JavaScriptImportTest.php",
"language": "php",
"file_size": 907,
"cut_index": 547,
"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\AssetMapper\Tests\ImportMap;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCa... | testVersion: $latestVersion,
updateType: $updateType,
);
$this->assertSame($importName, $packageUpdateInfo->packageName);
$this->assertSame($currentVersion, $packageUpdateInfo->currentVersion);
$this->assertSame | estConstructor($importName, $currentVersion, $latestVersion, $updateType)
{
$packageUpdateInfo = new PackageUpdateInfo(
packageName: $importName,
currentVersion: $currentVersion,
la | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/PackageUpdateInfoTest.php",
"language": "php",
"file_size": 2196,
"cut_index": 563,
"middle_length": 229
} |
mponent\AssetMapper\ImportMap\ImportMapEntries;
use Symfony\Component\AssetMapper\ImportMap\ImportMapEntry;
use Symfony\Component\AssetMapper\ImportMap\ImportMapType;
use Symfony\Component\AssetMapper\ImportMap\RemotePackageDownloader;
use Symfony\Component\AssetMapper\ImportMap\RemotePackageStorage;
use Symfony\Compon... | tableRoot);
}
protected function tearDown(): void
{
$this->filesystem->remove(self::$writableRoot);
}
public function testDownloadPackagesDownloadsEverythingWithNoInstalled()
{
$configReader = $this->createMock(Imp | em;
private static string $writableRoot = __DIR__.'/../Fixtures/remote_package_downloader';
protected function setUp(): void
{
$this->filesystem = new Filesystem();
$this->filesystem->mkdir(self::$wri | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageDownloaderTest.php",
"language": "php",
"file_size": 9466,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\Tests\ImportMap;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\AssetMapper\ImportMap\ImportMapEntry;
use Symfony\Component\AssetMapper\ImportMap\ImportMapType;
use Symfony\Component\AssetMap... | esystem = new Filesystem();
$this->filesystem->mkdir(self::$writableRoot);
}
protected function tearDown(): void
{
$this->filesystem->remove(self::$writableRoot);
}
public function testGetStorageDir()
{
$st | g $writableRoot;
private static int $writableRootIndex = 0;
protected function setUp(): void
{
self::$writableRoot = sys_get_temp_dir().'/remote_package_storage'.++self::$writableRootIndex;
$this->fil | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageStorageTest.php",
"language": "php",
"file_size": 6439,
"cut_index": 716,
"middle_length": 229
} |
provideResolvePackagesTests')]
public function testResolvePackages(array $packages, array $expectedRequests, array $expectedResolvedPackages)
{
$responses = [];
foreach ($expectedRequests as $expectedRequest) {
$responses[] = function ($method, $url) use ($expectedRequest) {
... | return new MockResponse($body);
};
}
$httpClient = new MockHttpClient($responses);
$provider = new JsDelivrEsmResolver($httpClient);
$actualResolvedPackages = $provider->resolvePackages($packages);
| equest['response']['body'])) {
$body = \is_array($expectedRequest['response']['body']) ? json_encode($expectedRequest['response']['body']) : $expectedRequest['response']['body'];
}
| {
"filepath": "src/Symfony/Component/AssetMapper/Tests/ImportMap/Resolver/JsDelivrEsmResolverTest.php",
"language": "php",
"file_size": 31144,
"cut_index": 1331,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\Tests\Command;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\AssetMapper\Event\PreAssetsCompileEvent;
use Symfony\Component\AssetMapper\Tests\Fixtures\AssetMapperTestAppKernel;
use ... | id
{
$this->filesystem = new Filesystem();
$this->kernel = new AssetMapperTestAppKernel('test', true);
$this->filesystem->mkdir($this->kernel->getProjectDir().'/public');
}
protected function tearDown(): void
{
| system\Filesystem;
use Symfony\Component\Finder\Finder;
class AssetMapperCompileCommandTest extends TestCase
{
private AssetMapperTestAppKernel $kernel;
private Filesystem $filesystem;
protected function setUp(): vo | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/Command/AssetMapperCompileCommandTest.php",
"language": "php",
"file_size": 5300,
"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\AssetMapper\Tests\Command;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\AssetMapper\Tests\... | ]);
$this->assertSame(0, $res);
$this->assertStringContainsString('dir1', $tester->getDisplay());
$this->assertStringContainsString('subdir/file6.js', $tester->getDisplay());
$this->assertStringContainsString('dir2'.\DIRECT | {
$application = new Application(new AssetMapperTestAppKernel('test', true));
$command = $application->find('debug:asset-map');
$tester = new CommandTester($command);
$res = $tester->execute([ | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/Command/DebugAssetsMapperCommandTest.php",
"language": "php",
"file_size": 3539,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\Tests\Command;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\AssetMapper\Command\ImportMapRequireCommand;
use ... | er;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
class ImportMapRequireCommandTest extends KernelTestCase
{
protected static function getKernelClass(): string
{
return ImportMapTestAppKernel::class;
| ponent\AssetMapper\ImportMap\ImportMapVersionChecker;
use Symfony\Component\AssetMapper\Tests\Fixtures\ImportMapTestAppKernel;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\CommandTest | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/Command/ImportMapRequireCommandTest.php",
"language": "php",
"file_size": 9043,
"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\OptionsResolver;
use Symfony\Component\OptionsResolver\Exception\AccessException;
final class OptionConfigurator
{
public function __construct(
... |
return $this;
}
/**
* Sets allowed values for this option.
*
* @param mixed ...$values One or more acceptable values/closures
*
* @return $this
*
* @throws AccessException If called from a lazy option o | return $this
*
* @throws AccessException If called from a lazy option or normalizer
*/
public function allowedTypes(string ...$types): static
{
$this->resolver->setAllowedTypes($this->name, $types); | {
"filepath": "src/Symfony/Component/OptionsResolver/OptionConfigurator.php",
"language": "php",
"file_size": 3889,
"cut_index": 614,
"middle_length": 229
} |
efined options.
*/
private array $defined = [];
/**
* The default option values.
*/
private array $defaults = [];
/**
* A list of closure for nested options.
*
* @var \Closure[][]
*/
private array $nested = [];
/**
* The names of required options.
... | private array $allowedTypes = [];
/**
* A list of info messages for each option.
*/
private array $info = [];
/**
* A list of closures for evaluating lazy options.
*/
private array $lazy = [];
/**
* A list | osure[][]
*/
private array $normalizers = [];
/**
* A list of accepted values for each option.
*/
private array $allowedValues = [];
/**
* A list of accepted types for each option.
*/
| {
"filepath": "src/Symfony/Component/OptionsResolver/OptionsResolver.php",
"language": "php",
"file_size": 47281,
"cut_index": 2151,
"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\OptionsResolver\Exception;
/**
* Thrown when trying to read an ... | {@link UndefinedOptionsException}, this is a runtime exception that can
* occur when evaluating lazy options.
*
* @author Tobias Schultze <http://tobion.de>
*/
class NoSuchOptionException extends \OutOfBoundsException implements ExceptionInterface
{
}
| isset($options['optional'])`.
* In contrast to the | {
"filepath": "src/Symfony/Component/OptionsResolver/Exception/NoSuchOptionException.php",
"language": "php",
"file_size": 831,
"cut_index": 523,
"middle_length": 52
} |
();
}
public function testSetDefaultReturnsThis()
{
$this->assertSame($this->resolver, $this->resolver->setDefault('foo', 'bar'));
}
public function testSetDefault()
{
$this->resolver->setDefault('one', '1');
$this->resolver->setDefault('two', '20');
$this->ass... | public function testHasDefault()
{
$this->assertFalse($this->resolver->hasDefault('foo'));
$this->resolver->setDefault('foo', 42);
$this->assertTrue($this->resolver->hasDefault('foo'));
}
public function testHasDefaultW | pectException(AccessException::class);
$this->resolver->setDefault('lazy', static function (Options $options) {
$options->setDefault('default', 42);
});
$this->resolver->resolve();
}
| {
"filepath": "src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php",
"language": "php",
"file_size": 104163,
"cut_index": 3790,
"middle_length": 229
} |
ony\Component\OptionsResolver\Exception\NoConfigurationException;
use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class OptionsResolverIntrospectorTest extends TestCase
{
public function... | ptionsResolverIntrospector($resolver);
$this->assertNull($debug->getDefault($option));
}
public function testGetDefaultThrowsOnNoConfiguredValue()
{
$this->expectException(NoConfigurationException::class);
$this->expect | $this->assertSame('bar', $debug->getDefault($option));
}
public function testGetDefaultNull()
{
$resolver = new OptionsResolver();
$resolver->setDefault($option = 'foo', null);
$debug = new O | {
"filepath": "src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php",
"language": "php",
"file_size": 10177,
"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\OptionsResolver\Debug;
use Symfony\Component\OptionsResolver\Exception\NoConfigurationException;
use Symfony\Component\OptionsResolver\Exception\UndefinedO... | if (!$this->isDefined($option)) {
throw new UndefinedOptionsException(\sprintf('The option "%s" does not exist.', $option));
}
if (!\array_key_exists($option, $this->{$property})) {
throw new |
private \Closure $get;
public function __construct(OptionsResolver $optionsResolver)
{
$this->get = \Closure::bind(function ($property, $option, $message) {
/** @var OptionsResolver $this */
| {
"filepath": "src/Symfony/Component/OptionsResolver/Debug/OptionsResolverIntrospector.php",
"language": "php",
"file_size": 3513,
"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\Stopwatch;
/**
* Stopwatch section.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class Section
{
/**
* @var StopwatchEvent[]
*/
... | ion __construct(
private ?float $origin = null,
private bool $morePrecision = false,
) {
}
/**
* Returns the child section.
*/
public function get(string $id): ?self
{
foreach ($this->children as $chil | e origin of the events in this section, use null to set their origin to their start time
* @param bool $morePrecision If true, time is stored as float to keep the original microsecond precision
*/
public funct | {
"filepath": "src/Symfony/Component/Stopwatch/Section.php",
"language": "php",
"file_size": 3666,
"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\Stopwatch;
use Symfony\Contracts\Service\ResetInterface;
// Help opcache.preload discover always-needed symbols
class_exists(Section::class);
/**
* Stop... | ond precision
*/
public function __construct(
private bool $morePrecision = false,
) {
$this->reset();
}
/**
* @return Section[]
*/
public function getSections(): array
{
return $this->section | ar Section[]
*/
private array $sections;
/**
* @var Section[]
*/
private array $activeSections;
/**
* @param bool $morePrecision If true, time is stored as float to keep the original microsec | {
"filepath": "src/Symfony/Component/Stopwatch/Stopwatch.php",
"language": "php",
"file_size": 4090,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Stopwatch;
/**
* Represents an Event managed by Stopwatch.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class StopwatchEvent
{
/**
* @var StopwatchPeriod[]
*/
private array $periods = [];
private float $origin;
private... | g|null $name The event name or null to define the name as default
*/
public function __construct(
float $origin,
?string $category = null,
private bool $morePrecision = false,
?string $name = null,
) {
| conds
* @param string|null $category The event category or null to use the default
* @param bool $morePrecision If true, time is stored as float to keep the original microsecond precision
* @param strin | {
"filepath": "src/Symfony/Component/Stopwatch/StopwatchEvent.php",
"language": "php",
"file_size": 5464,
"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\Stopwatch;
/**
* Represents a Period for an Event.
*
* @author Fabien Poten... | o keep the original microsecond precision
*/
public function __construct(int|float $start, int|float $end, bool $morePrecision = false)
{
$this->start = $morePrecision ? (float) $start : (int) $start;
$this->end = $morePrecisio | ative time of the start of the period (in milliseconds)
* @param int|float $end The relative time of the end of the period (in milliseconds)
* @param bool $morePrecision If true, time is stored as float t | {
"filepath": "src/Symfony/Component/Stopwatch/StopwatchPeriod.php",
"language": "php",
"file_size": 1924,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Stopwatch\Tests;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Stopwatch\StopwatchEvent;
/**
* StopwatchEventTest.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
#[Group('time-sensitive')]
class Sto... | ime(true) * 1000, 'cat');
$this->assertEquals('cat', $event->getCategory());
}
public function testGetPeriods()
{
$event = new StopwatchEvent(microtime(true) * 1000);
$this->assertEquals([], $event->getPeriods());
| Origin());
}
public function testGetCategory()
{
$event = new StopwatchEvent(microtime(true) * 1000);
$this->assertEquals('default', $event->getCategory());
$event = new StopwatchEvent(microt | {
"filepath": "src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php",
"language": "php",
"file_size": 6796,
"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\Stopwatch\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Fr... | public function testGetEndTime($end, $useMorePrecision, $expected)
{
$period = new StopwatchPeriod($end, $end, $useMorePrecision);
$this->assertSame($expected, $period->getEndTime());
}
#[DataProvider('provideDurationValues' | start, $useMorePrecision, $expected)
{
$period = new StopwatchPeriod($start, $start, $useMorePrecision);
$this->assertSame($expected, $period->getStartTime());
}
#[DataProvider('provideTimeValues')]
| {
"filepath": "src/Symfony/Component/Stopwatch/Tests/StopwatchPeriodTest.php",
"language": "php",
"file_size": 1935,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Stopwatch\Tests;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Stopwatch\Section;
use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\Stopwatch\StopwatchEvent;
/**
* StopwatchTest.
*
* @author... | t, $stopwatch->getEvent('foo'));
}
public function testStartWithoutCategory()
{
$stopwatch = new Stopwatch();
$stopwatchEvent = $stopwatch->start('bar');
$this->assertSame('default', $stopwatchEvent->getCategory());
| atch = new Stopwatch();
$event = $stopwatch->start('foo', 'cat');
$this->assertInstanceOf(StopwatchEvent::class, $event);
$this->assertEquals('cat', $event->getCategory());
$this->assertSame($even | {
"filepath": "src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php",
"language": "php",
"file_size": 5284,
"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\HtmlSanitizer;
use Symfony\Component\HtmlSanitizer\Parser\NativeParser;
use Symfony\Component\HtmlSanitizer\Parser\ParserInterface;
use Symfony\Component\H... | blic function __construct(
private HtmlSanitizerConfig $config,
?ParserInterface $parser = null,
) {
$this->parser = $parser ?? new NativeParser();
}
public function sanitize(string $input): string
{
return | <galopintitouan@gmail.com>
*/
final class HtmlSanitizer implements HtmlSanitizerInterface
{
private ParserInterface $parser;
/**
* @var array<string, DomVisitor>
*/
private array $domVisitors = [];
pu | {
"filepath": "src/Symfony/Component/HtmlSanitizer/HtmlSanitizer.php",
"language": "php",
"file_size": 5040,
"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\AssetMapper\Command;
use Symfony\Component\AssetMapper\ImportMap\RemotePackageDownloader;
use Symfony\Co... | Scheiber <contact@jmsche.fr>
*/
#[AsCommand(name: 'importmap:install', description: 'Download all assets that should be downloaded')]
final class ImportMapInstallCommand extends Command
{
public function __construct(
private readonly RemotePac | mfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* Downloads all assets that should be downloaded.
*
* @author Jonathan | {
"filepath": "src/Symfony/Component/AssetMapper/Command/ImportMapInstallCommand.php",
"language": "php",
"file_size": 2583,
"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\AssetMapper\Command;
use Symfony\Component\AssetMapper\ImportMap\ImportMapManager;
use Symfony\Component... | inal class ImportMapRemoveCommand extends Command
{
public function __construct(
protected readonly ImportMapManager $importMapManager,
) {
parent::__construct();
}
protected function configure(): void
{
$this
| Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
/**
* @author Kévin Dunglas <kevin@dunglas.dev>
*/
#[AsCommand(name: 'importmap:remove', description: 'Remove JavaScript packages')]
f | {
"filepath": "src/Symfony/Component/AssetMapper/Command/ImportMapRemoveCommand.php",
"language": "php",
"file_size": 2107,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\Command;
use Symfony\Component\AssetMapper\ImportMap\ImportMapEntries;
use Symfony\Component\AssetMapper\ImportMap\ImportMapEntry;
use Symfony\Component\AssetMapper\ImportMap\ImportMapManager;
use Symfony\Component\AssetMapper\ImportMap\ImportMa... | le\SymfonyStyle;
use Symfony\Component\Filesystem\Path;
/**
* @author Kévin Dunglas <kevin@dunglas.dev>
*/
#[AsCommand(name: 'importmap:require', description: 'Require JavaScript packages')]
final class ImportMapRequireCommand extends Command
{
use | y\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Sty | {
"filepath": "src/Symfony/Component/AssetMapper/Command/ImportMapRequireCommand.php",
"language": "php",
"file_size": 6492,
"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\AssetMapper\Command;
use Symfony\Component\AssetMapper\ImportMap\... | n) {
$output->writeln(\sprintf('[warning] <info>%s</info> requires <info>%s</info> but it is not in the importmap.php. You may need to run "php bin/console importmap:require %s".', $problem->packageName, $problem->dependencyPackageName, $pr | ionChecker $importMapVersionChecker, OutputInterface $output): void
{
$problems = $importMapVersionChecker->checkVersions();
foreach ($problems as $problem) {
if (null === $problem->installedVersio | {
"filepath": "src/Symfony/Component/AssetMapper/Command/VersionProblemCommandTrait.php",
"language": "php",
"file_size": 1386,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\AssetMapper\AssetMapperRepository;
use Symfony\Component\Finder\Glob;
class AssetMapperRepositoryTest extends TestCase
{
public function testFindWithAbsolutePaths()
{
... | bdir/file5.js'), $repository->find('subdir/file5.js'));
$this->assertNull($repository->find('file5.css'));
}
public function testFindWithRelativePaths()
{
$repository = new AssetMapperRepository([
'dir1' => '',
| __.'/Fixtures/dir1/file1.css'), $repository->find('file1.css'));
$this->assertSame(realpath(__DIR__.'/Fixtures/dir2/file4.js'), $repository->find('file4.js'));
$this->assertSame(realpath(__DIR__.'/Fixtures/dir2/su | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/AssetMapperRepositoryTest.php",
"language": "php",
"file_size": 7345,
"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\AssetMapper\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\AssetMapper\CompiledAssetMapper... | piled_asset_mapper_config_reader')) {
$this->filesystem->mkdir($this->writableRoot);
}
// realpath to help path comparisons in the tests
$this->writableRoot = realpath($this->writableRoot);
}
protected function | protected function setUp(): void
{
$this->filesystem = new Filesystem();
$this->writableRoot = __DIR__.'/../Fixtures/compiled_asset_mapper_config_reader';
if (!file_exists(__DIR__.'/../Fixtures/com | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/CompiledAssetMapperConfigReaderTest.php",
"language": "php",
"file_size": 2509,
"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\AssetMapper\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Co... | estAppKernel('test', true);
$this->kernel->boot();
}
protected function tearDown(): void
{
$this->filesystem->remove($this->kernel->getProjectDir().'/var');
}
public function testDefaultAssetPackageIsDecorated()
{
| tends TestCase
{
private AssetMapperTestAppKernel $kernel;
private Filesystem $filesystem;
protected function setUp(): void
{
$this->filesystem = new Filesystem();
$this->kernel = new AssetMapperT | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/MapperAwareAssetPackageIntegrationTest.php",
"language": "php",
"file_size": 1322,
"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\AssetMapper\Tests\Fixtures;
use Psr\Log\NullLogger;
use Symfony\Bundle\Framewo... | getProjectDir(): string
{
return __DIR__;
}
public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load(static function (ContainerBuilder $container) {
$container->loadFromExte | Symfony\Component\HttpKernel\Kernel;
class AssetMapperTestAppKernel extends Kernel
{
public function registerBundles(): iterable
{
return [
new FrameworkBundle(),
];
}
public function | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/Fixtures/AssetMapperTestAppKernel.php",
"language": "php",
"file_size": 1593,
"cut_index": 537,
"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.
*/
return [
'@hotwired/stimulus' => [
'version' => '3.2.1',
],
'lod... | ath' => 'namespaced_assets2/app2.js',
],
'app.css' => [
'path' => 'namespaced_assets2/styles/app.css',
'type' => 'css',
],
'app2.css' => [
'path' => 'namespaced_assets2/styles/app2.css',
'type' => 'css',
| est
'p | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/Fixtures/importmaps/importmap.php",
"language": "php",
"file_size": 790,
"cut_index": 514,
"middle_length": 14
} |
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\AssetMapper\Tests\Compressor;
use PHPUnit\Framework\TestCase;
use Symfony\Comp... | .'/../Fixtures/chain_compressor_filesystem';
private Filesystem $filesystem;
protected function setUp(): void
{
$this->filesystem = new Filesystem();
if (!file_exists(self::WRITABLE_ROOT)) {
$this->filesystem->mkdi | AssetMapper\Compressor\ZstandardCompressor;
use Symfony\Component\Filesystem\Filesystem;
/**
* @author Kévin Dunglas <kevin@dunglas.dev>
*/
class ChainCompressorTest extends TestCase
{
private const WRITABLE_ROOT = __DIR__ | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/Compressor/ChainCompressorTest.php",
"language": "php",
"file_size": 2018,
"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\AssetMapper\Tests\Compressor;
use PHPUnit\Framework\TestCase;
use... | (new ZstandardCompressor())->getUnsupportedReason()) {
$this->markTestSkipped($reason);
}
$this->filesystem = new Filesystem();
if (!file_exists(self::WRITABLE_ROOT)) {
$this->filesystem->mkdir(self::WRITABL | extends TestCase
{
private const WRITABLE_ROOT = __DIR__.'/../Fixtures/zstandard_compressor_filesystem';
private ?Filesystem $filesystem = null;
protected function setUp(): void
{
if (null !== $reason = | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/Compressor/ZstandardCompressorTest.php",
"language": "php",
"file_size": 1433,
"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\AssetMapper\Tests\Path;
use PHPUnit\Framework\TestCase;
use Symfo... | ar'));
$this->assertSame('/assets-prefix/foo/bar', $resolver->resolvePublicPath('foo/bar'));
$resolver = new PublicAssetsPathResolver(
'assets-prefix', // The leading and trailing slash should be added automatically
);
| ssetsPathResolver(
'/assets-prefix/',
);
$this->assertSame('/assets-prefix/', $resolver->resolvePublicPath(''));
$this->assertSame('/assets-prefix/foo/bar', $resolver->resolvePublicPath('/foo/b | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/Path/PublicAssetsPathResolverTest.php",
"language": "php",
"file_size": 1286,
"cut_index": 524,
"middle_length": 229
} |
ule_in_importmap_local_asset', ImportMapType::JS, 'module_in_importmap_local_asset.js', false),
'module_in_importmap_remote' => ImportMapEntry::createRemote('module_in_importmap_remote', ImportMapType::JS, './vendor/module_in_importmap_remote.js', '1.2.3', 'could_be_anything', false),
... | th) {
'./vendor/module_in_importmap_remote.js' => '/project/assets/vendor/module_in_importmap_remote.js',
'/project/assets/vendor/@popperjs/core.js' => '/project/assets/vendor/@popperjs/core.js',
| default => null,
};
});
$importMapConfigReader
->method('convertPathToFilesystemPath')
->willReturnCallback(static function ($path) {
return match ($pa | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/Compiler/JavaScriptImportPathCompilerTest.php",
"language": "php",
"file_size": 39398,
"cut_index": 2151,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\Tests\Compiler\Parser;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\AssetMapper\Compiler\Parser\JavascriptSequenceParser;
class JavascriptSequenceParserTest extends TestCase
{
public f... | parseUntil(1);
}
public function testItThrowWhenBackward()
{
$parser = new JavascriptSequenceParser(' ');
$parser->parseUntil(2);
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessag | ounds()
{
$parser = new JavascriptSequenceParser('');
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Cannot parse beyond the end of the content.');
$parser-> | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/Compiler/Parser/JavascriptSequenceParserTest.php",
"language": "php",
"file_size": 5527,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\Tests\Factory;
use PHPUnit\Framework\TestCase;
use Symfony\Component\AssetMapper\Factory\CachedMappedAssetFactory;
use Symfony\Component\AssetMapper\Factory\MappedAssetFactoryInterface;
use Symfony\Component\AssetMapper\ImportMap\JavaScriptImpor... | heDir = __DIR__.'/../Fixtures/var/cache_for_mapped_asset_factory_test';
protected function setUp(): void
{
$this->filesystem = new Filesystem();
$this->filesystem->mkdir($this->cacheDir);
}
protected function tearDown(): v | xistenceResource;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Filesystem\Filesystem;
class CachedMappedAssetFactoryTest extends TestCase
{
private Filesystem $filesystem;
private string $cac | {
"filepath": "src/Symfony/Component/AssetMapper/Tests/Factory/CachedMappedAssetFactoryTest.php",
"language": "php",
"file_size": 6262,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\AssetMapper\Command;
use Symfony\Component\AssetMapper\AssetMapperInterface;
use Symfony\Component\AssetMapper\AssetMapperRepository;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Con... | class DebugAssetMapperCommand extends Command
{
private bool $didShortenPaths = false;
public function __construct(
private readonly AssetMapperInterface $assetMapper,
private readonly AssetMapperRepository $assetMapperRepository, | \Component\Console\Style\SymfonyStyle;
/**
* Outputs all the assets in the asset mapper.
*
* @author Ryan Weaver <ryan@symfonycasts.com>
*/
#[AsCommand(name: 'debug:asset-map', description: 'Output all mapped assets')]
final | {
"filepath": "src/Symfony/Component/AssetMapper/Command/DebugAssetMapperCommand.php",
"language": "php",
"file_size": 6468,
"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\AssetMapper\Command;
use Symfony\Component\AssetMapper\ImportMap\ImportMapUpdateChecker;
use Symfony\Component\AssetMapper\ImportMap\PackageUpdateInfo;
use... | ;
use Symfony\Component\Console\Style\SymfonyStyle;
#[AsCommand(name: 'importmap:outdated', description: 'List outdated JavaScript packages and their latest versions')]
final class ImportMapOutdatedCommand extends Command
{
private const COLOR_MAPPING | n\CompletionSuggestions;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface | {
"filepath": "src/Symfony/Component/AssetMapper/Command/ImportMapOutdatedCommand.php",
"language": "php",
"file_size": 4977,
"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\AssetMapper\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\AssetMapper\AssetMapperCompiler... | return 'css' === $asset->publicExtension;
}
public function compile(string $content, MappedAsset $asset, AssetMapperInterface $assetMapper): string
{
return 'should_not_be_called';
}
| mpilerTest extends TestCase
{
public function testCompile()
{
$compiler1 = new class implements AssetCompilerInterface {
public function supports(MappedAsset $asset): bool
{
| {
"filepath": "src/Symfony/Component/AssetMapper/Tests/AssetMapperCompilerTest.php",
"language": "php",
"file_size": 2347,
"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.