graph is now being drawn

This commit is contained in:
Julius Herrmann 2021-06-16 18:28:59 +02:00
parent 344af9fecb
commit 0b7f3f2be5
59 changed files with 5019 additions and 28 deletions

View File

@ -8,11 +8,13 @@
"ext-ctype": "*", "ext-ctype": "*",
"ext-iconv": "*", "ext-iconv": "*",
"sensio/framework-extra-bundle": "^6.1", "sensio/framework-extra-bundle": "^6.1",
"symfony/asset": "5.3.*",
"symfony/console": "5.3.*", "symfony/console": "5.3.*",
"symfony/dotenv": "5.3.*", "symfony/dotenv": "5.3.*",
"symfony/flex": "^1.3.1", "symfony/flex": "^1.3.1",
"symfony/framework-bundle": "5.3.*", "symfony/framework-bundle": "5.3.*",
"symfony/maker-bundle": "^1.31", "symfony/maker-bundle": "^1.31",
"symfony/process": "5.3.*",
"symfony/runtime": "5.3.*", "symfony/runtime": "5.3.*",
"symfony/twig-bundle": "5.3.*", "symfony/twig-bundle": "5.3.*",
"symfony/yaml": "5.3.*", "symfony/yaml": "5.3.*",

137
visualizer/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "e6ab63a7664b90c446777a2cda8e8472", "content-hash": "a6f1e8be917c69af3d0bc780bc7c7502",
"packages": [ "packages": [
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
@ -584,6 +584,79 @@
}, },
"time": "2021-05-31T10:40:46+00:00" "time": "2021-05-31T10:40:46+00:00"
}, },
{
"name": "symfony/asset",
"version": "v5.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/asset.git",
"reference": "4c8d354b8931788f2b07953cfe6846e5cda27637"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/asset/zipball/4c8d354b8931788f2b07953cfe6846e5cda27637",
"reference": "4c8d354b8931788f2b07953cfe6846e5cda27637",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1"
},
"conflict": {
"symfony/http-foundation": "<5.3"
},
"require-dev": {
"symfony/http-client": "^4.4|^5.0",
"symfony/http-foundation": "^5.3",
"symfony/http-kernel": "^4.4|^5.0"
},
"suggest": {
"symfony/http-foundation": ""
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Asset\\": ""
},
"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": "Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/asset/tree/v5.3.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"
}
],
"time": "2021-05-26T17:43:10+00:00"
},
{ {
"name": "symfony/cache", "name": "symfony/cache",
"version": "v5.3.0", "version": "v5.3.0",
@ -2605,6 +2678,68 @@
], ],
"time": "2021-05-21T13:25:03+00:00" "time": "2021-05-21T13:25:03+00:00"
}, },
{
"name": "symfony/process",
"version": "v5.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "53e36cb1c160505cdaf1ef201501669c4c317191"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/53e36cb1c160505cdaf1ef201501669c4c317191",
"reference": "53e36cb1c160505cdaf1ef201501669c4c317191",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/polyfill-php80": "^1.15"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"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": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v5.3.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"
}
],
"time": "2021-05-26T12:52:38+00:00"
},
{ {
"name": "symfony/routing", "name": "symfony/routing",
"version": "v5.3.0", "version": "v5.3.0",

View File

@ -0,0 +1,5 @@
#mynetwork {
height: 500px;
width: 500px;
background-color: black;
}

283
visualizer/public/graph.dot Normal file
View File

@ -0,0 +1,283 @@
strict graph {
0;
1;
2;
3;
4;
5;
6;
7;
8;
9;
10;
11;
12;
13;
14;
15;
16;
17;
18;
19;
20;
21;
22;
23;
24;
25;
26;
27;
28;
29;
30;
31;
32;
33;
34;
35;
36;
37;
38;
39;
40;
41;
42;
43;
44;
45;
46;
47;
48;
49;
50;
51;
52;
53;
54;
55;
56;
57;
58;
59;
60;
61;
62;
63;
64;
65;
66;
67;
68;
69;
70;
71;
72;
73;
74;
75;
76;
77;
78;
79;
80;
81;
82;
83;
84;
85;
86;
87;
88;
89;
90;
91;
92;
93;
94;
95;
96;
97;
98;
99;
0 -- 10;
0 -- 1;
1 -- 11;
1 -- 2;
2 -- 12;
2 -- 3;
3 -- 13;
3 -- 4;
4 -- 14;
4 -- 5;
5 -- 15;
5 -- 6;
6 -- 16;
6 -- 7;
7 -- 17;
7 -- 8;
8 -- 18;
8 -- 9;
9 -- 19;
10 -- 20;
10 -- 11;
11 -- 21;
11 -- 12;
12 -- 22;
12 -- 13;
13 -- 23;
13 -- 14;
14 -- 24;
14 -- 15;
15 -- 25;
15 -- 16;
16 -- 26;
16 -- 17;
17 -- 27;
17 -- 18;
18 -- 28;
18 -- 19;
19 -- 29;
20 -- 30;
20 -- 21;
21 -- 31;
21 -- 22;
22 -- 32;
22 -- 23;
23 -- 33;
23 -- 24;
24 -- 34;
24 -- 25;
25 -- 35;
25 -- 26;
26 -- 36;
26 -- 27;
27 -- 37;
27 -- 28;
28 -- 38;
28 -- 29;
29 -- 39;
30 -- 40;
30 -- 31;
31 -- 41;
31 -- 32;
32 -- 42;
32 -- 33;
33 -- 43;
33 -- 34;
34 -- 44;
34 -- 35;
35 -- 45;
35 -- 36;
36 -- 46;
36 -- 37;
37 -- 47;
37 -- 38;
38 -- 48;
38 -- 39;
39 -- 49;
40 -- 50;
40 -- 41;
41 -- 51;
41 -- 42;
42 -- 52;
42 -- 43;
43 -- 53;
43 -- 44;
44 -- 54;
44 -- 45;
45 -- 55;
45 -- 46;
46 -- 56;
46 -- 47;
47 -- 57;
47 -- 48;
48 -- 58;
48 -- 49;
49 -- 59;
50 -- 60;
50 -- 51;
51 -- 61;
51 -- 52;
52 -- 62;
52 -- 53;
53 -- 63;
53 -- 54;
54 -- 64;
54 -- 55;
55 -- 65;
55 -- 56;
56 -- 66;
56 -- 57;
57 -- 67;
57 -- 58;
58 -- 68;
58 -- 59;
59 -- 69;
60 -- 70;
60 -- 61;
61 -- 71;
61 -- 62;
62 -- 72;
62 -- 63;
63 -- 73;
63 -- 64;
64 -- 74;
64 -- 65;
65 -- 75;
65 -- 66;
66 -- 76;
66 -- 67;
67 -- 77;
67 -- 68;
68 -- 78;
68 -- 69;
69 -- 79;
70 -- 80;
70 -- 71;
71 -- 81;
71 -- 72;
72 -- 82;
72 -- 73;
73 -- 83;
73 -- 74;
74 -- 84;
74 -- 75;
75 -- 85;
75 -- 76;
76 -- 86;
76 -- 77;
77 -- 87;
77 -- 78;
78 -- 88;
78 -- 79;
79 -- 89;
80 -- 90;
80 -- 81;
81 -- 91;
81 -- 82;
82 -- 92;
82 -- 83;
83 -- 93;
83 -- 84;
84 -- 94;
84 -- 85;
85 -- 95;
85 -- 86;
86 -- 96;
86 -- 87;
87 -- 97;
87 -- 88;
88 -- 98;
88 -- 89;
89 -- 99;
90 -- 91;
91 -- 92;
92 -- 93;
93 -- 94;
94 -- 95;
95 -- 96;
96 -- 97;
97 -- 98;
98 -- 99;
}

View File

@ -0,0 +1,121 @@
// create an array with nodes
//var nodes = new vis.DataSet([
//{ id: 1, label: "Node 1" },
//{ id: 2, label: "Node 2" },
//{ id: 3, label: "Node 3" },
//{ id: 4, label: "Node 4" },
//{ id: 5, label: "Node 5" }
//]);
//
//// create an array with edges
//var edges = new vis.DataSet([
//{ from: 1, to: 3 },
//{ from: 1, to: 2 },
//{ from: 2, to: 4 },
//{ from: 2, to: 5 },
//{ from: 3, to: 3 }
//]);
// create a network
//var container = document.getElementById("mynetwork");
//var data = {
//nodes: nodes,
//edges: edges
//};
//var options = {
//height: '100%',
//width: '100%',
//};
//var network = new vis.Network(container, data, options);
var network;
var simulationData;
function createGraphFromDot(dotString){
var parsedData = vis.parseDOTNetwork(dotString);
// create a network
var container = document.getElementById("mynetwork");
var data = {
nodes: parsedData.nodes,
edges: parsedData.edges
};
var options = {
height: '100%',
width: '100%',
autoResize: true,
nodes:{
font:{
size:0
},
},
layout: {
randomSeed: undefined,
improvedLayout:true,
clusterThreshold: 150,
//hierarchical: {
//enabled:false,
//levelSeparation: 150,
//nodeSpacing: 100,
//treeSpacing: 200,
//blockShifting: true,
//edgeMinimization: true,
//parentCentralization: true,
//direction: 'UD', // UD, DU, LR, RL
//sortMethod: 'hubsize', // hubsize, directed
//shakeTowards: 'leaves' // roots, leaves
//}
},
};
network = new vis.Network(container, data, options);
//network.on("selectNode", function (params) {
//var selectedNodeId = params.nodes[0];
//var node = network.body.nodes[selectedNodeId];
//node.setOptions({
//font: {
//size: 20
//}
//});
//});
//console.log(network.selectNodes([0]));
n = network.body.nodes[0];
n.setOptions({
color:{
background: "#ffffff",
}
})
}
function visualizeOneStep(step){
for(i = 0; i < step.length; i++){
n = network.body.nodes[i];
//console.log(step[i])
if(step[i][0] == 0){
n.setOptions({
color:{
background: "#0000ff",
}
});
}else{
n.setOptions({
color:{
background: "#ff0000",
}
});
}
}
}
function getSimulation(){
fetch("http://localhost/simulate")
.then(response => response.json())
.then(response =>{
simulationData = response;
createGraphFromDot(simulationData.dotGraph);
//kelvin to celsius
//let temp = Math.ceil(response.main.temp - 273.15);
//document.getElementById("weather").innerHTML = temp + "ºC";
//console.log(response.dotGraph)
});
}
getSimulation()

View File

@ -0,0 +1 @@

View File

@ -1,9 +1,10 @@
import math, random, os, time import math, random, os, time, sys, io
import json
import numpy as np import numpy as np
import networkx as nx import networkx as nx
import scipy import scipy
import time import time
from networkx.drawing.nx_agraph import write_dot from networkx.drawing.nx_pydot import write_dot
def clean_shuffle_graph(G): def clean_shuffle_graph(G):
random_seed_state = int(random.random()*100000) # quick hack to go back to random afterwards random_seed_state = int(random.random()*100000) # quick hack to go back to random afterwards
@ -17,10 +18,9 @@ def clean_shuffle_graph(G):
random.seed(random_seed_state) random.seed(random_seed_state)
return G return G
def gen_sis(G, inf_rate=1.0, rec_rate=2.0, noise=0.1): def gen_sis(G, steps = 1000, inf_rate=1.0, rec_rate=2.0, noise=0.1, statesList = None):
S = [1., 0.] S = [1., 0.]
I = [0., 1.] I = [0., 1.]
steps = 1000 + random.choice(range(1000))
states = [random.choice([S, I]) for i in range(G.number_of_nodes())] states = [random.choice([S, I]) for i in range(G.number_of_nodes())]
for _ in range(steps): for _ in range(steps):
rates = np.zeros(G.number_of_nodes()) rates = np.zeros(G.number_of_nodes())
@ -34,13 +34,35 @@ def gen_sis(G, inf_rate=1.0, rec_rate=2.0, noise=0.1):
jump_time = np.random.exponential(rates) jump_time = np.random.exponential(rates)
change_n = np.argmin(jump_time) change_n = np.argmin(jump_time)
states[change_n] = S if states[change_n] == I else I states[change_n] = S if states[change_n] == I else I
statesList.append(states)
return states return states
statesList = []
steps = 1000 + random.choice(range(1000))
G_grid10x10 = nx.grid_2d_graph(10,10) G_grid10x10 = nx.grid_2d_graph(10,10)
G = clean_shuffle_graph(G_grid10x10) G = clean_shuffle_graph(G_grid10x10)
TS_data = gen_sis(G) TS_data = gen_sis(G, steps=steps,statesList=statesList)
print(G.number_of_nodes()) # print(G.number_of_nodes())
f = open("graph.dot", "w") # f = open("graph.dot", "rw")
# nx.drawing.nx_pydot.write_dot(G,f)
# f.write("\n")
# f.close()
# Writing the json file to stdout
# f = StringIO("")
dotGraph = ""
#Write dot file to string
with io.StringIO() as f:
write_dot(G, f) write_dot(G, f)
f.write("\n") f.seek(0)
f.close() dotGraph = f.read()
output = {
"name" : "testGraph",
"dotGraph" : dotGraph,
"steps" : steps,
"states" : statesList,
}
jsonOutput = json.dumps(output)
print(jsonOutput)

View File

@ -0,0 +1,37 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
class SimulationController extends AbstractController
{
#[Route('/simulation', name: 'simulation')]
public function index(): Response
{
return $this->render('simulation/index.html.twig', [
'controller_name' => 'SimulationController',
]);
}
#[Route('/simulate', name: 'run_simulation')]
public function simulate(): Response
{
$process1 = new Process(['python3', 'python/simulation.py']);
//$process = new Process(['cat', 'python/graph.dot']);
$process1->run();
//$process->run();
// executes after the command finishes
if (!$process1->isSuccessful()) {
throw new ProcessFailedException($process1);
}
$output = $process1->getOutput();
$response = new Response($output);
return $response;
}
}

View File

@ -44,6 +44,9 @@
"config/packages/sensio_framework_extra.yaml" "config/packages/sensio_framework_extra.yaml"
] ]
}, },
"symfony/asset": {
"version": "v5.3.0"
},
"symfony/cache": { "symfony/cache": {
"version": "v5.3.0" "version": "v5.3.0"
}, },
@ -156,6 +159,9 @@
"symfony/polyfill-php81": { "symfony/polyfill-php81": {
"version": "v1.23.0" "version": "v1.23.0"
}, },
"symfony/process": {
"version": "v5.3.0"
},
"symfony/routing": { "symfony/routing": {
"version": "5.3", "version": "5.3",
"recipe": { "recipe": {

View File

@ -15,5 +15,7 @@
</head> </head>
<body> <body>
{% block body %}{% endblock %} {% block body %}{% endblock %}
{% block css%}{% endblock %}
{% block js%}{% endblock %}
</body> </body>
</html> </html>

View File

@ -1,20 +1,18 @@
{% extends 'base.html.twig' %} {% extends 'base.html.twig' %}
{% block title %}Hello MainController!{% endblock %} {% block title %}Hello MainController!{% endblock %}
{% block css%}
{% block body %} <link rel="stylesheet" href="css/main.css">
<style> {% endblock %}
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; } {% block js%}
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; } {# Vis.js plugin #}
</style>
<script type="text/javascript" src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1> <script src="{{ asset('js/main.js') }}"></script>
{% endblock %}
This friendly message is coming from: {% block body %}
<ul>
<li>Your controller at <code><a href="{{ '/var/www/symfony/src/Controller/MainController.php'|file_link(0) }}">src/Controller/MainController.php</a></code></li> <h1>Hello {{ controller_name }}! ✅</h1>
<li>Your template at <code><a href="{{ '/var/www/symfony/templates/main/index.html.twig'|file_link(0) }}">templates/main/index.html.twig</a></code></li> <div id="mynetwork"></div>
</ul>
</div>
{% endblock %} {% endblock %}

View File

@ -0,0 +1,20 @@
{% extends 'base.html.twig' %}
{% block title %}Hello SimulationController!{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1>
This friendly message is coming from:
<ul>
<li>Your controller at <code><a href="{{ '/var/www/symfony/src/Controller/SimulationController.php'|file_link(0) }}">src/Controller/SimulationController.php</a></code></li>
<li>Your template at <code><a href="{{ '/var/www/symfony/templates/simulation/index.html.twig'|file_link(0) }}">templates/simulation/index.html.twig</a></code></li>
</ul>
</div>
{% endblock %}

View File

@ -1,8 +1,8 @@
{% extends 'base.html.twig' %} {% extends 'base.html.twig' %}
{% block title %}Hello TestController!{% endblock %} {% block title %}Hello TestController!{% endblock %}
{% block body %} {% block body %}
<style> <style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; } .example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; } .example-wrapper code { background: #F5F5F5; padding: 2px 6px; }

View File

@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir);
return array( return array(
'App\\Controller\\MainController' => $baseDir . '/src/Controller/MainController.php', 'App\\Controller\\MainController' => $baseDir . '/src/Controller/MainController.php',
'App\\Controller\\SimulationController' => $baseDir . '/src/Controller/SimulationController.php',
'App\\Kernel' => $baseDir . '/src/Kernel.php', 'App\\Kernel' => $baseDir . '/src/Kernel.php',
'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', 'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
@ -605,6 +606,22 @@ return array(
'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\TwigExtension' => $vendorDir . '/symfony/twig-bundle/DependencyInjection/TwigExtension.php', 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\TwigExtension' => $vendorDir . '/symfony/twig-bundle/DependencyInjection/TwigExtension.php',
'Symfony\\Bundle\\TwigBundle\\TemplateIterator' => $vendorDir . '/symfony/twig-bundle/TemplateIterator.php', 'Symfony\\Bundle\\TwigBundle\\TemplateIterator' => $vendorDir . '/symfony/twig-bundle/TemplateIterator.php',
'Symfony\\Bundle\\TwigBundle\\TwigBundle' => $vendorDir . '/symfony/twig-bundle/TwigBundle.php', 'Symfony\\Bundle\\TwigBundle\\TwigBundle' => $vendorDir . '/symfony/twig-bundle/TwigBundle.php',
'Symfony\\Component\\Asset\\Context\\ContextInterface' => $vendorDir . '/symfony/asset/Context/ContextInterface.php',
'Symfony\\Component\\Asset\\Context\\NullContext' => $vendorDir . '/symfony/asset/Context/NullContext.php',
'Symfony\\Component\\Asset\\Context\\RequestStackContext' => $vendorDir . '/symfony/asset/Context/RequestStackContext.php',
'Symfony\\Component\\Asset\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/asset/Exception/ExceptionInterface.php',
'Symfony\\Component\\Asset\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/asset/Exception/InvalidArgumentException.php',
'Symfony\\Component\\Asset\\Exception\\LogicException' => $vendorDir . '/symfony/asset/Exception/LogicException.php',
'Symfony\\Component\\Asset\\Package' => $vendorDir . '/symfony/asset/Package.php',
'Symfony\\Component\\Asset\\PackageInterface' => $vendorDir . '/symfony/asset/PackageInterface.php',
'Symfony\\Component\\Asset\\Packages' => $vendorDir . '/symfony/asset/Packages.php',
'Symfony\\Component\\Asset\\PathPackage' => $vendorDir . '/symfony/asset/PathPackage.php',
'Symfony\\Component\\Asset\\UrlPackage' => $vendorDir . '/symfony/asset/UrlPackage.php',
'Symfony\\Component\\Asset\\VersionStrategy\\EmptyVersionStrategy' => $vendorDir . '/symfony/asset/VersionStrategy/EmptyVersionStrategy.php',
'Symfony\\Component\\Asset\\VersionStrategy\\JsonManifestVersionStrategy' => $vendorDir . '/symfony/asset/VersionStrategy/JsonManifestVersionStrategy.php',
'Symfony\\Component\\Asset\\VersionStrategy\\RemoteJsonManifestVersionStrategy' => $vendorDir . '/symfony/asset/VersionStrategy/RemoteJsonManifestVersionStrategy.php',
'Symfony\\Component\\Asset\\VersionStrategy\\StaticVersionStrategy' => $vendorDir . '/symfony/asset/VersionStrategy/StaticVersionStrategy.php',
'Symfony\\Component\\Asset\\VersionStrategy\\VersionStrategyInterface' => $vendorDir . '/symfony/asset/VersionStrategy/VersionStrategyInterface.php',
'Symfony\\Component\\Cache\\Adapter\\AbstractAdapter' => $vendorDir . '/symfony/cache/Adapter/AbstractAdapter.php', 'Symfony\\Component\\Cache\\Adapter\\AbstractAdapter' => $vendorDir . '/symfony/cache/Adapter/AbstractAdapter.php',
'Symfony\\Component\\Cache\\Adapter\\AbstractTagAwareAdapter' => $vendorDir . '/symfony/cache/Adapter/AbstractTagAwareAdapter.php', 'Symfony\\Component\\Cache\\Adapter\\AbstractTagAwareAdapter' => $vendorDir . '/symfony/cache/Adapter/AbstractTagAwareAdapter.php',
'Symfony\\Component\\Cache\\Adapter\\AdapterInterface' => $vendorDir . '/symfony/cache/Adapter/AdapterInterface.php', 'Symfony\\Component\\Cache\\Adapter\\AdapterInterface' => $vendorDir . '/symfony/cache/Adapter/AdapterInterface.php',
@ -1303,6 +1320,23 @@ return array(
'Symfony\\Component\\HttpKernel\\RebootableInterface' => $vendorDir . '/symfony/http-kernel/RebootableInterface.php', 'Symfony\\Component\\HttpKernel\\RebootableInterface' => $vendorDir . '/symfony/http-kernel/RebootableInterface.php',
'Symfony\\Component\\HttpKernel\\TerminableInterface' => $vendorDir . '/symfony/http-kernel/TerminableInterface.php', 'Symfony\\Component\\HttpKernel\\TerminableInterface' => $vendorDir . '/symfony/http-kernel/TerminableInterface.php',
'Symfony\\Component\\HttpKernel\\UriSigner' => $vendorDir . '/symfony/http-kernel/UriSigner.php', 'Symfony\\Component\\HttpKernel\\UriSigner' => $vendorDir . '/symfony/http-kernel/UriSigner.php',
'Symfony\\Component\\Process\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/process/Exception/ExceptionInterface.php',
'Symfony\\Component\\Process\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/process/Exception/InvalidArgumentException.php',
'Symfony\\Component\\Process\\Exception\\LogicException' => $vendorDir . '/symfony/process/Exception/LogicException.php',
'Symfony\\Component\\Process\\Exception\\ProcessFailedException' => $vendorDir . '/symfony/process/Exception/ProcessFailedException.php',
'Symfony\\Component\\Process\\Exception\\ProcessSignaledException' => $vendorDir . '/symfony/process/Exception/ProcessSignaledException.php',
'Symfony\\Component\\Process\\Exception\\ProcessTimedOutException' => $vendorDir . '/symfony/process/Exception/ProcessTimedOutException.php',
'Symfony\\Component\\Process\\Exception\\RuntimeException' => $vendorDir . '/symfony/process/Exception/RuntimeException.php',
'Symfony\\Component\\Process\\ExecutableFinder' => $vendorDir . '/symfony/process/ExecutableFinder.php',
'Symfony\\Component\\Process\\InputStream' => $vendorDir . '/symfony/process/InputStream.php',
'Symfony\\Component\\Process\\PhpExecutableFinder' => $vendorDir . '/symfony/process/PhpExecutableFinder.php',
'Symfony\\Component\\Process\\PhpProcess' => $vendorDir . '/symfony/process/PhpProcess.php',
'Symfony\\Component\\Process\\Pipes\\AbstractPipes' => $vendorDir . '/symfony/process/Pipes/AbstractPipes.php',
'Symfony\\Component\\Process\\Pipes\\PipesInterface' => $vendorDir . '/symfony/process/Pipes/PipesInterface.php',
'Symfony\\Component\\Process\\Pipes\\UnixPipes' => $vendorDir . '/symfony/process/Pipes/UnixPipes.php',
'Symfony\\Component\\Process\\Pipes\\WindowsPipes' => $vendorDir . '/symfony/process/Pipes/WindowsPipes.php',
'Symfony\\Component\\Process\\Process' => $vendorDir . '/symfony/process/Process.php',
'Symfony\\Component\\Process\\ProcessUtils' => $vendorDir . '/symfony/process/ProcessUtils.php',
'Symfony\\Component\\Routing\\Annotation\\Route' => $vendorDir . '/symfony/routing/Annotation/Route.php', 'Symfony\\Component\\Routing\\Annotation\\Route' => $vendorDir . '/symfony/routing/Annotation/Route.php',
'Symfony\\Component\\Routing\\CompiledRoute' => $vendorDir . '/symfony/routing/CompiledRoute.php', 'Symfony\\Component\\Routing\\CompiledRoute' => $vendorDir . '/symfony/routing/CompiledRoute.php',
'Symfony\\Component\\Routing\\DependencyInjection\\RoutingResolverPass' => $vendorDir . '/symfony/routing/DependencyInjection/RoutingResolverPass.php', 'Symfony\\Component\\Routing\\DependencyInjection\\RoutingResolverPass' => $vendorDir . '/symfony/routing/DependencyInjection/RoutingResolverPass.php',

View File

@ -27,6 +27,7 @@ return array(
'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'), 'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
'Symfony\\Component\\Runtime\\' => array($vendorDir . '/symfony/runtime'), 'Symfony\\Component\\Runtime\\' => array($vendorDir . '/symfony/runtime'),
'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'),
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'), 'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'),
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'), 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
@ -38,6 +39,7 @@ return array(
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'), 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
'Symfony\\Component\\Config\\' => array($vendorDir . '/symfony/config'), 'Symfony\\Component\\Config\\' => array($vendorDir . '/symfony/config'),
'Symfony\\Component\\Cache\\' => array($vendorDir . '/symfony/cache'), 'Symfony\\Component\\Cache\\' => array($vendorDir . '/symfony/cache'),
'Symfony\\Component\\Asset\\' => array($vendorDir . '/symfony/asset'),
'Symfony\\Bundle\\TwigBundle\\' => array($vendorDir . '/symfony/twig-bundle'), 'Symfony\\Bundle\\TwigBundle\\' => array($vendorDir . '/symfony/twig-bundle'),
'Symfony\\Bundle\\MakerBundle\\' => array($vendorDir . '/symfony/maker-bundle/src'), 'Symfony\\Bundle\\MakerBundle\\' => array($vendorDir . '/symfony/maker-bundle/src'),
'Symfony\\Bundle\\FrameworkBundle\\' => array($vendorDir . '/symfony/framework-bundle'), 'Symfony\\Bundle\\FrameworkBundle\\' => array($vendorDir . '/symfony/framework-bundle'),

View File

@ -45,6 +45,7 @@ class ComposerStaticInit2dcfa835a5ae648cafb4734d11460e1d
'Symfony\\Component\\String\\' => 25, 'Symfony\\Component\\String\\' => 25,
'Symfony\\Component\\Runtime\\' => 26, 'Symfony\\Component\\Runtime\\' => 26,
'Symfony\\Component\\Routing\\' => 26, 'Symfony\\Component\\Routing\\' => 26,
'Symfony\\Component\\Process\\' => 26,
'Symfony\\Component\\HttpKernel\\' => 29, 'Symfony\\Component\\HttpKernel\\' => 29,
'Symfony\\Component\\HttpFoundation\\' => 33, 'Symfony\\Component\\HttpFoundation\\' => 33,
'Symfony\\Component\\Finder\\' => 25, 'Symfony\\Component\\Finder\\' => 25,
@ -56,6 +57,7 @@ class ComposerStaticInit2dcfa835a5ae648cafb4734d11460e1d
'Symfony\\Component\\Console\\' => 26, 'Symfony\\Component\\Console\\' => 26,
'Symfony\\Component\\Config\\' => 25, 'Symfony\\Component\\Config\\' => 25,
'Symfony\\Component\\Cache\\' => 24, 'Symfony\\Component\\Cache\\' => 24,
'Symfony\\Component\\Asset\\' => 24,
'Symfony\\Bundle\\TwigBundle\\' => 26, 'Symfony\\Bundle\\TwigBundle\\' => 26,
'Symfony\\Bundle\\MakerBundle\\' => 27, 'Symfony\\Bundle\\MakerBundle\\' => 27,
'Symfony\\Bundle\\FrameworkBundle\\' => 31, 'Symfony\\Bundle\\FrameworkBundle\\' => 31,
@ -168,6 +170,10 @@ class ComposerStaticInit2dcfa835a5ae648cafb4734d11460e1d
array ( array (
0 => __DIR__ . '/..' . '/symfony/routing', 0 => __DIR__ . '/..' . '/symfony/routing',
), ),
'Symfony\\Component\\Process\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/process',
),
'Symfony\\Component\\HttpKernel\\' => 'Symfony\\Component\\HttpKernel\\' =>
array ( array (
0 => __DIR__ . '/..' . '/symfony/http-kernel', 0 => __DIR__ . '/..' . '/symfony/http-kernel',
@ -212,6 +218,10 @@ class ComposerStaticInit2dcfa835a5ae648cafb4734d11460e1d
array ( array (
0 => __DIR__ . '/..' . '/symfony/cache', 0 => __DIR__ . '/..' . '/symfony/cache',
), ),
'Symfony\\Component\\Asset\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/asset',
),
'Symfony\\Bundle\\TwigBundle\\' => 'Symfony\\Bundle\\TwigBundle\\' =>
array ( array (
0 => __DIR__ . '/..' . '/symfony/twig-bundle', 0 => __DIR__ . '/..' . '/symfony/twig-bundle',
@ -276,6 +286,7 @@ class ComposerStaticInit2dcfa835a5ae648cafb4734d11460e1d
public static $classMap = array ( public static $classMap = array (
'App\\Controller\\MainController' => __DIR__ . '/../..' . '/src/Controller/MainController.php', 'App\\Controller\\MainController' => __DIR__ . '/../..' . '/src/Controller/MainController.php',
'App\\Controller\\SimulationController' => __DIR__ . '/../..' . '/src/Controller/SimulationController.php',
'App\\Kernel' => __DIR__ . '/../..' . '/src/Kernel.php', 'App\\Kernel' => __DIR__ . '/../..' . '/src/Kernel.php',
'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
@ -874,6 +885,22 @@ class ComposerStaticInit2dcfa835a5ae648cafb4734d11460e1d
'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\TwigExtension' => __DIR__ . '/..' . '/symfony/twig-bundle/DependencyInjection/TwigExtension.php', 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\TwigExtension' => __DIR__ . '/..' . '/symfony/twig-bundle/DependencyInjection/TwigExtension.php',
'Symfony\\Bundle\\TwigBundle\\TemplateIterator' => __DIR__ . '/..' . '/symfony/twig-bundle/TemplateIterator.php', 'Symfony\\Bundle\\TwigBundle\\TemplateIterator' => __DIR__ . '/..' . '/symfony/twig-bundle/TemplateIterator.php',
'Symfony\\Bundle\\TwigBundle\\TwigBundle' => __DIR__ . '/..' . '/symfony/twig-bundle/TwigBundle.php', 'Symfony\\Bundle\\TwigBundle\\TwigBundle' => __DIR__ . '/..' . '/symfony/twig-bundle/TwigBundle.php',
'Symfony\\Component\\Asset\\Context\\ContextInterface' => __DIR__ . '/..' . '/symfony/asset/Context/ContextInterface.php',
'Symfony\\Component\\Asset\\Context\\NullContext' => __DIR__ . '/..' . '/symfony/asset/Context/NullContext.php',
'Symfony\\Component\\Asset\\Context\\RequestStackContext' => __DIR__ . '/..' . '/symfony/asset/Context/RequestStackContext.php',
'Symfony\\Component\\Asset\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/asset/Exception/ExceptionInterface.php',
'Symfony\\Component\\Asset\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/asset/Exception/InvalidArgumentException.php',
'Symfony\\Component\\Asset\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/asset/Exception/LogicException.php',
'Symfony\\Component\\Asset\\Package' => __DIR__ . '/..' . '/symfony/asset/Package.php',
'Symfony\\Component\\Asset\\PackageInterface' => __DIR__ . '/..' . '/symfony/asset/PackageInterface.php',
'Symfony\\Component\\Asset\\Packages' => __DIR__ . '/..' . '/symfony/asset/Packages.php',
'Symfony\\Component\\Asset\\PathPackage' => __DIR__ . '/..' . '/symfony/asset/PathPackage.php',
'Symfony\\Component\\Asset\\UrlPackage' => __DIR__ . '/..' . '/symfony/asset/UrlPackage.php',
'Symfony\\Component\\Asset\\VersionStrategy\\EmptyVersionStrategy' => __DIR__ . '/..' . '/symfony/asset/VersionStrategy/EmptyVersionStrategy.php',
'Symfony\\Component\\Asset\\VersionStrategy\\JsonManifestVersionStrategy' => __DIR__ . '/..' . '/symfony/asset/VersionStrategy/JsonManifestVersionStrategy.php',
'Symfony\\Component\\Asset\\VersionStrategy\\RemoteJsonManifestVersionStrategy' => __DIR__ . '/..' . '/symfony/asset/VersionStrategy/RemoteJsonManifestVersionStrategy.php',
'Symfony\\Component\\Asset\\VersionStrategy\\StaticVersionStrategy' => __DIR__ . '/..' . '/symfony/asset/VersionStrategy/StaticVersionStrategy.php',
'Symfony\\Component\\Asset\\VersionStrategy\\VersionStrategyInterface' => __DIR__ . '/..' . '/symfony/asset/VersionStrategy/VersionStrategyInterface.php',
'Symfony\\Component\\Cache\\Adapter\\AbstractAdapter' => __DIR__ . '/..' . '/symfony/cache/Adapter/AbstractAdapter.php', 'Symfony\\Component\\Cache\\Adapter\\AbstractAdapter' => __DIR__ . '/..' . '/symfony/cache/Adapter/AbstractAdapter.php',
'Symfony\\Component\\Cache\\Adapter\\AbstractTagAwareAdapter' => __DIR__ . '/..' . '/symfony/cache/Adapter/AbstractTagAwareAdapter.php', 'Symfony\\Component\\Cache\\Adapter\\AbstractTagAwareAdapter' => __DIR__ . '/..' . '/symfony/cache/Adapter/AbstractTagAwareAdapter.php',
'Symfony\\Component\\Cache\\Adapter\\AdapterInterface' => __DIR__ . '/..' . '/symfony/cache/Adapter/AdapterInterface.php', 'Symfony\\Component\\Cache\\Adapter\\AdapterInterface' => __DIR__ . '/..' . '/symfony/cache/Adapter/AdapterInterface.php',
@ -1572,6 +1599,23 @@ class ComposerStaticInit2dcfa835a5ae648cafb4734d11460e1d
'Symfony\\Component\\HttpKernel\\RebootableInterface' => __DIR__ . '/..' . '/symfony/http-kernel/RebootableInterface.php', 'Symfony\\Component\\HttpKernel\\RebootableInterface' => __DIR__ . '/..' . '/symfony/http-kernel/RebootableInterface.php',
'Symfony\\Component\\HttpKernel\\TerminableInterface' => __DIR__ . '/..' . '/symfony/http-kernel/TerminableInterface.php', 'Symfony\\Component\\HttpKernel\\TerminableInterface' => __DIR__ . '/..' . '/symfony/http-kernel/TerminableInterface.php',
'Symfony\\Component\\HttpKernel\\UriSigner' => __DIR__ . '/..' . '/symfony/http-kernel/UriSigner.php', 'Symfony\\Component\\HttpKernel\\UriSigner' => __DIR__ . '/..' . '/symfony/http-kernel/UriSigner.php',
'Symfony\\Component\\Process\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/process/Exception/ExceptionInterface.php',
'Symfony\\Component\\Process\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/process/Exception/InvalidArgumentException.php',
'Symfony\\Component\\Process\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/process/Exception/LogicException.php',
'Symfony\\Component\\Process\\Exception\\ProcessFailedException' => __DIR__ . '/..' . '/symfony/process/Exception/ProcessFailedException.php',
'Symfony\\Component\\Process\\Exception\\ProcessSignaledException' => __DIR__ . '/..' . '/symfony/process/Exception/ProcessSignaledException.php',
'Symfony\\Component\\Process\\Exception\\ProcessTimedOutException' => __DIR__ . '/..' . '/symfony/process/Exception/ProcessTimedOutException.php',
'Symfony\\Component\\Process\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/process/Exception/RuntimeException.php',
'Symfony\\Component\\Process\\ExecutableFinder' => __DIR__ . '/..' . '/symfony/process/ExecutableFinder.php',
'Symfony\\Component\\Process\\InputStream' => __DIR__ . '/..' . '/symfony/process/InputStream.php',
'Symfony\\Component\\Process\\PhpExecutableFinder' => __DIR__ . '/..' . '/symfony/process/PhpExecutableFinder.php',
'Symfony\\Component\\Process\\PhpProcess' => __DIR__ . '/..' . '/symfony/process/PhpProcess.php',
'Symfony\\Component\\Process\\Pipes\\AbstractPipes' => __DIR__ . '/..' . '/symfony/process/Pipes/AbstractPipes.php',
'Symfony\\Component\\Process\\Pipes\\PipesInterface' => __DIR__ . '/..' . '/symfony/process/Pipes/PipesInterface.php',
'Symfony\\Component\\Process\\Pipes\\UnixPipes' => __DIR__ . '/..' . '/symfony/process/Pipes/UnixPipes.php',
'Symfony\\Component\\Process\\Pipes\\WindowsPipes' => __DIR__ . '/..' . '/symfony/process/Pipes/WindowsPipes.php',
'Symfony\\Component\\Process\\Process' => __DIR__ . '/..' . '/symfony/process/Process.php',
'Symfony\\Component\\Process\\ProcessUtils' => __DIR__ . '/..' . '/symfony/process/ProcessUtils.php',
'Symfony\\Component\\Routing\\Annotation\\Route' => __DIR__ . '/..' . '/symfony/routing/Annotation/Route.php', 'Symfony\\Component\\Routing\\Annotation\\Route' => __DIR__ . '/..' . '/symfony/routing/Annotation/Route.php',
'Symfony\\Component\\Routing\\CompiledRoute' => __DIR__ . '/..' . '/symfony/routing/CompiledRoute.php', 'Symfony\\Component\\Routing\\CompiledRoute' => __DIR__ . '/..' . '/symfony/routing/CompiledRoute.php',
'Symfony\\Component\\Routing\\DependencyInjection\\RoutingResolverPass' => __DIR__ . '/..' . '/symfony/routing/DependencyInjection/RoutingResolverPass.php', 'Symfony\\Component\\Routing\\DependencyInjection\\RoutingResolverPass' => __DIR__ . '/..' . '/symfony/routing/DependencyInjection/RoutingResolverPass.php',

View File

@ -605,6 +605,82 @@
}, },
"install-path": "../sensio/framework-extra-bundle" "install-path": "../sensio/framework-extra-bundle"
}, },
{
"name": "symfony/asset",
"version": "v5.3.0",
"version_normalized": "5.3.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/asset.git",
"reference": "4c8d354b8931788f2b07953cfe6846e5cda27637"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/asset/zipball/4c8d354b8931788f2b07953cfe6846e5cda27637",
"reference": "4c8d354b8931788f2b07953cfe6846e5cda27637",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1"
},
"conflict": {
"symfony/http-foundation": "<5.3"
},
"require-dev": {
"symfony/http-client": "^4.4|^5.0",
"symfony/http-foundation": "^5.3",
"symfony/http-kernel": "^4.4|^5.0"
},
"suggest": {
"symfony/http-foundation": ""
},
"time": "2021-05-26T17:43:10+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\Asset\\": ""
},
"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": "Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/asset/tree/v5.3.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/asset"
},
{ {
"name": "symfony/cache", "name": "symfony/cache",
"version": "v5.3.0", "version": "v5.3.0",
@ -2698,6 +2774,71 @@
], ],
"install-path": "../symfony/polyfill-php81" "install-path": "../symfony/polyfill-php81"
}, },
{
"name": "symfony/process",
"version": "v5.3.0",
"version_normalized": "5.3.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "53e36cb1c160505cdaf1ef201501669c4c317191"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/53e36cb1c160505cdaf1ef201501669c4c317191",
"reference": "53e36cb1c160505cdaf1ef201501669c4c317191",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/polyfill-php80": "^1.15"
},
"time": "2021-05-26T12:52:38+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"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": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v5.3.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/process"
},
{ {
"name": "symfony/routing", "name": "symfony/routing",
"version": "v5.3.0", "version": "v5.3.0",

View File

@ -130,6 +130,15 @@
'reference' => '62c5909f49cf74dccdf50a294511cc24be2f969c', 'reference' => '62c5909f49cf74dccdf50a294511cc24be2f969c',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/asset' => array(
'pretty_version' => 'v5.3.0',
'version' => '5.3.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/asset',
'aliases' => array(),
'reference' => '4c8d354b8931788f2b07953cfe6846e5cda27637',
'dev_requirement' => false,
),
'symfony/cache' => array( 'symfony/cache' => array(
'pretty_version' => 'v5.3.0', 'pretty_version' => 'v5.3.0',
'version' => '5.3.0.0', 'version' => '5.3.0.0',
@ -376,6 +385,15 @@
'reference' => 'e66119f3de95efc359483f810c4c3e6436279436', 'reference' => 'e66119f3de95efc359483f810c4c3e6436279436',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/process' => array(
'pretty_version' => 'v5.3.0',
'version' => '5.3.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/process',
'aliases' => array(),
'reference' => '53e36cb1c160505cdaf1ef201501669c4c317191',
'dev_requirement' => false,
),
'symfony/routing' => array( 'symfony/routing' => array(
'pretty_version' => 'v5.3.0', 'pretty_version' => 'v5.3.0',
'version' => '5.3.0.0', 'version' => '5.3.0.0',

View File

@ -0,0 +1,33 @@
CHANGELOG
=========
5.3
---
* deprecated `RemoteJsonManifestVersionStrategy`, use `JsonManifestVersionStrategy` instead.
5.1.0
-----
* added `RemoteJsonManifestVersionStrategy` to download manifest over HTTP.
4.2.0
-----
* added different protocols to be allowed as asset base_urls
3.4.0
-----
* added optional arguments `$basePath` and `$secure` in `RequestStackContext::__construct()`
to provide a default request context in case the stack is empty
3.3.0
-----
* Added `JsonManifestVersionStrategy` as a way to read final,
versioned paths from a JSON manifest file.
2.7.0
-----
* added the component

View 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\Asset\Context;
/**
* Holds information about the current request.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
interface ContextInterface
{
/**
* Gets the base path.
*
* @return string The base path
*/
public function getBasePath();
/**
* Checks whether the request is secure or not.
*
* @return bool true if the request is secure, false otherwise
*/
public function isSecure();
}

View 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\Asset\Context;
/**
* A context that does nothing.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class NullContext implements ContextInterface
{
/**
* {@inheritdoc}
*/
public function getBasePath()
{
return '';
}
/**
* {@inheritdoc}
*/
public function isSecure()
{
return false;
}
}

View File

@ -0,0 +1,57 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\Context;
use Symfony\Component\HttpFoundation\RequestStack;
/**
* Uses a RequestStack to populate the context.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class RequestStackContext implements ContextInterface
{
private $requestStack;
private $basePath;
private $secure;
public function __construct(RequestStack $requestStack, string $basePath = '', bool $secure = false)
{
$this->requestStack = $requestStack;
$this->basePath = $basePath;
$this->secure = $secure;
}
/**
* {@inheritdoc}
*/
public function getBasePath()
{
if (!$request = $this->requestStack->getMainRequest()) {
return $this->basePath;
}
return $request->getBasePath();
}
/**
* {@inheritdoc}
*/
public function isSecure()
{
if (!$request = $this->requestStack->getMainRequest()) {
return $this->secure;
}
return $request->isSecure();
}
}

View 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\Component\Asset\Exception;
/**
* Base ExceptionInterface for the Asset component.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
interface ExceptionInterface extends \Throwable
{
}

View 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\Component\Asset\Exception;
/**
* Base InvalidArgumentException for the Asset component.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}

View 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\Component\Asset\Exception;
/**
* Base LogicException for the Asset component.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class LogicException extends \LogicException implements ExceptionInterface
{
}

19
visualizer/vendor/symfony/asset/LICENSE vendored Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2004-2021 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.

View File

@ -0,0 +1,78 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset;
use Symfony\Component\Asset\Context\ContextInterface;
use Symfony\Component\Asset\Context\NullContext;
use Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface;
/**
* Basic package that adds a version to asset URLs.
*
* @author Kris Wallsmith <kris@symfony.com>
* @author Fabien Potencier <fabien@symfony.com>
*/
class Package implements PackageInterface
{
private $versionStrategy;
private $context;
public function __construct(VersionStrategyInterface $versionStrategy, ContextInterface $context = null)
{
$this->versionStrategy = $versionStrategy;
$this->context = $context ?? new NullContext();
}
/**
* {@inheritdoc}
*/
public function getVersion(string $path)
{
return $this->versionStrategy->getVersion($path);
}
/**
* {@inheritdoc}
*/
public function getUrl(string $path)
{
if ($this->isAbsoluteUrl($path)) {
return $path;
}
return $this->versionStrategy->applyVersion($path);
}
/**
* @return ContextInterface
*/
protected function getContext()
{
return $this->context;
}
/**
* @return VersionStrategyInterface
*/
protected function getVersionStrategy()
{
return $this->versionStrategy;
}
/**
* @return bool
*/
protected function isAbsoluteUrl(string $url)
{
return false !== strpos($url, '://') || '//' === substr($url, 0, 2);
}
}

View 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\Asset;
/**
* Asset package interface.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
interface PackageInterface
{
/**
* Returns the asset version for an asset.
*
* @return string The version string
*/
public function getVersion(string $path);
/**
* Returns an absolute or root-relative public path.
*
* @return string The public path
*/
public function getUrl(string $path);
}

View File

@ -0,0 +1,104 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset;
use Symfony\Component\Asset\Exception\InvalidArgumentException;
use Symfony\Component\Asset\Exception\LogicException;
/**
* Helps manage asset URLs.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Kris Wallsmith <kris@symfony.com>
*/
class Packages
{
private $defaultPackage;
private $packages = [];
/**
* @param PackageInterface[] $packages Additional packages indexed by name
*/
public function __construct(PackageInterface $defaultPackage = null, iterable $packages = [])
{
$this->defaultPackage = $defaultPackage;
foreach ($packages as $name => $package) {
$this->addPackage($name, $package);
}
}
public function setDefaultPackage(PackageInterface $defaultPackage)
{
$this->defaultPackage = $defaultPackage;
}
public function addPackage(string $name, PackageInterface $package)
{
$this->packages[$name] = $package;
}
/**
* Returns an asset package.
*
* @param string $name The name of the package or null for the default package
*
* @return PackageInterface An asset package
*
* @throws InvalidArgumentException If there is no package by that name
* @throws LogicException If no default package is defined
*/
public function getPackage(string $name = null)
{
if (null === $name) {
if (null === $this->defaultPackage) {
throw new LogicException('There is no default asset package, configure one first.');
}
return $this->defaultPackage;
}
if (!isset($this->packages[$name])) {
throw new InvalidArgumentException(sprintf('There is no "%s" asset package.', $name));
}
return $this->packages[$name];
}
/**
* Gets the version to add to public URL.
*
* @param string $path A public path
* @param string $packageName A package name
*
* @return string The current version
*/
public function getVersion(string $path, string $packageName = null)
{
return $this->getPackage($packageName)->getVersion($path);
}
/**
* Returns the public path.
*
* Absolute paths (i.e. http://...) are returned unmodified.
*
* @param string $path A public path
* @param string $packageName The name of the asset package to use
*
* @return string A public path which takes into account the base path and URL path
*/
public function getUrl(string $path, string $packageName = null)
{
return $this->getPackage($packageName)->getUrl($path);
}
}

View File

@ -0,0 +1,73 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset;
use Symfony\Component\Asset\Context\ContextInterface;
use Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface;
/**
* Package that adds a base path to asset URLs in addition to a version.
*
* In addition to the provided base path, this package also automatically
* prepends the current request base path if a Context is available to
* allow a website to be hosted easily under any given path under the Web
* Server root directory.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class PathPackage extends Package
{
private $basePath;
/**
* @param string $basePath The base path to be prepended to relative paths
*/
public function __construct(string $basePath, VersionStrategyInterface $versionStrategy, ContextInterface $context = null)
{
parent::__construct($versionStrategy, $context);
if (!$basePath) {
$this->basePath = '/';
} else {
if ('/' != $basePath[0]) {
$basePath = '/'.$basePath;
}
$this->basePath = rtrim($basePath, '/').'/';
}
}
/**
* {@inheritdoc}
*/
public function getUrl(string $path)
{
$versionedPath = parent::getUrl($path);
// if absolute or begins with /, we're done
if ($this->isAbsoluteUrl($versionedPath) || ($versionedPath && '/' === $versionedPath[0])) {
return $versionedPath;
}
return $this->getBasePath().ltrim($versionedPath, '/');
}
/**
* Returns the base path.
*
* @return string The base path
*/
public function getBasePath()
{
return $this->getContext()->getBasePath().$this->basePath;
}
}

