File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
src/Bridges/ApplicationDI Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -220,5 +220,28 @@ public static function initializeBlueScreenPanel(
220220 . '<h3>Presenter</h3> ' . $ dumper ($ application ->getPresenter ()),
221221 ];
222222 });
223+ if (
224+ version_compare (Tracy \Debugger::VERSION , '2.9.0 ' , '>= ' )
225+ && version_compare (Tracy \Debugger::VERSION , '3.0 ' , '< ' )
226+ ) {
227+ $ blueScreen ->addFileGenerator ([self ::class, 'generateNewPresenterFileContents ' ]);
228+ }
229+ }
230+
231+
232+ public static function generateNewPresenterFileContents (string $ file , ?string $ class = null ): ?string
233+ {
234+ if (!$ class || substr ($ file , -13 ) !== 'Presenter.php ' ) {
235+ return null ;
236+ }
237+
238+ $ res = "<?php \n\ndeclare(strict_types=1); \n\n" ;
239+
240+ if ($ pos = strrpos ($ class , '\\' )) {
241+ $ res .= 'namespace ' . substr ($ class , 0 , $ pos ) . "; \n\n" ;
242+ $ class = substr ($ class , $ pos + 1 );
243+ }
244+
245+ return $ res . "use Nette; \n\n\nclass $ class extends Nette \\Application \\UI \\Presenter \n{ \n\$END \$\n} \n" ;
223246 }
224247}
You can’t perform that action at this time.
0 commit comments