mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°7059 - Symfony 6.4 - Application skeleton (#587)
Mise en place d'un squelette temporaire fonctionnel d'application Symfony. - Ajout bundles debug & runtime pour une implémentation standard - Configuration minimale - .env file in specific directory - Frontal application app.php
This commit is contained in:
31
lib/autoload_runtime.php
Normal file
31
lib/autoload_runtime.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
// autoload_runtime.php @generated by Symfony Runtime
|
||||
|
||||
if (true === (require_once __DIR__.'/autoload.php') || empty($_SERVER['SCRIPT_FILENAME'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$app = require $_SERVER['SCRIPT_FILENAME'];
|
||||
|
||||
if (!is_object($app)) {
|
||||
throw new TypeError(sprintf('Invalid return value: callable object expected, "%s" returned from "%s".', get_debug_type($app), $_SERVER['SCRIPT_FILENAME']));
|
||||
}
|
||||
|
||||
$runtime = $_SERVER['APP_RUNTIME'] ?? $_ENV['APP_RUNTIME'] ?? 'Symfony\\Component\\Runtime\\SymfonyRuntime';
|
||||
$runtime = new $runtime(($_SERVER['APP_RUNTIME_OPTIONS'] ?? $_ENV['APP_RUNTIME_OPTIONS'] ?? []) + [
|
||||
'dotenv_path' => 'symfony/.env',
|
||||
'project_dir' => dirname(__DIR__, 1),
|
||||
]);
|
||||
|
||||
[$app, $args] = $runtime
|
||||
->getResolver($app)
|
||||
->resolve();
|
||||
|
||||
$app = $app(...$args);
|
||||
|
||||
exit(
|
||||
$runtime
|
||||
->getRunner($app)
|
||||
->run()
|
||||
);
|
||||
@@ -20,6 +20,7 @@ return array(
|
||||
'ActionNotification' => $baseDir . '/core/action.class.inc.php',
|
||||
'AjaxPage' => $baseDir . '/sources/Application/WebPage/AjaxPage.php',
|
||||
'ApcService' => $baseDir . '/core/apc-service.class.inc.php',
|
||||
'App\\Kernel' => $baseDir . '/sources/Kernel.php',
|
||||
'ApplicationContext' => $baseDir . '/application/applicationcontext.class.inc.php',
|
||||
'ApplicationException' => $baseDir . '/application/exceptions/ApplicationException.php',
|
||||
'ApplicationMenu' => $baseDir . '/application/menunode.class.inc.php',
|
||||
@@ -369,6 +370,7 @@ return array(
|
||||
'Combodo\\iTop\\Application\\UI\\Preferences\\BlockShortcuts\\BlockShortcuts' => $baseDir . '/sources/Application/UI/Preferences/BlockShortcuts/BlockShortcuts.php',
|
||||
'Combodo\\iTop\\Application\\UI\\Printable\\BlockPrintHeader\\BlockPrintHeader' => $baseDir . '/sources/Application/UI/Printable/BlockPrintHeader/BlockPrintHeader.php',
|
||||
'Combodo\\iTop\\Composer\\iTopComposer' => $baseDir . '/sources/Composer/iTopComposer.php',
|
||||
'Combodo\\iTop\\Controller\\AbstractAppController' => $baseDir . '/sources/Controller/AbstractAppController.php',
|
||||
'Combodo\\iTop\\Controller\\AbstractController' => $baseDir . '/sources/Controller/AbstractController.php',
|
||||
'Combodo\\iTop\\Controller\\AjaxRenderController' => $baseDir . '/sources/Controller/AjaxRenderController.php',
|
||||
'Combodo\\iTop\\Controller\\Base\\Layout\\ActivityPanelController' => $baseDir . '/sources/Controller/Base/Layout/ActivityPanelController.php',
|
||||
@@ -471,6 +473,7 @@ return array(
|
||||
'Combodo\\iTop\\Service\\Router\\Exception\\RouteNotFoundException' => $baseDir . '/sources/Service/Router/Exception/RouteNotFoundException.php',
|
||||
'Combodo\\iTop\\Service\\Router\\Exception\\RouterException' => $baseDir . '/sources/Service/Router/Exception/RouterException.php',
|
||||
'Combodo\\iTop\\Service\\Router\\Router' => $baseDir . '/sources/Service/Router/Router.php',
|
||||
'Combodo\\iTop\\Service\\SummaryCard\\SummaryCardService' => $baseDir . '/sources/Service/SummaryCard/SummaryCardService.php',
|
||||
'Combodo\\iTop\\Service\\TemporaryObjects\\TemporaryObjectConfig' => $baseDir . '/sources/Service/TemporaryObjects/TemporaryObjectConfig.php',
|
||||
'Combodo\\iTop\\Service\\TemporaryObjects\\TemporaryObjectGC' => $baseDir . '/sources/Service/TemporaryObjects/TemporaryObjectGC.php',
|
||||
'Combodo\\iTop\\Service\\TemporaryObjects\\TemporaryObjectHelper' => $baseDir . '/sources/Service/TemporaryObjects/TemporaryObjectHelper.php',
|
||||
@@ -1592,7 +1595,6 @@ return array(
|
||||
'StimulusUserAction' => $baseDir . '/core/stimulus.class.inc.php',
|
||||
'Str' => $baseDir . '/core/MyHelpers.class.inc.php',
|
||||
'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
|
||||
'SummaryCardService' => $baseDir . '/sources/Service/SummaryCard/SummaryCardService.php',
|
||||
'Symfony\\Bridge\\Twig\\AppVariable' => $vendorDir . '/symfony/twig-bridge/AppVariable.php',
|
||||
'Symfony\\Bridge\\Twig\\Attribute\\Template' => $vendorDir . '/symfony/twig-bridge/Attribute/Template.php',
|
||||
'Symfony\\Bridge\\Twig\\Command\\DebugCommand' => $vendorDir . '/symfony/twig-bridge/Command/DebugCommand.php',
|
||||
@@ -1646,6 +1648,11 @@ return array(
|
||||
'Symfony\\Bridge\\Twig\\TokenParser\\TransTokenParser' => $vendorDir . '/symfony/twig-bridge/TokenParser/TransTokenParser.php',
|
||||
'Symfony\\Bridge\\Twig\\Translation\\TwigExtractor' => $vendorDir . '/symfony/twig-bridge/Translation/TwigExtractor.php',
|
||||
'Symfony\\Bridge\\Twig\\UndefinedCallableHandler' => $vendorDir . '/symfony/twig-bridge/UndefinedCallableHandler.php',
|
||||
'Symfony\\Bundle\\DebugBundle\\Command\\ServerDumpPlaceholderCommand' => $vendorDir . '/symfony/debug-bundle/Command/ServerDumpPlaceholderCommand.php',
|
||||
'Symfony\\Bundle\\DebugBundle\\DebugBundle' => $vendorDir . '/symfony/debug-bundle/DebugBundle.php',
|
||||
'Symfony\\Bundle\\DebugBundle\\DependencyInjection\\Compiler\\DumpDataCollectorPass' => $vendorDir . '/symfony/debug-bundle/DependencyInjection/Compiler/DumpDataCollectorPass.php',
|
||||
'Symfony\\Bundle\\DebugBundle\\DependencyInjection\\Configuration' => $vendorDir . '/symfony/debug-bundle/DependencyInjection/Configuration.php',
|
||||
'Symfony\\Bundle\\DebugBundle\\DependencyInjection\\DebugExtension' => $vendorDir . '/symfony/debug-bundle/DependencyInjection/DebugExtension.php',
|
||||
'Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\AbstractPhpFileCacheWarmer' => $vendorDir . '/symfony/framework-bundle/CacheWarmer/AbstractPhpFileCacheWarmer.php',
|
||||
'Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\AnnotationsCacheWarmer' => $vendorDir . '/symfony/framework-bundle/CacheWarmer/AnnotationsCacheWarmer.php',
|
||||
'Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\CachePoolClearerCacheWarmer' => $vendorDir . '/symfony/framework-bundle/CacheWarmer/CachePoolClearerCacheWarmer.php',
|
||||
@@ -2655,6 +2662,21 @@ return array(
|
||||
'Symfony\\Component\\Routing\\RouteCompilerInterface' => $vendorDir . '/symfony/routing/RouteCompilerInterface.php',
|
||||
'Symfony\\Component\\Routing\\Router' => $vendorDir . '/symfony/routing/Router.php',
|
||||
'Symfony\\Component\\Routing\\RouterInterface' => $vendorDir . '/symfony/routing/RouterInterface.php',
|
||||
'Symfony\\Component\\Runtime\\GenericRuntime' => $vendorDir . '/symfony/runtime/GenericRuntime.php',
|
||||
'Symfony\\Component\\Runtime\\Internal\\BasicErrorHandler' => $vendorDir . '/symfony/runtime/Internal/BasicErrorHandler.php',
|
||||
'Symfony\\Component\\Runtime\\Internal\\ComposerPlugin' => $vendorDir . '/symfony/runtime/Internal/ComposerPlugin.php',
|
||||
'Symfony\\Component\\Runtime\\Internal\\MissingDotenv' => $vendorDir . '/symfony/runtime/Internal/MissingDotenv.php',
|
||||
'Symfony\\Component\\Runtime\\Internal\\SymfonyErrorHandler' => $vendorDir . '/symfony/runtime/Internal/SymfonyErrorHandler.php',
|
||||
'Symfony\\Component\\Runtime\\ResolverInterface' => $vendorDir . '/symfony/runtime/ResolverInterface.php',
|
||||
'Symfony\\Component\\Runtime\\Resolver\\ClosureResolver' => $vendorDir . '/symfony/runtime/Resolver/ClosureResolver.php',
|
||||
'Symfony\\Component\\Runtime\\Resolver\\DebugClosureResolver' => $vendorDir . '/symfony/runtime/Resolver/DebugClosureResolver.php',
|
||||
'Symfony\\Component\\Runtime\\RunnerInterface' => $vendorDir . '/symfony/runtime/RunnerInterface.php',
|
||||
'Symfony\\Component\\Runtime\\Runner\\ClosureRunner' => $vendorDir . '/symfony/runtime/Runner/ClosureRunner.php',
|
||||
'Symfony\\Component\\Runtime\\Runner\\Symfony\\ConsoleApplicationRunner' => $vendorDir . '/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php',
|
||||
'Symfony\\Component\\Runtime\\Runner\\Symfony\\HttpKernelRunner' => $vendorDir . '/symfony/runtime/Runner/Symfony/HttpKernelRunner.php',
|
||||
'Symfony\\Component\\Runtime\\Runner\\Symfony\\ResponseRunner' => $vendorDir . '/symfony/runtime/Runner/Symfony/ResponseRunner.php',
|
||||
'Symfony\\Component\\Runtime\\RuntimeInterface' => $vendorDir . '/symfony/runtime/RuntimeInterface.php',
|
||||
'Symfony\\Component\\Runtime\\SymfonyRuntime' => $vendorDir . '/symfony/runtime/SymfonyRuntime.php',
|
||||
'Symfony\\Component\\Stopwatch\\Section' => $vendorDir . '/symfony/stopwatch/Section.php',
|
||||
'Symfony\\Component\\Stopwatch\\Stopwatch' => $vendorDir . '/symfony/stopwatch/Stopwatch.php',
|
||||
'Symfony\\Component\\Stopwatch\\StopwatchEvent' => $vendorDir . '/symfony/stopwatch/StopwatchEvent.php',
|
||||
@@ -2799,6 +2821,13 @@ return array(
|
||||
'Symfony\\Polyfill\\Php80\\Php80' => $vendorDir . '/symfony/polyfill-php80/Php80.php',
|
||||
'Symfony\\Polyfill\\Php80\\PhpToken' => $vendorDir . '/symfony/polyfill-php80/PhpToken.php',
|
||||
'Symfony\\Polyfill\\Php83\\Php83' => $vendorDir . '/symfony/polyfill-php83/Php83.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\Console\\ApplicationRuntime' => $vendorDir . '/symfony/runtime/Internal/Console/ApplicationRuntime.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\Console\\Command\\CommandRuntime' => $vendorDir . '/symfony/runtime/Internal/Console/Command/CommandRuntime.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\Console\\Input\\InputInterfaceRuntime' => $vendorDir . '/symfony/runtime/Internal/Console/Input/InputInterfaceRuntime.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\Console\\Output\\OutputInterfaceRuntime' => $vendorDir . '/symfony/runtime/Internal/Console/Output/OutputInterfaceRuntime.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\HttpFoundation\\RequestRuntime' => $vendorDir . '/symfony/runtime/Internal/HttpFoundation/RequestRuntime.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\HttpFoundation\\ResponseRuntime' => $vendorDir . '/symfony/runtime/Internal/HttpFoundation/ResponseRuntime.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\HttpKernel\\HttpKernelInterfaceRuntime' => $vendorDir . '/symfony/runtime/Internal/HttpKernel/HttpKernelInterfaceRuntime.php',
|
||||
'SynchroExceptionNotStarted' => $baseDir . '/application/exceptions/SynchroExceptionNotStarted.php',
|
||||
'System' => $vendorDir . '/pear/pear-core-minimal/src/System.php',
|
||||
'TCPDF' => $vendorDir . '/combodo/tcpdf/tcpdf.php',
|
||||
|
||||
@@ -9,6 +9,7 @@ return array(
|
||||
'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
|
||||
'Twig\\' => array($vendorDir . '/twig/twig/src'),
|
||||
'TheNetworg\\OAuth2\\Client\\' => array($vendorDir . '/thenetworg/oauth2-azure/src'),
|
||||
'Symfony\\Runtime\\Symfony\\Component\\' => array($vendorDir . '/symfony/runtime/Internal'),
|
||||
'Symfony\\Polyfill\\Php83\\' => array($vendorDir . '/symfony/polyfill-php83'),
|
||||
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
|
||||
'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'),
|
||||
@@ -26,6 +27,7 @@ return array(
|
||||
'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'),
|
||||
'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
|
||||
'Symfony\\Component\\Stopwatch\\' => array($vendorDir . '/symfony/stopwatch'),
|
||||
'Symfony\\Component\\Runtime\\' => array($vendorDir . '/symfony/runtime'),
|
||||
'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'),
|
||||
'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'),
|
||||
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
|
||||
@@ -42,6 +44,7 @@ return array(
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\' => array($vendorDir . '/symfony/web-profiler-bundle'),
|
||||
'Symfony\\Bundle\\TwigBundle\\' => array($vendorDir . '/symfony/twig-bundle'),
|
||||
'Symfony\\Bundle\\FrameworkBundle\\' => array($vendorDir . '/symfony/framework-bundle'),
|
||||
'Symfony\\Bundle\\DebugBundle\\' => array($vendorDir . '/symfony/debug-bundle'),
|
||||
'Symfony\\Bridge\\Twig\\' => array($vendorDir . '/symfony/twig-bridge'),
|
||||
'ScssPhp\\ScssPhp\\' => array($vendorDir . '/scssphp/scssphp/src'),
|
||||
'Sabberworm\\CSS\\' => array($vendorDir . '/sabberworm/php-css-parser/src'),
|
||||
|
||||
@@ -35,6 +35,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
),
|
||||
'S' =>
|
||||
array (
|
||||
'Symfony\\Runtime\\Symfony\\Component\\' => 34,
|
||||
'Symfony\\Polyfill\\Php83\\' => 23,
|
||||
'Symfony\\Polyfill\\Php80\\' => 23,
|
||||
'Symfony\\Polyfill\\Php72\\' => 23,
|
||||
@@ -52,6 +53,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Symfony\\Component\\VarDumper\\' => 28,
|
||||
'Symfony\\Component\\String\\' => 25,
|
||||
'Symfony\\Component\\Stopwatch\\' => 28,
|
||||
'Symfony\\Component\\Runtime\\' => 26,
|
||||
'Symfony\\Component\\Routing\\' => 26,
|
||||
'Symfony\\Component\\HttpKernel\\' => 29,
|
||||
'Symfony\\Component\\HttpFoundation\\' => 33,
|
||||
@@ -68,6 +70,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Symfony\\Bundle\\WebProfilerBundle\\' => 33,
|
||||
'Symfony\\Bundle\\TwigBundle\\' => 26,
|
||||
'Symfony\\Bundle\\FrameworkBundle\\' => 31,
|
||||
'Symfony\\Bundle\\DebugBundle\\' => 27,
|
||||
'Symfony\\Bridge\\Twig\\' => 20,
|
||||
'ScssPhp\\ScssPhp\\' => 16,
|
||||
'Sabberworm\\CSS\\' => 15,
|
||||
@@ -118,6 +121,10 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/thenetworg/oauth2-azure/src',
|
||||
),
|
||||
'Symfony\\Runtime\\Symfony\\Component\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/runtime/Internal',
|
||||
),
|
||||
'Symfony\\Polyfill\\Php83\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/polyfill-php83',
|
||||
@@ -186,6 +193,10 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/stopwatch',
|
||||
),
|
||||
'Symfony\\Component\\Runtime\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/runtime',
|
||||
),
|
||||
'Symfony\\Component\\Routing\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/routing',
|
||||
@@ -250,6 +261,10 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/framework-bundle',
|
||||
),
|
||||
'Symfony\\Bundle\\DebugBundle\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/debug-bundle',
|
||||
),
|
||||
'Symfony\\Bridge\\Twig\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/twig-bridge',
|
||||
@@ -378,6 +393,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'ActionNotification' => __DIR__ . '/../..' . '/core/action.class.inc.php',
|
||||
'AjaxPage' => __DIR__ . '/../..' . '/sources/Application/WebPage/AjaxPage.php',
|
||||
'ApcService' => __DIR__ . '/../..' . '/core/apc-service.class.inc.php',
|
||||
'App\\Kernel' => __DIR__ . '/../..' . '/sources/Kernel.php',
|
||||
'ApplicationContext' => __DIR__ . '/../..' . '/application/applicationcontext.class.inc.php',
|
||||
'ApplicationException' => __DIR__ . '/../..' . '/application/exceptions/ApplicationException.php',
|
||||
'ApplicationMenu' => __DIR__ . '/../..' . '/application/menunode.class.inc.php',
|
||||
@@ -727,6 +743,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Combodo\\iTop\\Application\\UI\\Preferences\\BlockShortcuts\\BlockShortcuts' => __DIR__ . '/../..' . '/sources/Application/UI/Preferences/BlockShortcuts/BlockShortcuts.php',
|
||||
'Combodo\\iTop\\Application\\UI\\Printable\\BlockPrintHeader\\BlockPrintHeader' => __DIR__ . '/../..' . '/sources/Application/UI/Printable/BlockPrintHeader/BlockPrintHeader.php',
|
||||
'Combodo\\iTop\\Composer\\iTopComposer' => __DIR__ . '/../..' . '/sources/Composer/iTopComposer.php',
|
||||
'Combodo\\iTop\\Controller\\AbstractAppController' => __DIR__ . '/../..' . '/sources/Controller/AbstractAppController.php',
|
||||
'Combodo\\iTop\\Controller\\AbstractController' => __DIR__ . '/../..' . '/sources/Controller/AbstractController.php',
|
||||
'Combodo\\iTop\\Controller\\AjaxRenderController' => __DIR__ . '/../..' . '/sources/Controller/AjaxRenderController.php',
|
||||
'Combodo\\iTop\\Controller\\Base\\Layout\\ActivityPanelController' => __DIR__ . '/../..' . '/sources/Controller/Base/Layout/ActivityPanelController.php',
|
||||
@@ -829,6 +846,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Combodo\\iTop\\Service\\Router\\Exception\\RouteNotFoundException' => __DIR__ . '/../..' . '/sources/Service/Router/Exception/RouteNotFoundException.php',
|
||||
'Combodo\\iTop\\Service\\Router\\Exception\\RouterException' => __DIR__ . '/../..' . '/sources/Service/Router/Exception/RouterException.php',
|
||||
'Combodo\\iTop\\Service\\Router\\Router' => __DIR__ . '/../..' . '/sources/Service/Router/Router.php',
|
||||
'Combodo\\iTop\\Service\\SummaryCard\\SummaryCardService' => __DIR__ . '/../..' . '/sources/Service/SummaryCard/SummaryCardService.php',
|
||||
'Combodo\\iTop\\Service\\TemporaryObjects\\TemporaryObjectConfig' => __DIR__ . '/../..' . '/sources/Service/TemporaryObjects/TemporaryObjectConfig.php',
|
||||
'Combodo\\iTop\\Service\\TemporaryObjects\\TemporaryObjectGC' => __DIR__ . '/../..' . '/sources/Service/TemporaryObjects/TemporaryObjectGC.php',
|
||||
'Combodo\\iTop\\Service\\TemporaryObjects\\TemporaryObjectHelper' => __DIR__ . '/../..' . '/sources/Service/TemporaryObjects/TemporaryObjectHelper.php',
|
||||
@@ -1950,7 +1968,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'StimulusUserAction' => __DIR__ . '/../..' . '/core/stimulus.class.inc.php',
|
||||
'Str' => __DIR__ . '/../..' . '/core/MyHelpers.class.inc.php',
|
||||
'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
|
||||
'SummaryCardService' => __DIR__ . '/../..' . '/sources/Service/SummaryCard/SummaryCardService.php',
|
||||
'Symfony\\Bridge\\Twig\\AppVariable' => __DIR__ . '/..' . '/symfony/twig-bridge/AppVariable.php',
|
||||
'Symfony\\Bridge\\Twig\\Attribute\\Template' => __DIR__ . '/..' . '/symfony/twig-bridge/Attribute/Template.php',
|
||||
'Symfony\\Bridge\\Twig\\Command\\DebugCommand' => __DIR__ . '/..' . '/symfony/twig-bridge/Command/DebugCommand.php',
|
||||
@@ -2004,6 +2021,11 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Symfony\\Bridge\\Twig\\TokenParser\\TransTokenParser' => __DIR__ . '/..' . '/symfony/twig-bridge/TokenParser/TransTokenParser.php',
|
||||
'Symfony\\Bridge\\Twig\\Translation\\TwigExtractor' => __DIR__ . '/..' . '/symfony/twig-bridge/Translation/TwigExtractor.php',
|
||||
'Symfony\\Bridge\\Twig\\UndefinedCallableHandler' => __DIR__ . '/..' . '/symfony/twig-bridge/UndefinedCallableHandler.php',
|
||||
'Symfony\\Bundle\\DebugBundle\\Command\\ServerDumpPlaceholderCommand' => __DIR__ . '/..' . '/symfony/debug-bundle/Command/ServerDumpPlaceholderCommand.php',
|
||||
'Symfony\\Bundle\\DebugBundle\\DebugBundle' => __DIR__ . '/..' . '/symfony/debug-bundle/DebugBundle.php',
|
||||
'Symfony\\Bundle\\DebugBundle\\DependencyInjection\\Compiler\\DumpDataCollectorPass' => __DIR__ . '/..' . '/symfony/debug-bundle/DependencyInjection/Compiler/DumpDataCollectorPass.php',
|
||||
'Symfony\\Bundle\\DebugBundle\\DependencyInjection\\Configuration' => __DIR__ . '/..' . '/symfony/debug-bundle/DependencyInjection/Configuration.php',
|
||||
'Symfony\\Bundle\\DebugBundle\\DependencyInjection\\DebugExtension' => __DIR__ . '/..' . '/symfony/debug-bundle/DependencyInjection/DebugExtension.php',
|
||||
'Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\AbstractPhpFileCacheWarmer' => __DIR__ . '/..' . '/symfony/framework-bundle/CacheWarmer/AbstractPhpFileCacheWarmer.php',
|
||||
'Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\AnnotationsCacheWarmer' => __DIR__ . '/..' . '/symfony/framework-bundle/CacheWarmer/AnnotationsCacheWarmer.php',
|
||||
'Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\CachePoolClearerCacheWarmer' => __DIR__ . '/..' . '/symfony/framework-bundle/CacheWarmer/CachePoolClearerCacheWarmer.php',
|
||||
@@ -3013,6 +3035,21 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Symfony\\Component\\Routing\\RouteCompilerInterface' => __DIR__ . '/..' . '/symfony/routing/RouteCompilerInterface.php',
|
||||
'Symfony\\Component\\Routing\\Router' => __DIR__ . '/..' . '/symfony/routing/Router.php',
|
||||
'Symfony\\Component\\Routing\\RouterInterface' => __DIR__ . '/..' . '/symfony/routing/RouterInterface.php',
|
||||
'Symfony\\Component\\Runtime\\GenericRuntime' => __DIR__ . '/..' . '/symfony/runtime/GenericRuntime.php',
|
||||
'Symfony\\Component\\Runtime\\Internal\\BasicErrorHandler' => __DIR__ . '/..' . '/symfony/runtime/Internal/BasicErrorHandler.php',
|
||||
'Symfony\\Component\\Runtime\\Internal\\ComposerPlugin' => __DIR__ . '/..' . '/symfony/runtime/Internal/ComposerPlugin.php',
|
||||
'Symfony\\Component\\Runtime\\Internal\\MissingDotenv' => __DIR__ . '/..' . '/symfony/runtime/Internal/MissingDotenv.php',
|
||||
'Symfony\\Component\\Runtime\\Internal\\SymfonyErrorHandler' => __DIR__ . '/..' . '/symfony/runtime/Internal/SymfonyErrorHandler.php',
|
||||
'Symfony\\Component\\Runtime\\ResolverInterface' => __DIR__ . '/..' . '/symfony/runtime/ResolverInterface.php',
|
||||
'Symfony\\Component\\Runtime\\Resolver\\ClosureResolver' => __DIR__ . '/..' . '/symfony/runtime/Resolver/ClosureResolver.php',
|
||||
'Symfony\\Component\\Runtime\\Resolver\\DebugClosureResolver' => __DIR__ . '/..' . '/symfony/runtime/Resolver/DebugClosureResolver.php',
|
||||
'Symfony\\Component\\Runtime\\RunnerInterface' => __DIR__ . '/..' . '/symfony/runtime/RunnerInterface.php',
|
||||
'Symfony\\Component\\Runtime\\Runner\\ClosureRunner' => __DIR__ . '/..' . '/symfony/runtime/Runner/ClosureRunner.php',
|
||||
'Symfony\\Component\\Runtime\\Runner\\Symfony\\ConsoleApplicationRunner' => __DIR__ . '/..' . '/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php',
|
||||
'Symfony\\Component\\Runtime\\Runner\\Symfony\\HttpKernelRunner' => __DIR__ . '/..' . '/symfony/runtime/Runner/Symfony/HttpKernelRunner.php',
|
||||
'Symfony\\Component\\Runtime\\Runner\\Symfony\\ResponseRunner' => __DIR__ . '/..' . '/symfony/runtime/Runner/Symfony/ResponseRunner.php',
|
||||
'Symfony\\Component\\Runtime\\RuntimeInterface' => __DIR__ . '/..' . '/symfony/runtime/RuntimeInterface.php',
|
||||
'Symfony\\Component\\Runtime\\SymfonyRuntime' => __DIR__ . '/..' . '/symfony/runtime/SymfonyRuntime.php',
|
||||
'Symfony\\Component\\Stopwatch\\Section' => __DIR__ . '/..' . '/symfony/stopwatch/Section.php',
|
||||
'Symfony\\Component\\Stopwatch\\Stopwatch' => __DIR__ . '/..' . '/symfony/stopwatch/Stopwatch.php',
|
||||
'Symfony\\Component\\Stopwatch\\StopwatchEvent' => __DIR__ . '/..' . '/symfony/stopwatch/StopwatchEvent.php',
|
||||
@@ -3157,6 +3194,13 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Symfony\\Polyfill\\Php80\\Php80' => __DIR__ . '/..' . '/symfony/polyfill-php80/Php80.php',
|
||||
'Symfony\\Polyfill\\Php80\\PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/PhpToken.php',
|
||||
'Symfony\\Polyfill\\Php83\\Php83' => __DIR__ . '/..' . '/symfony/polyfill-php83/Php83.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\Console\\ApplicationRuntime' => __DIR__ . '/..' . '/symfony/runtime/Internal/Console/ApplicationRuntime.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\Console\\Command\\CommandRuntime' => __DIR__ . '/..' . '/symfony/runtime/Internal/Console/Command/CommandRuntime.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\Console\\Input\\InputInterfaceRuntime' => __DIR__ . '/..' . '/symfony/runtime/Internal/Console/Input/InputInterfaceRuntime.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\Console\\Output\\OutputInterfaceRuntime' => __DIR__ . '/..' . '/symfony/runtime/Internal/Console/Output/OutputInterfaceRuntime.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\HttpFoundation\\RequestRuntime' => __DIR__ . '/..' . '/symfony/runtime/Internal/HttpFoundation/RequestRuntime.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\HttpFoundation\\ResponseRuntime' => __DIR__ . '/..' . '/symfony/runtime/Internal/HttpFoundation/ResponseRuntime.php',
|
||||
'Symfony\\Runtime\\Symfony\\Component\\HttpKernel\\HttpKernelInterfaceRuntime' => __DIR__ . '/..' . '/symfony/runtime/Internal/HttpKernel/HttpKernelInterfaceRuntime.php',
|
||||
'SynchroExceptionNotStarted' => __DIR__ . '/../..' . '/application/exceptions/SynchroExceptionNotStarted.php',
|
||||
'System' => __DIR__ . '/..' . '/pear/pear-core-minimal/src/System.php',
|
||||
'TCPDF' => __DIR__ . '/..' . '/combodo/tcpdf/tcpdf.php',
|
||||
|
||||
@@ -2563,6 +2563,83 @@
|
||||
],
|
||||
"install-path": "../symfony/css-selector"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug-bundle",
|
||||
"version": "v6.4.0",
|
||||
"version_normalized": "6.4.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/debug-bundle.git",
|
||||
"reference": "1e07027423d1d37125b60a50997ada26a9d9d202"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/debug-bundle/zipball/1e07027423d1d37125b60a50997ada26a9d9d202",
|
||||
"reference": "1e07027423d1d37125b60a50997ada26a9d9d202",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-xml": "*",
|
||||
"php": ">=8.1",
|
||||
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
|
||||
"symfony/http-kernel": "^5.4|^6.0|^7.0",
|
||||
"symfony/twig-bridge": "^5.4|^6.0|^7.0",
|
||||
"symfony/var-dumper": "^5.4|^6.0|^7.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/config": "<5.4",
|
||||
"symfony/dependency-injection": "<5.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "^5.4|^6.0|^7.0",
|
||||
"symfony/web-profiler-bundle": "^5.4|^6.0|^7.0"
|
||||
},
|
||||
"time": "2023-11-01T12:07:38+00:00",
|
||||
"type": "symfony-bundle",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Bundle\\DebugBundle\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfony full-stack framework",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/debug-bundle/tree/v6.4.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/debug-bundle"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dependency-injection",
|
||||
"version": "v6.4.0",
|
||||
@@ -4280,6 +4357,88 @@
|
||||
],
|
||||
"install-path": "../symfony/routing"
|
||||
},
|
||||
{
|
||||
"name": "symfony/runtime",
|
||||
"version": "v6.4.0",
|
||||
"version_normalized": "6.4.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/runtime.git",
|
||||
"reference": "86539231fadfdc7f7e9911d6fa7ed84a606e7d34"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/runtime/zipball/86539231fadfdc7f7e9911d6fa7ed84a606e7d34",
|
||||
"reference": "86539231fadfdc7f7e9911d6fa7ed84a606e7d34",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^1.0|^2.0",
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/dotenv": "<5.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "^1.0.2|^2.0",
|
||||
"symfony/console": "^5.4.9|^6.0.9|^7.0",
|
||||
"symfony/dotenv": "^5.4|^6.0|^7.0",
|
||||
"symfony/http-foundation": "^5.4|^6.0|^7.0",
|
||||
"symfony/http-kernel": "^5.4|^6.0|^7.0"
|
||||
},
|
||||
"time": "2023-10-18T09:43:34+00:00",
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": "Symfony\\Component\\Runtime\\Internal\\ComposerPlugin"
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Runtime\\": "",
|
||||
"Symfony\\Runtime\\Symfony\\Component\\": "Internal/"
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Enables decoupling PHP applications from global state",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"runtime"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/runtime/tree/v6.4.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/runtime"
|
||||
},
|
||||
{
|
||||
"name": "symfony/service-contracts",
|
||||
"version": "v2.5.2",
|
||||
@@ -5329,6 +5488,7 @@
|
||||
],
|
||||
"dev": true,
|
||||
"dev-package-names": [
|
||||
"symfony/debug-bundle",
|
||||
"symfony/stopwatch",
|
||||
"symfony/web-profiler-bundle"
|
||||
]
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
'name' => 'combodo/itop',
|
||||
'pretty_version' => 'dev-develop',
|
||||
'version' => 'dev-develop',
|
||||
'reference' => '7d3ff60eb26aec3f18c9cd88dc7e7ebcd1f93a52',
|
||||
'reference' => '62d7e10257f88b1de89da257859f8280cab77689',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
@@ -22,7 +22,7 @@
|
||||
'combodo/itop' => array(
|
||||
'pretty_version' => 'dev-develop',
|
||||
'version' => 'dev-develop',
|
||||
'reference' => '7d3ff60eb26aec3f18c9cd88dc7e7ebcd1f93a52',
|
||||
'reference' => '62d7e10257f88b1de89da257859f8280cab77689',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
@@ -410,6 +410,15 @@
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/debug-bundle' => array(
|
||||
'pretty_version' => 'v6.4.0',
|
||||
'version' => '6.4.0.0',
|
||||
'reference' => '1e07027423d1d37125b60a50997ada26a9d9d202',
|
||||
'type' => 'symfony-bundle',
|
||||
'install_path' => __DIR__ . '/../symfony/debug-bundle',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'symfony/dependency-injection' => array(
|
||||
'pretty_version' => 'v6.4.0',
|
||||
'version' => '6.4.0.0',
|
||||
@@ -596,6 +605,15 @@
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/runtime' => array(
|
||||
'pretty_version' => 'v6.4.0',
|
||||
'version' => '6.4.0.0',
|
||||
'reference' => '86539231fadfdc7f7e9911d6fa7ed84a606e7d34',
|
||||
'type' => 'composer-plugin',
|
||||
'install_path' => __DIR__ . '/../symfony/runtime',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/service-contracts' => array(
|
||||
'pretty_version' => 'v2.5.2',
|
||||
'version' => '2.5.2.0',
|
||||
|
||||
8
lib/symfony/debug-bundle/CHANGELOG.md
Normal file
8
lib/symfony/debug-bundle/CHANGELOG.md
Normal file
@@ -0,0 +1,8 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
4.1.0
|
||||
-----
|
||||
|
||||
* Added the `server:dump` command to run a server collecting and displaying
|
||||
dumps on a single place with multiple formats support
|
||||
@@ -0,0 +1,54 @@
|
||||
<?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\Bundle\DebugBundle\Command;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\VarDumper\Command\ServerDumpCommand;
|
||||
use Symfony\Component\VarDumper\Server\DumpServer;
|
||||
|
||||
/**
|
||||
* A placeholder command easing VarDumper server discovery.
|
||||
*
|
||||
* @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
#[AsCommand(name: 'server:dump', description: 'Start a dump server that collects and displays dumps in a single place')]
|
||||
class ServerDumpPlaceholderCommand extends Command
|
||||
{
|
||||
private ServerDumpCommand $replacedCommand;
|
||||
|
||||
public function __construct(DumpServer $server = null, array $descriptors = [])
|
||||
{
|
||||
$this->replacedCommand = new ServerDumpCommand((new \ReflectionClass(DumpServer::class))->newInstanceWithoutConstructor(), $descriptors);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->setDefinition($this->replacedCommand->getDefinition());
|
||||
$this->setHelp($this->replacedCommand->getHelp());
|
||||
$this->setDescription($this->replacedCommand->getDescription());
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
(new SymfonyStyle($input, $output))->getErrorStyle()->warning('In order to use the VarDumper server, set the "debug.dump_destination" config option to "tcp://%env(VAR_DUMPER_SERVER)%"');
|
||||
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
72
lib/symfony/debug-bundle/DebugBundle.php
Normal file
72
lib/symfony/debug-bundle/DebugBundle.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?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\Bundle\DebugBundle;
|
||||
|
||||
use Symfony\Bundle\DebugBundle\DependencyInjection\Compiler\DumpDataCollectorPass;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
use Symfony\Component\VarDumper\VarDumper;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class DebugBundle extends Bundle
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
if ($this->container->getParameter('kernel.debug')) {
|
||||
$container = $this->container;
|
||||
|
||||
// This code is here to lazy load the dump stack. This default
|
||||
// configuration is overridden in CLI mode on 'console.command' event.
|
||||
// The dump data collector is used by default, so dump output is sent to
|
||||
// the WDT. In a CLI context, if dump is used too soon, the data collector
|
||||
// will buffer it, and release it at the end of the script.
|
||||
VarDumper::setHandler(function ($var, string $label = null) use ($container) {
|
||||
$dumper = $container->get('data_collector.dump');
|
||||
$cloner = $container->get('var_dumper.cloner');
|
||||
$handler = function ($var, string $label = null) use ($dumper, $cloner) {
|
||||
$var = $cloner->cloneVar($var);
|
||||
if (null !== $label) {
|
||||
$var = $var->withContext(['label' => $label]);
|
||||
}
|
||||
|
||||
$dumper->dump($var);
|
||||
};
|
||||
VarDumper::setHandler($handler);
|
||||
$handler($var, $label);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function build(ContainerBuilder $container)
|
||||
{
|
||||
parent::build($container);
|
||||
|
||||
$container->addCompilerPass(new DumpDataCollectorPass());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function registerCommands(Application $application)
|
||||
{
|
||||
// noop
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?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\Bundle\DebugBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Registers the file link format for the {@link \Symfony\Component\HttpKernel\DataCollector\DumpDataCollector}.
|
||||
*
|
||||
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
|
||||
*/
|
||||
class DumpDataCollectorPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('data_collector.dump')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition('data_collector.dump');
|
||||
|
||||
if (!$container->has('.virtual_request_stack')) {
|
||||
$definition->replaceArgument(3, new Reference('request_stack'));
|
||||
}
|
||||
|
||||
if (!$container->hasParameter('web_profiler.debug_toolbar.mode') || WebDebugToolbarListener::DISABLED === $container->getParameter('web_profiler.debug_toolbar.mode')) {
|
||||
$definition->replaceArgument(3, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?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\Bundle\DebugBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
/**
|
||||
* DebugExtension configuration structure.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
public function getConfigTreeBuilder(): TreeBuilder
|
||||
{
|
||||
$treeBuilder = new TreeBuilder('debug');
|
||||
|
||||
$rootNode = $treeBuilder->getRootNode();
|
||||
$rootNode->children()
|
||||
->integerNode('max_items')
|
||||
->info('Max number of displayed items past the first level, -1 means no limit')
|
||||
->min(-1)
|
||||
->defaultValue(2500)
|
||||
->end()
|
||||
->integerNode('min_depth')
|
||||
->info('Minimum tree depth to clone all the items, 1 is default')
|
||||
->min(0)
|
||||
->defaultValue(1)
|
||||
->end()
|
||||
->integerNode('max_string_length')
|
||||
->info('Max length of displayed strings, -1 means no limit')
|
||||
->min(-1)
|
||||
->defaultValue(-1)
|
||||
->end()
|
||||
->scalarNode('dump_destination')
|
||||
->info('A stream URL where dumps should be written to')
|
||||
->example('php://stderr, or tcp://%env(VAR_DUMPER_SERVER)% when using the "server:dump" command')
|
||||
->defaultNull()
|
||||
->end()
|
||||
->enumNode('theme')
|
||||
->info('Changes the color of the dump() output when rendered directly on the templating. "dark" (default) or "light"')
|
||||
->example('dark')
|
||||
->values(['dark', 'light'])
|
||||
->defaultValue('dark')
|
||||
->end()
|
||||
;
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
||||
102
lib/symfony/debug-bundle/DependencyInjection/DebugExtension.php
Normal file
102
lib/symfony/debug-bundle/DependencyInjection/DebugExtension.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?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\Bundle\DebugBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Bridge\Monolog\Command\ServerLogCommand;
|
||||
use Symfony\Bundle\DebugBundle\Command\ServerDumpPlaceholderCommand;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\VarDumper\Caster\ReflectionCaster;
|
||||
|
||||
/**
|
||||
* DebugExtension.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class DebugExtension extends Extension
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$configuration = new Configuration();
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
||||
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services.php');
|
||||
|
||||
$container->getDefinition('var_dumper.cloner')
|
||||
->addMethodCall('setMaxItems', [$config['max_items']])
|
||||
->addMethodCall('setMinDepth', [$config['min_depth']])
|
||||
->addMethodCall('setMaxString', [$config['max_string_length']])
|
||||
->addMethodCall('addCasters', [ReflectionCaster::UNSET_CLOSURE_FILE_INFO]);
|
||||
|
||||
if ('dark' !== $config['theme']) {
|
||||
$container->getDefinition('var_dumper.html_dumper')
|
||||
->addMethodCall('setTheme', [$config['theme']]);
|
||||
}
|
||||
|
||||
if (null === $config['dump_destination']) {
|
||||
$container->getDefinition('var_dumper.command.server_dump')
|
||||
->setClass(ServerDumpPlaceholderCommand::class)
|
||||
;
|
||||
} elseif (str_starts_with($config['dump_destination'], 'tcp://')) {
|
||||
$container->getDefinition('debug.dump_listener')
|
||||
->replaceArgument(2, new Reference('var_dumper.server_connection'))
|
||||
;
|
||||
$container->getDefinition('data_collector.dump')
|
||||
->replaceArgument(4, new Reference('var_dumper.server_connection'))
|
||||
;
|
||||
$container->getDefinition('var_dumper.dump_server')
|
||||
->replaceArgument(0, $config['dump_destination'])
|
||||
;
|
||||
$container->getDefinition('var_dumper.server_connection')
|
||||
->replaceArgument(0, $config['dump_destination'])
|
||||
;
|
||||
} else {
|
||||
$container->getDefinition('var_dumper.cli_dumper')
|
||||
->replaceArgument(0, $config['dump_destination'])
|
||||
;
|
||||
$container->getDefinition('data_collector.dump')
|
||||
->replaceArgument(4, new Reference('var_dumper.cli_dumper'))
|
||||
;
|
||||
$container->getDefinition('var_dumper.command.server_dump')
|
||||
->setClass(ServerDumpPlaceholderCommand::class)
|
||||
;
|
||||
}
|
||||
|
||||
$container->getDefinition('var_dumper.cli_dumper')
|
||||
->addMethodCall('setDisplayOptions', [[
|
||||
'fileLinkFormat' => new Reference('debug.file_link_formatter', ContainerBuilder::IGNORE_ON_INVALID_REFERENCE),
|
||||
]])
|
||||
;
|
||||
|
||||
if (!class_exists(Command::class) || !class_exists(ServerLogCommand::class)) {
|
||||
$container->removeDefinition('monolog.command.server_log');
|
||||
}
|
||||
}
|
||||
|
||||
public function getXsdValidationBasePath(): string|false
|
||||
{
|
||||
return __DIR__.'/../Resources/config/schema';
|
||||
}
|
||||
|
||||
public function getNamespace(): string
|
||||
{
|
||||
return 'http://symfony.com/schema/dic/debug';
|
||||
}
|
||||
}
|
||||
19
lib/symfony/debug-bundle/LICENSE
Normal file
19
lib/symfony/debug-bundle/LICENSE
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2014-present Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
13
lib/symfony/debug-bundle/README.md
Normal file
13
lib/symfony/debug-bundle/README.md
Normal file
@@ -0,0 +1,13 @@
|
||||
DebugBundle
|
||||
===========
|
||||
|
||||
DebugBundle provides a tight integration of the Symfony VarDumper component and
|
||||
the ServerLogCommand from MonologBridge into the Symfony full-stack framework.
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
|
||||
* [Report issues](https://github.com/symfony/symfony/issues) and
|
||||
[send Pull Requests](https://github.com/symfony/symfony/pulls)
|
||||
in the [main Symfony repository](https://github.com/symfony/symfony)
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<xsd:schema xmlns="http://symfony.com/schema/dic/debug"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://symfony.com/schema/dic/debug"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<xsd:element name="config" type="config" />
|
||||
|
||||
<xsd:complexType name="config">
|
||||
<xsd:attribute name="max-items" type="xsd:integer" />
|
||||
<xsd:attribute name="min-depth" type="xsd:integer" />
|
||||
<xsd:attribute name="max-string-length" type="xsd:integer" />
|
||||
<xsd:attribute name="dump-destination" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
140
lib/symfony/debug-bundle/Resources/config/services.php
Normal file
140
lib/symfony/debug-bundle/Resources/config/services.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?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\DependencyInjection\Loader\Configurator;
|
||||
|
||||
use Monolog\Formatter\FormatterInterface;
|
||||
use Symfony\Bridge\Monolog\Command\ServerLogCommand;
|
||||
use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
|
||||
use Symfony\Bridge\Twig\Extension\DumpExtension;
|
||||
use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
|
||||
use Symfony\Component\HttpKernel\EventListener\DumpListener;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Command\Descriptor\CliDescriptor;
|
||||
use Symfony\Component\VarDumper\Command\Descriptor\HtmlDescriptor;
|
||||
use Symfony\Component\VarDumper\Command\ServerDumpCommand;
|
||||
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
||||
use Symfony\Component\VarDumper\Dumper\ContextProvider\CliContextProvider;
|
||||
use Symfony\Component\VarDumper\Dumper\ContextProvider\RequestContextProvider;
|
||||
use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider;
|
||||
use Symfony\Component\VarDumper\Dumper\ContextualizedDumper;
|
||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
||||
use Symfony\Component\VarDumper\Server\Connection;
|
||||
use Symfony\Component\VarDumper\Server\DumpServer;
|
||||
|
||||
return static function (ContainerConfigurator $container) {
|
||||
$container->parameters()
|
||||
->set('env(VAR_DUMPER_SERVER)', '127.0.0.1:9912')
|
||||
;
|
||||
|
||||
$container->services()
|
||||
|
||||
->set('twig.extension.dump', DumpExtension::class)
|
||||
->args([
|
||||
service('var_dumper.cloner'),
|
||||
service('var_dumper.html_dumper'),
|
||||
])
|
||||
->tag('twig.extension')
|
||||
|
||||
->set('data_collector.dump', DumpDataCollector::class)
|
||||
->public()
|
||||
->args([
|
||||
service('debug.stopwatch')->ignoreOnInvalid(),
|
||||
service('debug.file_link_formatter')->ignoreOnInvalid(),
|
||||
param('kernel.charset'),
|
||||
service('.virtual_request_stack'),
|
||||
null, // var_dumper.cli_dumper or var_dumper.server_connection when debug.dump_destination is set
|
||||
])
|
||||
->tag('data_collector', [
|
||||
'id' => 'dump',
|
||||
'template' => '@Debug/Profiler/dump.html.twig',
|
||||
'priority' => 240,
|
||||
])
|
||||
|
||||
->set('debug.dump_listener', DumpListener::class)
|
||||
->args([
|
||||
service('var_dumper.cloner'),
|
||||
service('var_dumper.cli_dumper'),
|
||||
null,
|
||||
])
|
||||
->tag('kernel.event_subscriber')
|
||||
|
||||
->set('var_dumper.cloner', VarCloner::class)
|
||||
->public()
|
||||
|
||||
->set('var_dumper.cli_dumper', CliDumper::class)
|
||||
->args([
|
||||
null, // debug.dump_destination,
|
||||
param('kernel.charset'),
|
||||
0, // flags
|
||||
])
|
||||
|
||||
->set('var_dumper.contextualized_cli_dumper', ContextualizedDumper::class)
|
||||
->decorate('var_dumper.cli_dumper')
|
||||
->args([
|
||||
service('var_dumper.contextualized_cli_dumper.inner'),
|
||||
[
|
||||
'source' => inline_service(SourceContextProvider::class)->args([
|
||||
param('kernel.charset'),
|
||||
param('kernel.project_dir'),
|
||||
service('debug.file_link_formatter')->nullOnInvalid(),
|
||||
]),
|
||||
],
|
||||
])
|
||||
|
||||
->set('var_dumper.html_dumper', HtmlDumper::class)
|
||||
->args([
|
||||
null,
|
||||
param('kernel.charset'),
|
||||
0, // flags
|
||||
])
|
||||
->call('setDisplayOptions', [
|
||||
['fileLinkFormat' => service('debug.file_link_formatter')->ignoreOnInvalid()],
|
||||
])
|
||||
|
||||
->set('var_dumper.server_connection', Connection::class)
|
||||
->args([
|
||||
'', // server host
|
||||
[
|
||||
'source' => inline_service(SourceContextProvider::class)->args([
|
||||
param('kernel.charset'),
|
||||
param('kernel.project_dir'),
|
||||
service('debug.file_link_formatter')->nullOnInvalid(),
|
||||
]),
|
||||
'request' => inline_service(RequestContextProvider::class)->args([service('request_stack')]),
|
||||
'cli' => inline_service(CliContextProvider::class),
|
||||
],
|
||||
])
|
||||
|
||||
->set('var_dumper.dump_server', DumpServer::class)
|
||||
->args([
|
||||
'', // server host
|
||||
service('logger')->nullOnInvalid(),
|
||||
])
|
||||
->tag('monolog.logger', ['channel' => 'debug'])
|
||||
|
||||
->set('var_dumper.command.server_dump', ServerDumpCommand::class)
|
||||
->args([
|
||||
service('var_dumper.dump_server'),
|
||||
[
|
||||
'cli' => inline_service(CliDescriptor::class)->args([service('var_dumper.contextualized_cli_dumper.inner')]),
|
||||
'html' => inline_service(HtmlDescriptor::class)->args([service('var_dumper.html_dumper')]),
|
||||
],
|
||||
])
|
||||
->tag('console.command')
|
||||
|
||||
->set('monolog.command.server_log', ServerLogCommand::class)
|
||||
;
|
||||
|
||||
if (class_exists(ConsoleFormatter::class) && interface_exists(FormatterInterface::class)) {
|
||||
$container->services()->get('monolog.command.server_log')->tag('console.command');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,83 @@
|
||||
{% extends '@WebProfiler/Profiler/layout.html.twig' %}
|
||||
|
||||
{% block toolbar %}
|
||||
{% if collector.dumpsCount %}
|
||||
{% set icon %}
|
||||
{{ source('@Debug/Profiler/icon.svg') }}
|
||||
<span class="sf-toolbar-value">{{ collector.dumpsCount }}</span>
|
||||
{% endset %}
|
||||
|
||||
{% set text %}
|
||||
{% for dump in collector.getDumps('html') %}
|
||||
<div class="sf-toolbar-info-piece">
|
||||
<span>
|
||||
{% if dump.label is defined and '' != dump.label %}
|
||||
<span class="sf-toolbar-file-line"><strong>{{ dump.label }}</strong> in </span>
|
||||
{% endif %}
|
||||
{% if dump.file %}
|
||||
{% set link = dump.file|file_link(dump.line) %}
|
||||
{% if link %}
|
||||
<a href="{{ link }}" title="{{ dump.file }}">{{ dump.name }}</a>
|
||||
{% else %}
|
||||
<abbr title="{{ dump.file }}">{{ dump.name }}</abbr>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ dump.name }}
|
||||
{% endif %}
|
||||
</span>
|
||||
<span class="sf-toolbar-file-line">line {{ dump.line }}</span>
|
||||
|
||||
{{ dump.data|raw }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endset %}
|
||||
|
||||
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { 'link': true }) }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block menu %}
|
||||
<span class="label {{ collector.dumpsCount == 0 ? 'disabled' }}">
|
||||
<span class="icon">{{ source('@Debug/Profiler/icon.svg') }}</span>
|
||||
<strong>Debug</strong>
|
||||
</span>
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
<h2>Dumped Contents</h2>
|
||||
|
||||
{% for dump in collector.getDumps('html') %}
|
||||
<div class="sf-dump sf-reset">
|
||||
<span class="metadata">
|
||||
{% if dump.label is defined and '' != dump.label %}
|
||||
<strong>{{ dump.label }}</strong> in
|
||||
{% else %}
|
||||
In
|
||||
{% endif %}
|
||||
{% if dump.line %}
|
||||
{% set link = dump.file|file_link(dump.line) %}
|
||||
{% if link %}
|
||||
<a href="{{ link }}" title="{{ dump.file }}">{{ dump.name }}</a>
|
||||
{% else %}
|
||||
<abbr title="{{ dump.file }}">{{ dump.name }}</abbr>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ dump.name }}
|
||||
{% endif %}
|
||||
line <a class="text-small sf-toggle" data-toggle-selector="#sf-trace-{{ loop.index0 }}">{{ dump.line }}</a>:
|
||||
</span>
|
||||
|
||||
<div class="sf-dump-compact hidden" id="sf-trace-{{ loop.index0 }}">
|
||||
<div class="trace">
|
||||
{{ dump.fileExcerpt ? dump.fileExcerpt|raw : dump.file|file_excerpt(dump.line) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ dump.data|raw }}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="empty empty-panel">
|
||||
<p>No content was dumped.</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" data-icon-name="icon-tabler-viewfinder" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<circle cx="12" cy="12" r="9"></circle>
|
||||
<line x1="12" y1="3" x2="12" y2="7"></line>
|
||||
<line x1="12" y1="21" x2="12" y2="18"></line>
|
||||
<line x1="3" y1="12" x2="7" y2="12"></line>
|
||||
<line x1="21" y1="12" x2="18" y2="12"></line>
|
||||
<line x1="12" y1="12" x2="12" y2="12.01"></line>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 586 B |
41
lib/symfony/debug-bundle/composer.json
Normal file
41
lib/symfony/debug-bundle/composer.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "symfony/debug-bundle",
|
||||
"type": "symfony-bundle",
|
||||
"description": "Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfony full-stack framework",
|
||||
"keywords": [],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"ext-xml": "*",
|
||||
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
|
||||
"symfony/http-kernel": "^5.4|^6.0|^7.0",
|
||||
"symfony/twig-bridge": "^5.4|^6.0|^7.0",
|
||||
"symfony/var-dumper": "^5.4|^6.0|^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "^5.4|^6.0|^7.0",
|
||||
"symfony/web-profiler-bundle": "^5.4|^6.0|^7.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/config": "<5.4",
|
||||
"symfony/dependency-injection": "<5.4"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Bundle\\DebugBundle\\": "" },
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
19
lib/symfony/runtime/CHANGELOG.md
Normal file
19
lib/symfony/runtime/CHANGELOG.md
Normal file
@@ -0,0 +1,19 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
6.4
|
||||
---
|
||||
|
||||
* Add argument `bool $debug = false` to `HttpKernelRunner::__construct()`
|
||||
|
||||
5.4
|
||||
---
|
||||
|
||||
* The component is not experimental anymore
|
||||
* Add options "env_var_name" and "debug_var_name" to `GenericRuntime` and `SymfonyRuntime`
|
||||
* Add option "dotenv_overload" to `SymfonyRuntime`
|
||||
|
||||
5.3.0
|
||||
-----
|
||||
|
||||
* Add the component
|
||||
223
lib/symfony/runtime/GenericRuntime.php
Normal file
223
lib/symfony/runtime/GenericRuntime.php
Normal file
@@ -0,0 +1,223 @@
|
||||
<?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\Runtime;
|
||||
|
||||
use Symfony\Component\Runtime\Internal\BasicErrorHandler;
|
||||
use Symfony\Component\Runtime\Resolver\ClosureResolver;
|
||||
use Symfony\Component\Runtime\Resolver\DebugClosureResolver;
|
||||
use Symfony\Component\Runtime\Runner\ClosureRunner;
|
||||
|
||||
// Help opcache.preload discover always-needed symbols
|
||||
class_exists(ClosureResolver::class);
|
||||
|
||||
/**
|
||||
* A runtime to do bare-metal PHP without using superglobals.
|
||||
*
|
||||
* It supports the following options:
|
||||
* - "debug" toggles displaying errors and defaults
|
||||
* to the "APP_DEBUG" environment variable;
|
||||
* - "runtimes" maps types to a GenericRuntime implementation
|
||||
* that knows how to deal with each of them;
|
||||
* - "error_handler" defines the class to use to handle PHP errors;
|
||||
* - "env_var_name" and "debug_var_name" define the name of the env
|
||||
* vars that hold the Symfony env and the debug flag respectively.
|
||||
*
|
||||
* The app-callable can declare arguments among either:
|
||||
* - "array $context" to get a local array similar to $_SERVER;
|
||||
* - "array $argv" to get the command line arguments when running on the CLI;
|
||||
* - "array $request" to get a local array with keys "query", "body", "files" and
|
||||
* "session", which map to $_GET, $_POST, $FILES and &$_SESSION respectively.
|
||||
*
|
||||
* It should return a Closure():int|string|null or an instance of RunnerInterface.
|
||||
*
|
||||
* In debug mode, the runtime registers a strict error handler
|
||||
* that throws exceptions when a PHP warning/notice is raised.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class GenericRuntime implements RuntimeInterface
|
||||
{
|
||||
protected $options;
|
||||
|
||||
/**
|
||||
* @param array {
|
||||
* debug?: ?bool,
|
||||
* runtimes?: ?array,
|
||||
* error_handler?: string|false,
|
||||
* env_var_name?: string,
|
||||
* debug_var_name?: string,
|
||||
* } $options
|
||||
*/
|
||||
public function __construct(array $options = [])
|
||||
{
|
||||
$options['env_var_name'] ??= 'APP_ENV';
|
||||
$debugKey = $options['debug_var_name'] ??= 'APP_DEBUG';
|
||||
|
||||
$debug = $options['debug'] ?? $_SERVER[$debugKey] ?? $_ENV[$debugKey] ?? true;
|
||||
|
||||
if (!\is_bool($debug)) {
|
||||
$debug = filter_var($debug, \FILTER_VALIDATE_BOOL);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
umask(0000);
|
||||
$_SERVER[$debugKey] = $_ENV[$debugKey] = '1';
|
||||
|
||||
if (false !== $errorHandler = ($options['error_handler'] ?? BasicErrorHandler::class)) {
|
||||
$errorHandler::register($debug);
|
||||
$options['error_handler'] = false;
|
||||
}
|
||||
} else {
|
||||
$_SERVER[$debugKey] = $_ENV[$debugKey] = '0';
|
||||
}
|
||||
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
public function getResolver(callable $callable, \ReflectionFunction $reflector = null): ResolverInterface
|
||||
{
|
||||
$callable = $callable(...);
|
||||
$parameters = ($reflector ?? new \ReflectionFunction($callable))->getParameters();
|
||||
$arguments = function () use ($parameters) {
|
||||
$arguments = [];
|
||||
|
||||
try {
|
||||
foreach ($parameters as $parameter) {
|
||||
$type = $parameter->getType();
|
||||
$arguments[] = $this->getArgument($parameter, $type instanceof \ReflectionNamedType ? $type->getName() : null);
|
||||
}
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
if (!$parameter->isOptional()) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
};
|
||||
|
||||
if ($_SERVER[$this->options['debug_var_name']]) {
|
||||
return new DebugClosureResolver($callable, $arguments);
|
||||
}
|
||||
|
||||
return new ClosureResolver($callable, $arguments);
|
||||
}
|
||||
|
||||
public function getRunner(?object $application): RunnerInterface
|
||||
{
|
||||
$application ??= static fn () => 0;
|
||||
|
||||
if ($application instanceof RunnerInterface) {
|
||||
return $application;
|
||||
}
|
||||
|
||||
if (!$application instanceof \Closure) {
|
||||
if ($runtime = $this->resolveRuntime($application::class)) {
|
||||
return $runtime->getRunner($application);
|
||||
}
|
||||
|
||||
if (!\is_callable($application)) {
|
||||
throw new \LogicException(sprintf('"%s" doesn\'t know how to handle apps of type "%s".', get_debug_type($this), get_debug_type($application)));
|
||||
}
|
||||
|
||||
$application = $application(...);
|
||||
}
|
||||
|
||||
if ($_SERVER[$this->options['debug_var_name']] && ($r = new \ReflectionFunction($application)) && $r->getNumberOfRequiredParameters()) {
|
||||
throw new \ArgumentCountError(sprintf('Zero argument should be required by the runner callable, but at least one is in "%s" on line "%d.', $r->getFileName(), $r->getStartLine()));
|
||||
}
|
||||
|
||||
return new ClosureRunner($application);
|
||||
}
|
||||
|
||||
protected function getArgument(\ReflectionParameter $parameter, ?string $type): mixed
|
||||
{
|
||||
if ('array' === $type) {
|
||||
switch ($parameter->name) {
|
||||
case 'context':
|
||||
$context = $_SERVER;
|
||||
|
||||
if ($_ENV && !isset($_SERVER['PATH']) && !isset($_SERVER['Path'])) {
|
||||
$context += $_ENV;
|
||||
}
|
||||
|
||||
return $context;
|
||||
|
||||
case 'argv':
|
||||
return $_SERVER['argv'] ?? [];
|
||||
|
||||
case 'request':
|
||||
return [
|
||||
'query' => $_GET,
|
||||
'body' => $_POST,
|
||||
'files' => $_FILES,
|
||||
'session' => &$_SESSION,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (RuntimeInterface::class === $type) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
if (!$runtime = $this->getRuntime($type)) {
|
||||
$r = $parameter->getDeclaringFunction();
|
||||
|
||||
throw new \InvalidArgumentException(sprintf('Cannot resolve argument "%s $%s" in "%s" on line "%d": "%s" supports only arguments "array $context", "array $argv" and "array $request", or a runtime named "Symfony\Runtime\%1$sRuntime".', $type, $parameter->name, $r->getFileName(), $r->getStartLine(), get_debug_type($this)));
|
||||
}
|
||||
|
||||
return $runtime->getArgument($parameter, $type);
|
||||
}
|
||||
|
||||
protected static function register(self $runtime): self
|
||||
{
|
||||
return $runtime;
|
||||
}
|
||||
|
||||
private function getRuntime(string $type): ?self
|
||||
{
|
||||
if (null === $runtime = ($this->options['runtimes'][$type] ?? null)) {
|
||||
$runtime = 'Symfony\Runtime\\'.$type.'Runtime';
|
||||
$runtime = class_exists($runtime) ? $runtime : $this->options['runtimes'][$type] = false;
|
||||
}
|
||||
|
||||
if (\is_string($runtime)) {
|
||||
$runtime = $runtime::register($this);
|
||||
}
|
||||
|
||||
if ($this === $runtime) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $runtime ?: null;
|
||||
}
|
||||
|
||||
private function resolveRuntime(string $class): ?self
|
||||
{
|
||||
if ($runtime = $this->getRuntime($class)) {
|
||||
return $runtime;
|
||||
}
|
||||
|
||||
foreach (class_parents($class) as $type) {
|
||||
if ($runtime = $this->getRuntime($type)) {
|
||||
return $runtime;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (class_implements($class) as $type) {
|
||||
if ($runtime = $this->getRuntime($type)) {
|
||||
return $runtime;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
53
lib/symfony/runtime/Internal/BasicErrorHandler.php
Normal file
53
lib/symfony/runtime/Internal/BasicErrorHandler.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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\Runtime\Internal;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class BasicErrorHandler
|
||||
{
|
||||
public static function register(bool $debug): void
|
||||
{
|
||||
error_reporting(-1);
|
||||
|
||||
if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
|
||||
ini_set('display_errors', $debug);
|
||||
} elseif (!filter_var(\ini_get('log_errors'), \FILTER_VALIDATE_BOOL) || \ini_get('error_log')) {
|
||||
// CLI - display errors only if they're not already logged to STDERR
|
||||
ini_set('display_errors', 1);
|
||||
}
|
||||
|
||||
if (0 <= \ini_get('zend.assertions')) {
|
||||
ini_set('zend.assertions', 1);
|
||||
ini_set('assert.active', $debug);
|
||||
ini_set('assert.exception', 1);
|
||||
}
|
||||
|
||||
set_error_handler(new self());
|
||||
}
|
||||
|
||||
public function __invoke(int $type, string $message, string $file, int $line): bool
|
||||
{
|
||||
if ((\E_DEPRECATED | \E_USER_DEPRECATED) & $type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((error_reporting() | \E_ERROR | \E_RECOVERABLE_ERROR | \E_PARSE | \E_CORE_ERROR | \E_COMPILE_ERROR | \E_USER_ERROR) & $type) {
|
||||
throw new \ErrorException($message, 0, $type, $file, $line);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
119
lib/symfony/runtime/Internal/ComposerPlugin.php
Normal file
119
lib/symfony/runtime/Internal/ComposerPlugin.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?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\Runtime\Internal;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\EventDispatcher\EventSubscriberInterface;
|
||||
use Composer\Factory;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Plugin\PluginInterface;
|
||||
use Composer\Script\ScriptEvents;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Runtime\SymfonyRuntime;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ComposerPlugin implements PluginInterface, EventSubscriberInterface
|
||||
{
|
||||
private Composer $composer;
|
||||
private IOInterface $io;
|
||||
|
||||
private static bool $activated = false;
|
||||
|
||||
public function activate(Composer $composer, IOInterface $io): void
|
||||
{
|
||||
self::$activated = true;
|
||||
$this->composer = $composer;
|
||||
$this->io = $io;
|
||||
}
|
||||
|
||||
public function deactivate(Composer $composer, IOInterface $io): void
|
||||
{
|
||||
self::$activated = false;
|
||||
}
|
||||
|
||||
public function uninstall(Composer $composer, IOInterface $io): void
|
||||
{
|
||||
@unlink($composer->getConfig()->get('vendor-dir').'/autoload_runtime.php');
|
||||
}
|
||||
|
||||
public function updateAutoloadFile(): void
|
||||
{
|
||||
$vendorDir = realpath($this->composer->getConfig()->get('vendor-dir'));
|
||||
|
||||
if (!is_file($autoloadFile = $vendorDir.'/autoload.php')
|
||||
|| false === $extra = $this->composer->getPackage()->getExtra()['runtime'] ?? []
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$fs = new Filesystem();
|
||||
$projectDir = \dirname(realpath(Factory::getComposerFile()));
|
||||
|
||||
if (null === $autoloadTemplate = $extra['autoload_template'] ?? null) {
|
||||
$autoloadTemplate = __DIR__.'/autoload_runtime.template';
|
||||
} else {
|
||||
if (!$fs->isAbsolutePath($autoloadTemplate)) {
|
||||
$autoloadTemplate = $projectDir.'/'.$autoloadTemplate;
|
||||
}
|
||||
|
||||
if (!is_file($autoloadTemplate)) {
|
||||
throw new \InvalidArgumentException(sprintf('File "%s" defined under "extra.runtime.autoload_template" in your composer.json file not found.', $this->composer->getPackage()->getExtra()['runtime']['autoload_template']));
|
||||
}
|
||||
}
|
||||
|
||||
$projectDir = $fs->makePathRelative($projectDir, $vendorDir);
|
||||
$nestingLevel = 0;
|
||||
|
||||
while (str_starts_with($projectDir, '../')) {
|
||||
++$nestingLevel;
|
||||
$projectDir = substr($projectDir, 3);
|
||||
}
|
||||
|
||||
if (!$nestingLevel) {
|
||||
$projectDir = '__'.'DIR__.'.var_export('/'.$projectDir, true);
|
||||
} else {
|
||||
$projectDir = 'dirname(__'."DIR__, $nestingLevel)".('' !== $projectDir ? '.'.var_export('/'.$projectDir, true) : '');
|
||||
}
|
||||
|
||||
$runtimeClass = $extra['class'] ?? SymfonyRuntime::class;
|
||||
|
||||
unset($extra['class'], $extra['autoload_template']);
|
||||
|
||||
$code = strtr(file_get_contents($autoloadTemplate), [
|
||||
'%project_dir%' => $projectDir,
|
||||
'%runtime_class%' => var_export($runtimeClass, true),
|
||||
'%runtime_options%' => '['.substr(var_export($extra, true), 7, -1)." 'project_dir' => {$projectDir},\n]",
|
||||
]);
|
||||
|
||||
// could use Composer\Util\Filesystem::filePutContentsIfModified once Composer 1.x support is dropped for this plugin
|
||||
$path = substr_replace($autoloadFile, '_runtime', -4, 0);
|
||||
$currentContent = @file_exists($path) ? @file_get_contents($path) : false;
|
||||
if (false === $currentContent || $currentContent !== $code) {
|
||||
file_put_contents($path, $code);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
if (!self::$activated) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
ScriptEvents::POST_AUTOLOAD_DUMP => 'updateAutoloadFile',
|
||||
];
|
||||
}
|
||||
}
|
||||
21
lib/symfony/runtime/Internal/Console/ApplicationRuntime.php
Normal file
21
lib/symfony/runtime/Internal/Console/ApplicationRuntime.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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\Runtime\Symfony\Component\Console;
|
||||
|
||||
use Symfony\Component\Runtime\SymfonyRuntime;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class ApplicationRuntime extends SymfonyRuntime
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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\Runtime\Symfony\Component\Console\Command;
|
||||
|
||||
use Symfony\Component\Runtime\SymfonyRuntime;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class CommandRuntime extends SymfonyRuntime
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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\Runtime\Symfony\Component\Console\Input;
|
||||
|
||||
use Symfony\Component\Runtime\SymfonyRuntime;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class InputInterfaceRuntime extends SymfonyRuntime
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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\Runtime\Symfony\Component\Console\Output;
|
||||
|
||||
use Symfony\Component\Runtime\SymfonyRuntime;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class OutputInterfaceRuntime extends SymfonyRuntime
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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\Runtime\Symfony\Component\HttpFoundation;
|
||||
|
||||
use Symfony\Component\Runtime\SymfonyRuntime;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class RequestRuntime extends SymfonyRuntime
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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\Runtime\Symfony\Component\HttpFoundation;
|
||||
|
||||
use Symfony\Component\Runtime\SymfonyRuntime;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class ResponseRuntime extends SymfonyRuntime
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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\Runtime\Symfony\Component\HttpKernel;
|
||||
|
||||
use Symfony\Component\Runtime\SymfonyRuntime;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class HttpKernelInterfaceRuntime extends SymfonyRuntime
|
||||
{
|
||||
}
|
||||
19
lib/symfony/runtime/Internal/MissingDotenv.php
Normal file
19
lib/symfony/runtime/Internal/MissingDotenv.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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\Runtime\Internal;
|
||||
|
||||
/**
|
||||
* @internal class that should be loaded only when symfony/dotenv is not installed
|
||||
*/
|
||||
class MissingDotenv
|
||||
{
|
||||
}
|
||||
35
lib/symfony/runtime/Internal/SymfonyErrorHandler.php
Normal file
35
lib/symfony/runtime/Internal/SymfonyErrorHandler.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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\Runtime\Internal;
|
||||
|
||||
use Symfony\Component\ErrorHandler\BufferingLogger;
|
||||
use Symfony\Component\ErrorHandler\DebugClassLoader;
|
||||
use Symfony\Component\ErrorHandler\ErrorHandler;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class SymfonyErrorHandler
|
||||
{
|
||||
public static function register(bool $debug): void
|
||||
{
|
||||
BasicErrorHandler::register($debug);
|
||||
|
||||
if (class_exists(ErrorHandler::class)) {
|
||||
DebugClassLoader::enable();
|
||||
restore_error_handler();
|
||||
ErrorHandler::register(new ErrorHandler(new BufferingLogger(), $debug));
|
||||
}
|
||||
}
|
||||
}
|
||||
28
lib/symfony/runtime/Internal/autoload_runtime.template
Normal file
28
lib/symfony/runtime/Internal/autoload_runtime.template
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
// autoload_runtime.php @generated by Symfony Runtime
|
||||
|
||||
if (true === (require_once __DIR__.'/autoload.php') || empty($_SERVER['SCRIPT_FILENAME'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$app = require $_SERVER['SCRIPT_FILENAME'];
|
||||
|
||||
if (!is_object($app)) {
|
||||
throw new TypeError(sprintf('Invalid return value: callable object expected, "%s" returned from "%s".', get_debug_type($app), $_SERVER['SCRIPT_FILENAME']));
|
||||
}
|
||||
|
||||
$runtime = $_SERVER['APP_RUNTIME'] ?? $_ENV['APP_RUNTIME'] ?? %runtime_class%;
|
||||
$runtime = new $runtime(($_SERVER['APP_RUNTIME_OPTIONS'] ?? $_ENV['APP_RUNTIME_OPTIONS'] ?? []) + %runtime_options%);
|
||||
|
||||
[$app, $args] = $runtime
|
||||
->getResolver($app)
|
||||
->resolve();
|
||||
|
||||
$app = $app(...$args);
|
||||
|
||||
exit(
|
||||
$runtime
|
||||
->getRunner($app)
|
||||
->run()
|
||||
);
|
||||
19
lib/symfony/runtime/LICENSE
Normal file
19
lib/symfony/runtime/LICENSE
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2021-present Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
13
lib/symfony/runtime/README.md
Normal file
13
lib/symfony/runtime/README.md
Normal file
@@ -0,0 +1,13 @@
|
||||
Runtime Component
|
||||
=================
|
||||
|
||||
Symfony Runtime enables decoupling applications from global state.
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
* [Documentation](https://symfony.com/doc/current/components/runtime.html)
|
||||
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
|
||||
* [Report issues](https://github.com/symfony/symfony/issues) and
|
||||
[send Pull Requests](https://github.com/symfony/symfony/pulls)
|
||||
in the [main Symfony repository](https://github.com/symfony/symfony)
|
||||
31
lib/symfony/runtime/Resolver/ClosureResolver.php
Normal file
31
lib/symfony/runtime/Resolver/ClosureResolver.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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\Runtime\Resolver;
|
||||
|
||||
use Symfony\Component\Runtime\ResolverInterface;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ClosureResolver implements ResolverInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly \Closure $closure,
|
||||
private readonly \Closure $arguments,
|
||||
) {
|
||||
}
|
||||
|
||||
public function resolve(): array
|
||||
{
|
||||
return [$this->closure, ($this->arguments)()];
|
||||
}
|
||||
}
|
||||
36
lib/symfony/runtime/Resolver/DebugClosureResolver.php
Normal file
36
lib/symfony/runtime/Resolver/DebugClosureResolver.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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\Runtime\Resolver;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class DebugClosureResolver extends ClosureResolver
|
||||
{
|
||||
public function resolve(): array
|
||||
{
|
||||
[$closure, $arguments] = parent::resolve();
|
||||
|
||||
return [
|
||||
static function (...$arguments) use ($closure) {
|
||||
if (\is_object($app = $closure(...$arguments)) || null === $app) {
|
||||
return $app;
|
||||
}
|
||||
|
||||
$r = new \ReflectionFunction($closure);
|
||||
|
||||
throw new \TypeError(sprintf('Unexpected value of type "%s" returned, "object" expected from "%s" on line "%d".', get_debug_type($app), $r->getFileName(), $r->getStartLine()));
|
||||
},
|
||||
$arguments,
|
||||
];
|
||||
}
|
||||
}
|
||||
23
lib/symfony/runtime/ResolverInterface.php
Normal file
23
lib/symfony/runtime/ResolverInterface.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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\Runtime;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
interface ResolverInterface
|
||||
{
|
||||
/**
|
||||
* @return array{0: callable, 1: mixed[]}
|
||||
*/
|
||||
public function resolve(): array;
|
||||
}
|
||||
44
lib/symfony/runtime/Runner/ClosureRunner.php
Normal file
44
lib/symfony/runtime/Runner/ClosureRunner.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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\Runtime\Runner;
|
||||
|
||||
use Symfony\Component\Runtime\RunnerInterface;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ClosureRunner implements RunnerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly \Closure $closure,
|
||||
) {
|
||||
}
|
||||
|
||||
public function run(): int
|
||||
{
|
||||
$exitStatus = ($this->closure)();
|
||||
|
||||
if (\is_string($exitStatus)) {
|
||||
echo $exitStatus;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (null !== $exitStatus && !\is_int($exitStatus)) {
|
||||
$r = new \ReflectionFunction($this->closure);
|
||||
|
||||
throw new \TypeError(sprintf('Unexpected value of type "%s" returned, "string|int|null" expected from "%s" on line "%d".', get_debug_type($exitStatus), $r->getFileName(), $r->getStartLine()));
|
||||
}
|
||||
|
||||
return $exitStatus ?? 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?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\Runtime\Runner\Symfony;
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Runtime\RunnerInterface;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ConsoleApplicationRunner implements RunnerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Application $application,
|
||||
private readonly ?string $defaultEnv,
|
||||
private readonly InputInterface $input,
|
||||
private readonly ?OutputInterface $output = null,
|
||||
) {
|
||||
}
|
||||
|
||||
public function run(): int
|
||||
{
|
||||
if (null === $this->defaultEnv) {
|
||||
return $this->application->run($this->input, $this->output);
|
||||
}
|
||||
|
||||
$definition = $this->application->getDefinition();
|
||||
|
||||
if (!$definition->hasOption('env') && !$definition->hasOption('e') && !$definition->hasShortcut('e')) {
|
||||
$definition->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $this->defaultEnv));
|
||||
}
|
||||
|
||||
if (!$definition->hasOption('no-debug')) {
|
||||
$definition->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'));
|
||||
}
|
||||
|
||||
return $this->application->run($this->input, $this->output);
|
||||
}
|
||||
}
|
||||
58
lib/symfony/runtime/Runner/Symfony/HttpKernelRunner.php
Normal file
58
lib/symfony/runtime/Runner/Symfony/HttpKernelRunner.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?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\Runtime\Runner\Symfony;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\HttpKernel\TerminableInterface;
|
||||
use Symfony\Component\Runtime\RunnerInterface;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class HttpKernelRunner implements RunnerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly HttpKernelInterface $kernel,
|
||||
private readonly Request $request,
|
||||
private readonly bool $debug = false,
|
||||
) {
|
||||
}
|
||||
|
||||
public function run(): int
|
||||
{
|
||||
$response = $this->kernel->handle($this->request);
|
||||
|
||||
if (Kernel::VERSION_ID >= 60400) {
|
||||
$response->send(false);
|
||||
|
||||
if (\function_exists('fastcgi_finish_request') && !$this->debug) {
|
||||
fastcgi_finish_request();
|
||||
} elseif (\function_exists('litespeed_finish_request') && !$this->debug) {
|
||||
litespeed_finish_request();
|
||||
} else {
|
||||
Response::closeOutputBuffers(0, true);
|
||||
flush();
|
||||
}
|
||||
} else {
|
||||
$response->send();
|
||||
}
|
||||
|
||||
if ($this->kernel instanceof TerminableInterface) {
|
||||
$this->kernel->terminate($this->request, $response);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
33
lib/symfony/runtime/Runner/Symfony/ResponseRunner.php
Normal file
33
lib/symfony/runtime/Runner/Symfony/ResponseRunner.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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\Runtime\Runner\Symfony;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Runtime\RunnerInterface;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ResponseRunner implements RunnerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Response $response,
|
||||
) {
|
||||
}
|
||||
|
||||
public function run(): int
|
||||
{
|
||||
$this->response->send();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
20
lib/symfony/runtime/RunnerInterface.php
Normal file
20
lib/symfony/runtime/RunnerInterface.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?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\Runtime;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
interface RunnerInterface
|
||||
{
|
||||
public function run(): int;
|
||||
}
|
||||
34
lib/symfony/runtime/RuntimeInterface.php
Normal file
34
lib/symfony/runtime/RuntimeInterface.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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\Runtime;
|
||||
|
||||
/**
|
||||
* Enables decoupling applications from global state.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
interface RuntimeInterface
|
||||
{
|
||||
/**
|
||||
* Returns a resolver that should compute the arguments of a callable.
|
||||
*
|
||||
* The callable itself should return an object that represents the application to pass to the getRunner() method.
|
||||
*/
|
||||
public function getResolver(callable $callable, \ReflectionFunction $reflector = null): ResolverInterface;
|
||||
|
||||
/**
|
||||
* Returns a callable that knows how to run the passed object and that returns its exit status as int.
|
||||
*
|
||||
* The passed object is typically created by calling ResolverInterface::resolve().
|
||||
*/
|
||||
public function getRunner(?object $application): RunnerInterface;
|
||||
}
|
||||
226
lib/symfony/runtime/SymfonyRuntime.php
Normal file
226
lib/symfony/runtime/SymfonyRuntime.php
Normal file
@@ -0,0 +1,226 @@
|
||||
<?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\Runtime;
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Dotenv\Dotenv;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\Runtime\Internal\MissingDotenv;
|
||||
use Symfony\Component\Runtime\Internal\SymfonyErrorHandler;
|
||||
use Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner;
|
||||
use Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner;
|
||||
use Symfony\Component\Runtime\Runner\Symfony\ResponseRunner;
|
||||
|
||||
// Help opcache.preload discover always-needed symbols
|
||||
class_exists(MissingDotenv::class, false) || class_exists(Dotenv::class) || class_exists(MissingDotenv::class);
|
||||
|
||||
/**
|
||||
* Knows the basic conventions to run Symfony apps.
|
||||
*
|
||||
* In addition to the options managed by GenericRuntime, it accepts the following options:
|
||||
* - "env" to define the name of the environment the app runs in;
|
||||
* - "disable_dotenv" to disable looking for .env files;
|
||||
* - "dotenv_path" to define the path of dot-env files - defaults to ".env";
|
||||
* - "prod_envs" to define the names of the production envs - defaults to ["prod"];
|
||||
* - "test_envs" to define the names of the test envs - defaults to ["test"];
|
||||
* - "use_putenv" to tell Dotenv to set env vars using putenv() (NOT RECOMMENDED.)
|
||||
* - "dotenv_overload" to tell Dotenv to override existing vars
|
||||
*
|
||||
* When the "debug" / "env" options are not defined, they will fallback to the
|
||||
* "APP_DEBUG" / "APP_ENV" environment variables, and to the "--env|-e" / "--no-debug"
|
||||
* command line arguments if "symfony/console" is installed.
|
||||
*
|
||||
* When the "symfony/dotenv" component is installed, .env files are loaded.
|
||||
* When "symfony/error-handler" is installed, it is registered in debug mode.
|
||||
*
|
||||
* On top of the base arguments provided by GenericRuntime,
|
||||
* this runtime can feed the app-callable with arguments of type:
|
||||
* - Request from "symfony/http-foundation" if the component is installed;
|
||||
* - Application, Command, InputInterface and/or OutputInterface
|
||||
* from "symfony/console" if the component is installed.
|
||||
*
|
||||
* This runtime can handle app-callables that return instances of either:
|
||||
* - HttpKernelInterface,
|
||||
* - Response,
|
||||
* - Application,
|
||||
* - Command,
|
||||
* - int|string|null as handled by GenericRuntime.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class SymfonyRuntime extends GenericRuntime
|
||||
{
|
||||
private readonly ArgvInput $input;
|
||||
private readonly ConsoleOutput $output;
|
||||
private readonly Application $console;
|
||||
private readonly Command $command;
|
||||
|
||||
/**
|
||||
* @param array {
|
||||
* debug?: ?bool,
|
||||
* env?: ?string,
|
||||
* disable_dotenv?: ?bool,
|
||||
* project_dir?: ?string,
|
||||
* prod_envs?: ?string[],
|
||||
* dotenv_path?: ?string,
|
||||
* test_envs?: ?string[],
|
||||
* use_putenv?: ?bool,
|
||||
* runtimes?: ?array,
|
||||
* error_handler?: string|false,
|
||||
* env_var_name?: string,
|
||||
* debug_var_name?: string,
|
||||
* dotenv_overload?: ?bool,
|
||||
* } $options
|
||||
*/
|
||||
public function __construct(array $options = [])
|
||||
{
|
||||
$envKey = $options['env_var_name'] ??= 'APP_ENV';
|
||||
$debugKey = $options['debug_var_name'] ??= 'APP_DEBUG';
|
||||
|
||||
if (isset($options['env'])) {
|
||||
$_SERVER[$envKey] = $options['env'];
|
||||
} elseif (isset($_SERVER['argv']) && class_exists(ArgvInput::class)) {
|
||||
$this->options = $options;
|
||||
$this->getInput();
|
||||
}
|
||||
|
||||
if (!($options['disable_dotenv'] ?? false) && isset($options['project_dir']) && !class_exists(MissingDotenv::class, false)) {
|
||||
(new Dotenv($envKey, $debugKey))
|
||||
->setProdEnvs((array) ($options['prod_envs'] ?? ['prod']))
|
||||
->usePutenv($options['use_putenv'] ?? false)
|
||||
->bootEnv($options['project_dir'].'/'.($options['dotenv_path'] ?? '.env'), 'dev', (array) ($options['test_envs'] ?? ['test']), $options['dotenv_overload'] ?? false);
|
||||
|
||||
if (isset($this->input) && ($options['dotenv_overload'] ?? false)) {
|
||||
if ($this->input->getParameterOption(['--env', '-e'], $_SERVER[$envKey], true) !== $_SERVER[$envKey]) {
|
||||
throw new \LogicException(sprintf('Cannot use "--env" or "-e" when the "%s" file defines "%s" and the "dotenv_overload" runtime option is true.', $options['dotenv_path'] ?? '.env', $envKey));
|
||||
}
|
||||
|
||||
if ($_SERVER[$debugKey] && $this->input->hasParameterOption('--no-debug', true)) {
|
||||
putenv($debugKey.'='.$_SERVER[$debugKey] = $_ENV[$debugKey] = '0');
|
||||
}
|
||||
}
|
||||
|
||||
$options['debug'] ??= '1' === $_SERVER[$debugKey];
|
||||
$options['disable_dotenv'] = true;
|
||||
} else {
|
||||
$_SERVER[$envKey] ??= $_ENV[$envKey] ?? 'dev';
|
||||
$_SERVER[$debugKey] ??= $_ENV[$debugKey] ?? !\in_array($_SERVER[$envKey], (array) ($options['prod_envs'] ?? ['prod']), true);
|
||||
}
|
||||
|
||||
$options['error_handler'] ??= SymfonyErrorHandler::class;
|
||||
|
||||
parent::__construct($options);
|
||||
}
|
||||
|
||||
public function getRunner(?object $application): RunnerInterface
|
||||
{
|
||||
if ($application instanceof HttpKernelInterface) {
|
||||
return new HttpKernelRunner($application, Request::createFromGlobals(), $this->options['debug'] ?? false);
|
||||
}
|
||||
|
||||
if ($application instanceof Response) {
|
||||
return new ResponseRunner($application);
|
||||
}
|
||||
|
||||
if ($application instanceof Command) {
|
||||
$console = $this->console ??= new Application();
|
||||
$console->setName($application->getName() ?: $console->getName());
|
||||
|
||||
if (!$application->getName() || !$console->has($application->getName())) {
|
||||
$application->setName($_SERVER['argv'][0]);
|
||||
$console->add($application);
|
||||
}
|
||||
|
||||
$console->setDefaultCommand($application->getName(), true);
|
||||
$console->getDefinition()->addOptions($application->getDefinition()->getOptions());
|
||||
|
||||
return $this->getRunner($console);
|
||||
}
|
||||
|
||||
if ($application instanceof Application) {
|
||||
if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
|
||||
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
|
||||
}
|
||||
|
||||
set_time_limit(0);
|
||||
$defaultEnv = !isset($this->options['env']) ? ($_SERVER[$this->options['env_var_name']] ?? 'dev') : null;
|
||||
$output = $this->output ??= new ConsoleOutput();
|
||||
|
||||
return new ConsoleApplicationRunner($application, $defaultEnv, $this->getInput(), $output);
|
||||
}
|
||||
|
||||
if (isset($this->command)) {
|
||||
$this->getInput()->bind($this->command->getDefinition());
|
||||
}
|
||||
|
||||
return parent::getRunner($application);
|
||||
}
|
||||
|
||||
protected function getArgument(\ReflectionParameter $parameter, ?string $type): mixed
|
||||
{
|
||||
return match ($type) {
|
||||
Request::class => Request::createFromGlobals(),
|
||||
InputInterface::class => $this->getInput(),
|
||||
OutputInterface::class => $this->output ??= new ConsoleOutput(),
|
||||
Application::class => $this->console ??= new Application(),
|
||||
Command::class => $this->command ??= new Command(),
|
||||
default => parent::getArgument($parameter, $type),
|
||||
};
|
||||
}
|
||||
|
||||
protected static function register(GenericRuntime $runtime): GenericRuntime
|
||||
{
|
||||
$self = new self($runtime->options + ['runtimes' => []]);
|
||||
$self->options['runtimes'] += [
|
||||
HttpKernelInterface::class => $self,
|
||||
Request::class => $self,
|
||||
Response::class => $self,
|
||||
Application::class => $self,
|
||||
Command::class => $self,
|
||||
InputInterface::class => $self,
|
||||
OutputInterface::class => $self,
|
||||
];
|
||||
$runtime->options = $self->options;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
private function getInput(): ArgvInput
|
||||
{
|
||||
if (isset($this->input)) {
|
||||
return $this->input;
|
||||
}
|
||||
|
||||
$input = new ArgvInput();
|
||||
|
||||
if (isset($this->options['env'])) {
|
||||
return $this->input = $input;
|
||||
}
|
||||
|
||||
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
|
||||
putenv($this->options['env_var_name'].'='.$_SERVER[$this->options['env_var_name']] = $_ENV[$this->options['env_var_name']] = $env);
|
||||
}
|
||||
|
||||
if ($input->hasParameterOption('--no-debug', true)) {
|
||||
putenv($this->options['debug_var_name'].'='.$_SERVER[$this->options['debug_var_name']] = $_ENV[$this->options['debug_var_name']] = '0');
|
||||
}
|
||||
|
||||
return $this->input = $input;
|
||||
}
|
||||
}
|
||||
45
lib/symfony/runtime/composer.json
Normal file
45
lib/symfony/runtime/composer.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "symfony/runtime",
|
||||
"type": "composer-plugin",
|
||||
"description": "Enables decoupling PHP applications from global state",
|
||||
"keywords": ["runtime"],
|
||||
"homepage": "https://symfony.com",
|
||||
"license" : "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"composer-plugin-api": "^1.0|^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "^1.0.2|^2.0",
|
||||
"symfony/console": "^5.4.9|^6.0.9|^7.0",
|
||||
"symfony/dotenv": "^5.4|^6.0|^7.0",
|
||||
"symfony/http-foundation": "^5.4|^6.0|^7.0",
|
||||
"symfony/http-kernel": "^5.4|^6.0|^7.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/dotenv": "<5.4"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Runtime\\": "",
|
||||
"Symfony\\Runtime\\Symfony\\Component\\": "Internal/"
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"class": "Symfony\\Component\\Runtime\\Internal\\ComposerPlugin"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user