55use PHPPM \Symfony \StrongerNativeSessionStorage ;
66use PHPPM \Utils ;
77use Symfony \Component \HttpFoundation \Request ;
8+ use Symfony \Component \Config \Resource \FileResource ;
89use function PHPPM \register_file ;
910
1011/**
@@ -87,6 +88,38 @@ public function getApplication()
8788 $ app ->booted = true ;
8889 }, $ app );
8990
91+ if ($ this ->debug ) {
92+ Utils::bindAndCall (function () use ($ app ) {
93+ $ container = $ app ->container ;
94+
95+ $ containerClassName = substr (strrchr (get_class ($ app ->container ), "\\" ), 1 );
96+ $ metaName = $ containerClassName . '.php.meta ' ;
97+
98+ Utils::bindAndCall (function () use ($ container ) {
99+ $ container ->publicContainerDir = $ container ->containerDir ;
100+ }, $ container );
101+
102+ if ($ container ->publicContainerDir === null ) {
103+ return ;
104+ }
105+
106+ $ metaContent = @file_get_contents ($ app ->container ->publicContainerDir . '/../ ' . $ metaName );
107+
108+ // Cannot read the Metadata, returning
109+ if ($ metaContent === false ) {
110+ return ;
111+ }
112+
113+ $ containerMetadata = unserialize ($ metaContent );
114+
115+ foreach ($ containerMetadata as $ entry ) {
116+ if ($ entry instanceof FileResource) {
117+ register_file ($ entry ->__toString ());
118+ }
119+ }
120+ }, $ app );
121+ }
122+
90123 if ($ trustedProxies = getenv ('TRUSTED_PROXIES ' )) {
91124 Request::setTrustedProxies (explode (', ' , $ trustedProxies ), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST );
92125 }
@@ -97,7 +130,7 @@ public function getApplication()
97130
98131 return $ app ;
99132 }
100-
133+
101134 /**
102135 * Returns the vendor directory containing autoload.php
103136 *
0 commit comments