View File

@ -0,0 +1,14 @@
Asset Component
===============
The Asset component manages URL generation and versioning of web assets such as
CSS stylesheets, JavaScript files and image files.
Resources
---------
* [Documentation](https://symfony.com/doc/current/components/asset/introduction.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)

View File

@ -0,0 +1,133 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset;
use Symfony\Component\Asset\Context\ContextInterface;
use Symfony\Component\Asset\Exception\InvalidArgumentException;
use Symfony\Component\Asset\Exception\LogicException;
use Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface;
/**
* Package that adds a base URL to asset URLs in addition to a version.
*
* The package allows to use more than one base URLs in which case
* it randomly chooses one for each asset; it also guarantees that
* any given path will always use the same base URL to be nice with
* HTTP caching mechanisms.
*
* When the request context is available, this package can choose the
* best base URL to use based on the current request scheme:
*
* * For HTTP request, it chooses between all base URLs;
* * For HTTPs requests, it chooses between HTTPs base URLs and relative protocol URLs
* or falls back to any base URL if no secure ones are available.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class UrlPackage extends Package
{
private $baseUrls = [];
private $sslPackage;
/**
* @param string|string[] $baseUrls Base asset URLs
*/
public function __construct($baseUrls, VersionStrategyInterface $versionStrategy, ContextInterface $context = null)
{
parent::__construct($versionStrategy, $context);
if (!\is_array($baseUrls)) {
$baseUrls = (array) $baseUrls;
}
if (!$baseUrls) {
throw new LogicException('You must provide at least one base URL.');
}
foreach ($baseUrls as $baseUrl) {
$this->baseUrls[] = rtrim($baseUrl, '/');
}
$sslUrls = $this->getSslUrls($baseUrls);
if ($sslUrls && $baseUrls !== $sslUrls) {
$this->sslPackage = new self($sslUrls, $versionStrategy);
}
}
/**
* {@inheritdoc}
*/
public function getUrl(string $path)
{
if ($this->isAbsoluteUrl($path)) {
return $path;
}
if (null !== $this->sslPackage && $this->getContext()->isSecure()) {
return $this->sslPackage->getUrl($path);
}
$url = $this->getVersionStrategy()->applyVersion($path);
if ($this->isAbsoluteUrl($url)) {
return $url;
}
if ($url && '/' != $url[0]) {
$url = '/'.$url;
}
return $this->getBaseUrl($path).$url;
}
/**
* Returns the base URL for a path.
*
* @return string The base URL
*/
public function getBaseUrl(string $path)
{
if (1 === \count($this->baseUrls)) {
return $this->baseUrls[0];
}
return $this->baseUrls[$this->chooseBaseUrl($path)];
}
/**
* Determines which base URL to use for the given path.
*
* Override this method to change the default distribution strategy.
* This method should always return the same base URL index for a given path.
*
* @return int The base URL index for the given path
*/
protected function chooseBaseUrl(string $path)
{
return (int) fmod(hexdec(substr(hash('sha256', $path), 0, 10)), \count($this->baseUrls));
}
private function getSslUrls(array $urls)
{
$sslUrls = [];
foreach ($urls as $url) {
if ('https://' === substr($url, 0, 8) || '//' === substr($url, 0, 2)) {
$sslUrls[] = $url;
} elseif (null === parse_url($url, \PHP_URL_SCHEME)) {
throw new InvalidArgumentException(sprintf('"%s" is not a valid URL.', $url));
}
}
return $sslUrls;
}
}

