File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace ProklUng \ContainerBoilerplate \DI \CompilerPass ;
4+
5+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
6+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
7+
8+ /**
9+ * Class MakePrivateServicePublic
10+ * Сделать все сервисы публичными.
11+ * @package Prokl\ServiceProvider\CompilePasses
12+ *
13+ * @since 18.07.2021
14+ */
15+ final class MakeAllPrivateServicePublic implements CompilerPassInterface
16+ {
17+ /**
18+ * @inheritDoc
19+ */
20+ public function process (ContainerBuilder $ container ) : void
21+ {
22+ $ services = $ container ->getServiceIds ();
23+
24+ foreach ($ services as $ id => $ service ) {
25+ if (!$ container ->hasDefinition ($ service )) {
26+ continue ;
27+ }
28+
29+ $ def = $ container ->getDefinition ($ service );
30+ $ def ->setPublic (true );
31+ }
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments