Skip to content

Commit 494e311

Browse files
committed
Use register_file
1 parent 32eb9ad commit 494e311

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

Bootstraps/Symfony.php

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace PHPPM\Bootstraps;
44

5-
use PHPPM\ProcessSlave;
65
use PHPPM\Symfony\StrongerNativeSessionStorage;
76
use PHPPM\Utils;
87
use Symfony\Component\HttpFoundation\Request;
8+
use Symfony\Component\Config\Resource\FileResource;
99
use function PHPPM\register_file;
1010

1111
/**
@@ -88,28 +88,29 @@ public function getApplication()
8888
$app->booted = true;
8989
}, $app);
9090

91-
Utils::bindAndCall(function () use ($app) {
92-
$container = $app->container;
91+
if ($this->debug) {
92+
Utils::bindAndCall(function () use ($app) {
93+
$container = $app->container;
9394

94-
$containerClassName = substr(strrchr(get_class($app->container), "\\"), 1);
95-
$metaName = $containerClassName . '.php.meta';
95+
$containerClassName = substr(strrchr(get_class($app->container), "\\"), 1);
96+
$metaName = $containerClassName . '.php.meta';
9697

97-
Utils::bindAndCall(function () use ($container) {
98-
$container->publicContainerDir = $container->containerDir;
99-
}, $container);
98+
Utils::bindAndCall(function () use ($container) {
99+
$container->publicContainerDir = $container->containerDir;
100+
}, $container);
100101

101-
$metaContent = file_get_contents($app->container->publicContainerDir . '/../' . $metaName);
102+
$metaContent = file_get_contents($app->container->publicContainerDir . '/../' . $metaName);
102103

103-
$containerMetadata = unserialize($metaContent);
104+
$containerMetadata = unserialize($metaContent);
104105

105-
$files = [];
106-
foreach ($containerMetadata as $entry) {
107-
$fileResourceClass = 'Symfony\Component\Config\Resource\FileResource';
108-
if ($entry instanceof $fileResourceClass) {
109-
ProcessSlave::$slave->registerFile($entry->__toString());
106+
foreach ($containerMetadata as $entry) {
107+
$fileResourceClass = 'Symfony\Component\Config\Resource\FileResource';
108+
if ($entry instanceof FileResource) {
109+
register_file($entry->__toString());
110+
}
110111
}
111-
}
112-
}, $app);
112+
}, $app);
113+
}
113114

114115
if ($trustedProxies = getenv('TRUSTED_PROXIES')) {
115116
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
@@ -121,7 +122,7 @@ public function getApplication()
121122

122123
return $app;
123124
}
124-
125+
125126
/**
126127
* Returns the vendor directory containing autoload.php
127128
*

0 commit comments

Comments
 (0)