View 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\Asset\VersionStrategy;
/**
* Disable version for all assets.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class EmptyVersionStrategy implements VersionStrategyInterface
{
/**
* {@inheritdoc}
*/
public function getVersion(string $path)
{
return '';
}
/**
* {@inheritdoc}
*/
public function applyVersion(string $path)
{
return $path;
}
}

View File

@ -0,0 +1,87 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\VersionStrategy;
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* Reads the versioned path of an asset from a JSON manifest file.
*
* For example, the manifest file might look like this:
* {
* "main.js": "main.abc123.js",
* "css/styles.css": "css/styles.555abc.css"
* }
*
* You could then ask for the version of "main.js" or "css/styles.css".
*/
class JsonManifestVersionStrategy implements VersionStrategyInterface
{
private $manifestPath;
private $manifestData;
private $httpClient;
/**
* @param string $manifestPath Absolute path to the manifest file
*/
public function __construct(string $manifestPath, HttpClientInterface $httpClient = null)
{
$this->manifestPath = $manifestPath;
$this->httpClient = $httpClient;
if (null === $this->httpClient && 0 === strpos(parse_url($this->manifestPath, \PHP_URL_SCHEME), 'http')) {
throw new \LogicException(sprintf('The "%s" class needs an HTTP client to use a remote manifest. Try running "composer require symfony/http-client".', self::class));
}
}
/**
* With a manifest, we don't really know or care about what
* the version is. Instead, this returns the path to the
* versioned file.
*/
public function getVersion(string $path)
{
return $this->applyVersion($path);
}
public function applyVersion(string $path)
{
return $this->getManifestPath($path) ?: $path;
}
private function getManifestPath(string $path): ?string
{
if (null === $this->manifestData) {
if (null !== $this->httpClient && 0 === strpos(parse_url($this->manifestPath, \PHP_URL_SCHEME), 'http')) {
try {
$this->manifestData = $this->httpClient->request('GET', $this->manifestPath, [
'headers' => ['accept' => 'application/json'],
])->toArray();
} catch (DecodingExceptionInterface $e) {
throw new \RuntimeException(sprintf('Error parsing JSON from asset manifest URL "%s".', $this->manifestPath), 0, $e);
}
} else {
if (!is_file($this->manifestPath)) {
throw new \RuntimeException(sprintf('Asset manifest file "%s" does not exist.', $this->manifestPath));
}
$this->manifestData = json_decode(file_get_contents($this->manifestPath), true);
if (0 < json_last_error()) {
throw new \RuntimeException(sprintf('Error parsing JSON from asset manifest file "%s": ', $this->manifestPath).json_last_error_msg());
}
}
}
return $this->manifestData[$path] ?? null;
}
}

View File

@ -0,0 +1,66 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\VersionStrategy;
use Symfony\Contracts\HttpClient\HttpClientInterface;
trigger_deprecation('symfony/asset', '5.3', 'The "%s" class is deprecated, use "%s" instead.', RemoteJsonManifestVersionStrategy::class, JsonManifestVersionStrategy::class);
/**
* Reads the versioned path of an asset from a remote JSON manifest file.
*
* For example, the manifest file might look like this:
* {
* "main.js": "main.abc123.js",
* "css/styles.css": "css/styles.555abc.css"
* }
*
* You could then ask for the version of "main.js" or "css/styles.css".
*
* @deprecated since Symfony 5.3, use JsonManifestVersionStrategy instead.
*/
class RemoteJsonManifestVersionStrategy implements VersionStrategyInterface
{
private $manifestData;
private $manifestUrl;
private $httpClient;
/**
* @param string $manifestUrl Absolute URL to the manifest file
*/
public function __construct(string $manifestUrl, HttpClientInterface $httpClient)
{
$this->manifestUrl = $manifestUrl;
$this->httpClient = $httpClient;
}
/**
* With a manifest, we don't really know or care about what
* the version is. Instead, this returns the path to the
* versioned file.
*/
public function getVersion(string $path)
{
return $this->applyVersion($path);
}
public function applyVersion(string $path)
{
if (null === $this->manifestData) {
$this->manifestData = $this->httpClient->request('GET', $this->manifestUrl, [
'headers' => ['accept' => 'application/json'],
])->toArray();
}
return $this->manifestData[$path] ?? $path;
}
}

View File

@ -0,0 +1,55 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\VersionStrategy;
/**
* Returns the same version for all assets.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class StaticVersionStrategy implements VersionStrategyInterface
{
private $version;
private $format;
/**
* @param string $version Version number
* @param string $format Url format
*/
public function __construct(string $version, string $format = null)
{
$this->version = $version;
$this->format = $format ?: '%s?%s';
}
/**
* {@inheritdoc}
*/
public function getVersion(string $path)
{
return $this->version;
}
/**
* {@inheritdoc}
*/
public function applyVersion(string $path)
{
$versionized = sprintf($this->format, ltrim($path, '/'), $this->getVersion($path));
if ($path && '/' == $path[0]) {
return '/'.$versionized;
}
return $versionized;
}
}

View 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\Asset\VersionStrategy;
/**
* Asset version strategy interface.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
interface VersionStrategyInterface
{
/**
* Returns the asset version for an asset.
*
* @return string The version string
*/
public function getVersion(string $path);
/**
* Applies version to the supplied path.
*
* @return string The versionized path
*/
public function applyVersion(string $path);
}

View File

@ -0,0 +1,40 @@
{
"name": "symfony/asset",
"type": "library",
"description": "Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files",
"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": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1"
},
"suggest": {
"symfony/http-foundation": ""
},
"require-dev": {
"symfony/http-client": "^4.4|^5.0",
"symfony/http-foundation": "^5.3",
"symfony/http-kernel": "^4.4|^5.0"
},
"conflict": {
"symfony/http-foundation": "<5.3"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Asset\\": "" },
"exclude-from-classmap": [
"/Tests/"
]
},
"minimum-stability": "dev"
}

View File

@ -0,0 +1,116 @@
CHANGELOG
=========
5.2.0
-----
* added `Process::setOptions()` to set `Process` specific options
* added option `create_new_console` to allow a subprocess to continue
to run after the main script exited, both on Linux and on Windows
5.1.0
-----
* added `Process::getStartTime()` to retrieve the start time of the process as float
5.0.0
-----
* removed `Process::inheritEnvironmentVariables()`
* removed `PhpProcess::setPhpBinary()`
* `Process` must be instantiated with a command array, use `Process::fromShellCommandline()` when the command should be parsed by the shell
* removed `Process::setCommandLine()`
4.4.0
-----
* deprecated `Process::inheritEnvironmentVariables()`: env variables are always inherited.
* added `Process::getLastOutputTime()` method
4.2.0
-----
* added the `Process::fromShellCommandline()` to run commands in a shell wrapper
* deprecated passing a command as string when creating a `Process` instance
* deprecated the `Process::setCommandline()` and the `PhpProcess::setPhpBinary()` methods
* added the `Process::waitUntil()` method to wait for the process only for a
specific output, then continue the normal execution of your application
4.1.0
-----
* added the `Process::isTtySupported()` method that allows to check for TTY support
* made `PhpExecutableFinder` look for the `PHP_BINARY` env var when searching the php binary
* added the `ProcessSignaledException` class to properly catch signaled process errors
4.0.0
-----
* environment variables will always be inherited
* added a second `array $env = []` argument to the `start()`, `run()`,
`mustRun()`, and `restart()` methods of the `Process` class
* added a second `array $env = []` argument to the `start()` method of the
`PhpProcess` class
* the `ProcessUtils::escapeArgument()` method has been removed
* the `areEnvironmentVariablesInherited()`, `getOptions()`, and `setOptions()`
methods of the `Process` class have been removed
* support for passing `proc_open()` options has been removed
* removed the `ProcessBuilder` class, use the `Process` class instead
* removed the `getEnhanceWindowsCompatibility()` and `setEnhanceWindowsCompatibility()` methods of the `Process` class
* passing a not existing working directory to the constructor of the `Symfony\Component\Process\Process` class is not
supported anymore
3.4.0
-----
* deprecated the ProcessBuilder class
* deprecated calling `Process::start()` without setting a valid working directory beforehand (via `setWorkingDirectory()` or constructor)
3.3.0
-----
* added command line arrays in the `Process` class
* added `$env` argument to `Process::start()`, `run()`, `mustRun()` and `restart()` methods
* deprecated the `ProcessUtils::escapeArgument()` method
* deprecated not inheriting environment variables
* deprecated configuring `proc_open()` options
* deprecated configuring enhanced Windows compatibility
* deprecated configuring enhanced sigchild compatibility
2.5.0
-----
* added support for PTY mode
* added the convenience method "mustRun"
* deprecation: Process::setStdin() is deprecated in favor of Process::setInput()
* deprecation: Process::getStdin() is deprecated in favor of Process::getInput()
* deprecation: Process::setInput() and ProcessBuilder::setInput() do not accept non-scalar types
2.4.0
-----
* added the ability to define an idle timeout
2.3.0
-----
* added ProcessUtils::escapeArgument() to fix the bug in escapeshellarg() function on Windows
* added Process::signal()
* added Process::getPid()
* added support for a TTY mode
2.2.0
-----
* added ProcessBuilder::setArguments() to reset the arguments on a builder
* added a way to retrieve the standard and error output incrementally
* added Process:restart()
2.1.0
-----
* added support for non-blocking processes (start(), wait(), isRunning(), stop())
* enhanced Windows compatibility
* added Process::getExitCodeText() that returns a string representation for
the exit code returned by the process
* added ProcessBuilder

View 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\Component\Process\Exception;
/**
* Marker Interface for the Process Component.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
interface ExceptionInterface extends \Throwable
{
}

View 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\Component\Process\Exception;
/**
* InvalidArgumentException for the Process Component.
*
* @author Romain Neutron <imprec@gmail.com>
*/
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}

View 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\Component\Process\Exception;
/**
* LogicException for the Process Component.
*
* @author Romain Neutron <imprec@gmail.com>
*/
class LogicException extends \LogicException implements ExceptionInterface
{
}

View File

@ -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\Component\Process\Exception;
use Symfony\Component\Process\Process;
/**
* Exception for failed processes.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class ProcessFailedException extends RuntimeException
{
private $process;
public function __construct(Process $process)
{
if ($process->isSuccessful()) {
throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
}
$error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
$process->getCommandLine(),
$process->getExitCode(),
$process->getExitCodeText(),
$process->getWorkingDirectory()
);
if (!$process->isOutputDisabled()) {
$error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
$process->getOutput(),
$process->getErrorOutput()
);
}
parent::__construct($error);
$this->process = $process;
}
public function getProcess()
{
return $this->process;
}
}

View File

@ -0,0 +1,41 @@
<?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\Process\Exception;
use Symfony\Component\Process\Process;
/**
* Exception that is thrown when a process has been signaled.
*
* @author Sullivan Senechal <soullivaneuh@gmail.com>
*/
final class ProcessSignaledException extends RuntimeException
{
private $process;
public function __construct(Process $process)
{
$this->process = $process;
parent::__construct(sprintf('The process has been signaled with signal "%s".', $process->getTermSignal()));
}
public function getProcess(): Process
{
return $this->process;
}
public function getSignal(): int
{
return $this->getProcess()->getTermSignal();
}
}

View File

@ -0,0 +1,69 @@
<?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\Process\Exception;
use Symfony\Component\Process\Process;
/**
* Exception that is thrown when a process times out.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class ProcessTimedOutException extends RuntimeException
{
public const TYPE_GENERAL = 1;
public const TYPE_IDLE = 2;
private $process;
private $timeoutType;
public function __construct(Process $process, int $timeoutType)
{
$this->process = $process;
$this->timeoutType = $timeoutType;
parent::__construct(sprintf(
'The process "%s" exceeded the timeout of %s seconds.',
$process->getCommandLine(),
$this->getExceededTimeout()
));
}
public function getProcess()
{
return $this->process;
}
public function isGeneralTimeout()
{
return self::TYPE_GENERAL === $this->timeoutType;
}
public function isIdleTimeout()
{
return self::TYPE_IDLE === $this->timeoutType;
}
public function getExceededTimeout()
{
switch ($this->timeoutType) {
case self::TYPE_GENERAL:
return $this->process->getTimeout();
case self::TYPE_IDLE:
return $this->process->getIdleTimeout();
default:
throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
}
}
}

View 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\Component\Process\Exception;
/**
* RuntimeException for the Process Component.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}

View File

@ -0,0 +1,86 @@
<?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\Process;
/**
* Generic executable finder.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class ExecutableFinder
{
private $suffixes = ['.exe', '.bat', '.cmd', '.com'];
/**
* Replaces default suffixes of executable.
*/
public function setSuffixes(array $suffixes)
{
$this->suffixes = $suffixes;
}
/**
* Adds new possible suffix to check for executable.
*/
public function addSuffix(string $suffix)
{
$this->suffixes[] = $suffix;
}
/**
* Finds an executable by name.
*
* @param string $name The executable name (without the extension)
* @param string|null $default The default to return if no executable is found
* @param array $extraDirs Additional dirs to check into
*
* @return string|null The executable path or default value
*/
public function find(string $name, string $default = null, array $extraDirs = [])
{
if (ini_get('open_basedir')) {
$searchPath = array_merge(explode(\PATH_SEPARATOR, ini_get('open_basedir')), $extraDirs);
$dirs = [];
foreach ($searchPath as $path) {
// Silencing against https://bugs.php.net/69240
if (@is_dir($path)) {
$dirs[] = $path;
} else {
if (basename($path) == $name && @is_executable($path)) {
return $path;
}
}
}
} else {
$dirs = array_merge(
explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
$extraDirs
);
}
$suffixes = [''];
if ('\\' === \DIRECTORY_SEPARATOR) {
$pathExt = getenv('PATHEXT');
$suffixes = array_merge($pathExt ? explode(\PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
}
foreach ($suffixes as $suffix) {
foreach ($dirs as $dir) {
if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
return $file;
}
}
}
return $default;
}
}

View File

@ -0,0 +1,93 @@
<?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\Process;
use Symfony\Component\Process\Exception\RuntimeException;
/**
* Provides a way to continuously write to the input of a Process until the InputStream is closed.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class InputStream implements \IteratorAggregate
{
/** @var callable|null */
private $onEmpty = null;
private $input = [];
private $open = true;
/**
* Sets a callback that is called when the write buffer becomes empty.
*/
public function onEmpty(callable $onEmpty = null)
{
$this->onEmpty = $onEmpty;
}
/**
* Appends an input to the write buffer.
*
* @param resource|string|int|float|bool|\Traversable|null $input The input to append as scalar,
* stream resource or \Traversable
*/
public function write($input)
{
if (null === $input) {
return;
}
if ($this->isClosed()) {
throw new RuntimeException(sprintf('"%s" is closed.', static::class));
}
$this->input[] = ProcessUtils::validateInput(__METHOD__, $input);
}
/**
* Closes the write buffer.
*/
public function close()
{
$this->open = false;
}
/**
* Tells whether the write buffer is closed or not.
*/
public function isClosed()
{
return !$this->open;
}
/**
* @return \Traversable
*/
public function getIterator()
{
$this->open = true;
while ($this->open || $this->input) {
if (!$this->input) {
yield '';
continue;
}
$current = array_shift($this->input);
if ($current instanceof \Iterator) {
yield from $current;
} else {
yield $current;
}
if (!$this->input && $this->open && null !== $onEmpty = $this->onEmpty) {
$this->write($onEmpty($this));
}
}
}
}

View File

@ -0,0 +1,19 @@
Copyright (c) 2004-2021 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.

View File

@ -0,0 +1,99 @@
<?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\Process;
/**
* An executable finder specifically designed for the PHP executable.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class PhpExecutableFinder
{
private $executableFinder;
public function __construct()
{
$this->executableFinder = new ExecutableFinder();
}
/**
* Finds The PHP executable.
*
* @return string|false The PHP executable path or false if it cannot be found
*/
public function find(bool $includeArgs = true)
{
if ($php = getenv('PHP_BINARY')) {
if (!is_executable($php)) {
$command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v';
if ($php = strtok(exec($command.' '.escapeshellarg($php)), \PHP_EOL)) {
if (!is_executable($php)) {
return false;
}
} else {
return false;
}
}
return $php;
}
$args = $this->findArguments();
$args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
// PHP_BINARY return the current sapi executable
if (\PHP_BINARY && \in_array(\PHP_SAPI, ['cgi-fcgi', 'cli', 'cli-server', 'phpdbg'], true)) {
return \PHP_BINARY.$args;
}
if ($php = getenv('PHP_PATH')) {
if (!@is_executable($php)) {
return false;
}
return $php;
}
if ($php = getenv('PHP_PEAR_PHP_BIN')) {
if (@is_executable($php)) {
return $php;
}
}
if (@is_executable($php = \PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
return $php;
}
$dirs = [\PHP_BINDIR];
if ('\\' === \DIRECTORY_SEPARATOR) {
$dirs[] = 'C:\xampp\php\\';
}
return $this->executableFinder->find('php', false, $dirs);
}
/**
* Finds the PHP executable arguments.
*
* @return array The PHP executable arguments
*/
public function findArguments()
{
$arguments = [];
if ('phpdbg' === \PHP_SAPI) {
$arguments[] = '-qrr';
}
return $arguments;
}
}

View 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\Component\Process;
use Symfony\Component\Process\Exception\LogicException;
use Symfony\Component\Process\Exception\RuntimeException;
/**
* PhpProcess runs a PHP script in an independent process.
*
* $p = new PhpProcess('<?php echo "foo"; ?>');
* $p->run();
* print $p->getOutput()."\n";
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class PhpProcess extends Process
{
/**
* @param string $script The PHP script to run (as a string)
* @param string|null $cwd The working directory or null to use the working dir of the current PHP process
* @param array|null $env The environment variables or null to use the same environment as the current PHP process
* @param int $timeout The timeout in seconds
* @param array|null $php Path to the PHP binary to use with any additional arguments
*/
public function __construct(string $script, string $cwd = null, array $env = null, int $timeout = 60, array $php = null)
{
if (null === $php) {
$executableFinder = new PhpExecutableFinder();
$php = $executableFinder->find(false);
$php = false === $php ? null : array_merge([$php], $executableFinder->findArguments());
}
if ('phpdbg' === \PHP_SAPI) {
$file = tempnam(sys_get_temp_dir(), 'dbg');
file_put_contents($file, $script);
register_shutdown_function('unlink', $file);
$php[] = $file;
$script = null;
}
parent::__construct($php, $cwd, $env, $script, $timeout);
}
/**
* {@inheritdoc}
*/
public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
{
throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
}
/**
* {@inheritdoc}
*/
public function start(callable $callback = null, array $env = [])
{
if (null === $this->getCommandLine()) {
throw new RuntimeException('Unable to find the PHP executable.');
}
parent::start($callback, $env);
}
}

View File

@ -0,0 +1,178 @@
<?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\Process\Pipes;
use Symfony\Component\Process\Exception\InvalidArgumentException;
/**
* @author Romain Neutron <imprec@gmail.com>
*
* @internal
*/
abstract class AbstractPipes implements PipesInterface
{
public $pipes = [];
private $inputBuffer = '';
private $input;
private $blocked = true;
private $lastError;
/**
* @param resource|string|int|float|bool|\Iterator|null $input
*/
public function __construct($input)
{
if (\is_resource($input) || $input instanceof \Iterator) {
$this->input = $input;
} elseif (\is_string($input)) {
$this->inputBuffer = $input;
} else {
$this->inputBuffer = (string) $input;
}
}
/**
* {@inheritdoc}
*/
public function close()
{
foreach ($this->pipes as $pipe) {
fclose($pipe);
}
$this->pipes = [];
}
/**
* Returns true if a system call has been interrupted.
*/
protected function hasSystemCallBeenInterrupted(): bool
{
$lastError = $this->lastError;
$this->lastError = null;
// stream_select returns false when the `select` system call is interrupted by an incoming signal
return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
}
/**
* Unblocks streams.
*/
protected function unblock()
{
if (!$this->blocked) {
return;
}
foreach ($this->pipes as $pipe) {
stream_set_blocking($pipe, 0);
}
if (\is_resource($this->input)) {
stream_set_blocking($this->input, 0);
}
$this->blocked = false;
}
/**
* Writes input to stdin.
*
* @throws InvalidArgumentException When an input iterator yields a non supported value
*/
protected function write(): ?array
{
if (!isset($this->pipes[0])) {
return null;
}
$input = $this->input;
if ($input instanceof \Iterator) {
if (!$input->valid()) {
$input = null;
} elseif (\is_resource($input = $input->current())) {
stream_set_blocking($input, 0);
} elseif (!isset($this->inputBuffer[0])) {
if (!\is_string($input)) {
if (!is_scalar($input)) {
throw new InvalidArgumentException(sprintf('"%s" yielded a value of type "%s", but only scalars and stream resources are supported.', get_debug_type($this->input), get_debug_type($input)));
}
$input = (string) $input;
}
$this->inputBuffer = $input;
$this->input->next();
$input = null;
} else {
$input = null;
}
}
$r = $e = [];
$w = [$this->pipes[0]];
// let's have a look if something changed in streams
if (false === @stream_select($r, $w, $e, 0, 0)) {
return null;
}
foreach ($w as $stdin) {
if (isset($this->inputBuffer[0])) {
$written = fwrite($stdin, $this->inputBuffer);
$this->inputBuffer = substr($this->inputBuffer, $written);
if (isset($this->inputBuffer[0])) {
return [$this->pipes[0]];
}
}
if ($input) {
for (;;) {
$data = fread($input, self::CHUNK_SIZE);
if (!isset($data[0])) {
break;
}
$written = fwrite($stdin, $data);
$data = substr($data, $written);
if (isset($data[0])) {
$this->inputBuffer = $data;
return [$this->pipes[0]];
}
}
if (feof($input)) {
if ($this->input instanceof \Iterator) {
$this->input->next();
} else {
$this->input = null;
}
}
}
}
// no input to read on resource, buffer is empty
if (!isset($this->inputBuffer[0]) && !($this->input instanceof \Iterator ? $this->input->valid() : $this->input)) {
$this->input = null;
fclose($this->pipes[0]);
unset($this->pipes[0]);
} elseif (!$w) {
return [$this->pipes[0]];
}
return null;
}
/**
* @internal
*/
public function handleError($type, $msg)
{
$this->lastError = $msg;
}
}

View File

@ -0,0 +1,61 @@
<?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\Process\Pipes;
/**
* PipesInterface manages descriptors and pipes for the use of proc_open.
*
* @author Romain Neutron <imprec@gmail.com>
*
* @internal
*/
interface PipesInterface
{
public const CHUNK_SIZE = 16384;
/**
* Returns an array of descriptors for the use of proc_open.
*/
public function getDescriptors(): array;
/**
* Returns an array of filenames indexed by their related stream in case these pipes use temporary files.
*
* @return string[]
*/
public function getFiles(): array;
/**
* Reads data in file handles and pipes.
*
* @param bool $blocking Whether to use blocking calls or not
* @param bool $close Whether to close pipes if they've reached EOF
*
* @return string[] An array of read data indexed by their fd
*/
public function readAndWrite(bool $blocking, bool $close = false): array;
/**
* Returns if the current state has open file handles or pipes.
*/
public function areOpen(): bool;
/**
* Returns if pipes are able to read output.
*/
public function haveReadSupport(): bool;
/**
* Closes file handles and pipes.
*/
public function close();
}

View File

@ -0,0 +1,163 @@
<?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\Process\Pipes;
use Symfony\Component\Process\Process;
/**
* UnixPipes implementation uses unix pipes as handles.
*
* @author Romain Neutron <imprec@gmail.com>
*
* @internal
*/
class UnixPipes extends AbstractPipes
{
private $ttyMode;
private $ptyMode;
private $haveReadSupport;
public function __construct(?bool $ttyMode, bool $ptyMode, $input, bool $haveReadSupport)
{
$this->ttyMode = $ttyMode;
$this->ptyMode = $ptyMode;
$this->haveReadSupport = $haveReadSupport;
parent::__construct($input);
}
public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
public function __destruct()
{
$this->close();
}
/**
* {@inheritdoc}
*/
public function getDescriptors(): array
{
if (!$this->haveReadSupport) {
$nullstream = fopen('/dev/null', 'c');
return [
['pipe', 'r'],
$nullstream,
$nullstream,
];
}
if ($this->ttyMode) {
return [
['file', '/dev/tty', 'r'],
['file', '/dev/tty', 'w'],
['file', '/dev/tty', 'w'],
];
}
if ($this->ptyMode && Process::isPtySupported()) {
return [
['pty'],
['pty'],
['pty'],
];
}
return [
['pipe', 'r'],
['pipe', 'w'], // stdout
['pipe', 'w'], // stderr
];
}
/**
* {@inheritdoc}
*/
public function getFiles(): array
{
return [];
}
/**
* {@inheritdoc}
*/
public function readAndWrite(bool $blocking, bool $close = false): array
{
$this->unblock();
$w = $this->write();
$read = $e = [];
$r = $this->pipes;
unset($r[0]);
// let's have a look if something changed in streams
set_error_handler([$this, 'handleError']);
if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
restore_error_handler();
// if a system call has been interrupted, forget about it, let's try again
// otherwise, an error occurred, let's reset pipes
if (!$this->hasSystemCallBeenInterrupted()) {
$this->pipes = [];
}
return $read;
}
restore_error_handler();
foreach ($r as $pipe) {
// prior PHP 5.4 the array passed to stream_select is modified and
// lose key association, we have to find back the key
$read[$type = array_search($pipe, $this->pipes, true)] = '';
do {
$data = @fread($pipe, self::CHUNK_SIZE);
$read[$type] .= $data;
} while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
if (!isset($read[$type][0])) {
unset($read[$type]);
}
if ($close && feof($pipe)) {
fclose($pipe);
unset($this->pipes[$type]);
}
}
return $read;
}
/**
* {@inheritdoc}
*/
public function haveReadSupport(): bool
{
return $this->haveReadSupport;
}
/**
* {@inheritdoc}
*/
public function areOpen(): bool
{
return (bool) $this->pipes;
}
}

View File

@ -0,0 +1,204 @@
<?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\Process\Pipes;
use Symfony\Component\Process\Exception\RuntimeException;
use Symfony\Component\Process\Process;
/**
* WindowsPipes implementation uses temporary files as handles.
*
* @see https://bugs.php.net/51800
* @see https://bugs.php.net/65650
*
* @author Romain Neutron <imprec@gmail.com>
*
* @internal
*/
class WindowsPipes extends AbstractPipes
{
private $files = [];
private $fileHandles = [];
private $lockHandles = [];
private $readBytes = [
Process::STDOUT => 0,
Process::STDERR => 0,
];
private $haveReadSupport;
public function __construct($input, bool $haveReadSupport)
{
$this->haveReadSupport = $haveReadSupport;
if ($this->haveReadSupport) {
// Fix for PHP bug #51800: reading from STDOUT pipe hangs forever on Windows if the output is too big.
// Workaround for this problem is to use temporary files instead of pipes on Windows platform.
//
// @see https://bugs.php.net/51800
$pipes = [
Process::STDOUT => Process::OUT,
Process::STDERR => Process::ERR,
];
$tmpDir = sys_get_temp_dir();
$lastError = 'unknown reason';
set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
for ($i = 0;; ++$i) {
foreach ($pipes as $pipe => $name) {
$file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
if (!$h = fopen($file.'.lock', 'w')) {
if (file_exists($file.'.lock')) {
continue 2;
}
restore_error_handler();
throw new RuntimeException('A temporary file could not be opened to write the process output: '.$lastError);
}
if (!flock($h, \LOCK_EX | \LOCK_NB)) {
continue 2;
}
if (isset($this->lockHandles[$pipe])) {
flock($this->lockHandles[$pipe], \LOCK_UN);
fclose($this->lockHandles[$pipe]);
}
$this->lockHandles[$pipe] = $h;
if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) {
flock($this->lockHandles[$pipe], \LOCK_UN);
fclose($this->lockHandles[$pipe]);
unset($this->lockHandles[$pipe]);
continue 2;
}
$this->fileHandles[$pipe] = $h;
$this->files[$pipe] = $file;
}
break;
}
restore_error_handler();
}
parent::__construct($input);
}
public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
public function __destruct()
{
$this->close();
}
/**
* {@inheritdoc}
*/
public function getDescriptors(): array
{
if (!$this->haveReadSupport) {
$nullstream = fopen('NUL', 'c');
return [
['pipe', 'r'],
$nullstream,
$nullstream,
];
}
// We're not using pipe on Windows platform as it hangs (https://bugs.php.net/51800)
// We're not using file handles as it can produce corrupted output https://bugs.php.net/65650
// So we redirect output within the commandline and pass the nul device to the process
return [
['pipe', 'r'],
['file', 'NUL', 'w'],
['file', 'NUL', 'w'],
];
}
/**
* {@inheritdoc}
*/
public function getFiles(): array
{
return $this->files;
}
/**
* {@inheritdoc}
*/
public function readAndWrite(bool $blocking, bool $close = false): array
{
$this->unblock();
$w = $this->write();
$read = $r = $e = [];
if ($blocking) {
if ($w) {
@stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
} elseif ($this->fileHandles) {
usleep(Process::TIMEOUT_PRECISION * 1E6);
}
}
foreach ($this->fileHandles as $type => $fileHandle) {
$data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
if (isset($data[0])) {
$this->readBytes[$type] += \strlen($data);
$read[$type] = $data;
}
if ($close) {
ftruncate($fileHandle, 0);
fclose($fileHandle);
flock($this->lockHandles[$type], \LOCK_UN);
fclose($this->lockHandles[$type]);
unset($this->fileHandles[$type], $this->lockHandles[$type]);
}
}
return $read;
}
/**
* {@inheritdoc}
*/
public function haveReadSupport(): bool
{
return $this->haveReadSupport;
}
/**
* {@inheritdoc}
*/
public function areOpen(): bool
{
return $this->pipes && $this->fileHandles;
}
/**
* {@inheritdoc}
*/
public function close()
{
parent::close();
foreach ($this->fileHandles as $type => $handle) {
ftruncate($handle, 0);
fclose($handle);
flock($this->lockHandles[$type], \LOCK_UN);
fclose($this->lockHandles[$type]);
}
$this->fileHandles = $this->lockHandles = [];
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,69 @@
<?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\Process;
use Symfony\Component\Process\Exception\InvalidArgumentException;
/**
* ProcessUtils is a bunch of utility methods.
*
* This class contains static methods only and is not meant to be instantiated.
*
* @author Martin Hasoň <martin.hason@gmail.com>
*/
class ProcessUtils
{
/**
* This class should not be instantiated.
*/
private function __construct()
{
}
/**
* Validates and normalizes a Process input.
*
* @param string $caller The name of method call that validates the input
* @param mixed $input The input to validate
*
* @return mixed The validated input
*
* @throws InvalidArgumentException In case the input is not valid
*/
public static function validateInput(string $caller, $input)
{
if (null !== $input) {
if (\is_resource($input)) {
return $input;
}
if (\is_string($input)) {
return $input;
}
if (is_scalar($input)) {
return (string) $input;
}
if ($input instanceof Process) {
return $input->getIterator($input::ITER_SKIP_ERR);
}
if ($input instanceof \Iterator) {
return $input;
}
if ($input instanceof \Traversable) {
return new \IteratorIterator($input);
}
throw new InvalidArgumentException(sprintf('"%s" only accepts strings, Traversable objects or stream resources.', $caller));
}
return $input;
}
}

View File

@ -0,0 +1,13 @@
Process Component
=================
The Process component executes commands in sub-processes.
Resources
---------
* [Documentation](https://symfony.com/doc/current/components/process.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)

View File

@ -0,0 +1,29 @@
{
"name": "symfony/process",
"type": "library",
"description": "Executes commands in sub-processes",
"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": ">=7.2.5",
"symfony/polyfill-php80": "^1.15"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Process\\": "" },
"exclude-from-classmap": [
"/Tests/"
]
},
"minimum-stability": "dev"
}