| Conditions | 5 |
| Paths | 16 |
| Total Lines | 73 |
| Code Lines | 49 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 55 | protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader): void |
||
| 56 | { |
||
| 57 | $c->register(Service::class); |
||
| 58 | $c->register(ServiceStory::class) |
||
| 59 | ->setAutoconfigured(true) |
||
| 60 | ->setAutowired(true) |
||
| 61 | ; |
||
| 62 | $c->register(CategoryFactory::class) |
||
| 63 | ->setAutoconfigured(true) |
||
| 64 | ->setAutowired(true) |
||
| 65 | ; |
||
| 66 | $c->register(CategoryServiceFactory::class) |
||
| 67 | ->setAutoconfigured(true) |
||
| 68 | ->setAutowired(true) |
||
| 69 | ; |
||
| 70 | |||
| 71 | $c->loadFromExtension('framework', [ |
||
| 72 | 'secret' => 'S3CRET', |
||
| 73 | 'test' => true, |
||
| 74 | ]); |
||
| 75 | |||
| 76 | if (\getenv('DATABASE_URL')) { |
||
| 77 | $c->loadFromExtension( |
||
| 78 | 'doctrine', |
||
| 79 | [ |
||
| 80 | 'dbal' => ['url' => '%env(resolve:DATABASE_URL)%'], |
||
| 81 | 'orm' => [ |
||
| 82 | 'auto_generate_proxy_classes' => true, |
||
| 83 | 'auto_mapping' => true, |
||
| 84 | 'mappings' => [ |
||
| 85 | 'Test' => [ |
||
| 86 | 'is_bundle' => false, |
||
| 87 | 'type' => 'annotation', |
||
| 88 | 'dir' => '%kernel.project_dir%/tests/Fixtures/Entity', |
||
| 89 | 'prefix' => 'Zenstruck\Foundry\Tests\Fixtures\Entity', |
||
| 90 | 'alias' => 'Test', |
||
| 91 | ], |
||
| 92 | ], |
||
| 93 | ], |
||
| 94 | ] |
||
| 95 | ); |
||
| 96 | } |
||
| 97 | |||
| 98 | if (\getenv('USE_FOUNDRY_BUNDLE')) { |
||
| 99 | $c->loadFromExtension('zenstruck_foundry', [ |
||
| 100 | 'auto_refresh_proxies' => false, |
||
| 101 | ]); |
||
| 102 | } |
||
| 103 | |||
| 104 | if ('migrate' === \getenv('FOUNDRY_RESET_MODE')) { |
||
| 105 | $c->loadFromExtension('doctrine_migrations', [ |
||
| 106 | 'migrations_paths' => [ |
||
| 107 | 'Zenstruck\Foundry\Tests\Fixtures\Migrations' => '%kernel.project_dir%/tests/Fixtures/Migrations', |
||
| 108 | ], |
||
| 109 | ]); |
||
| 110 | } |
||
| 111 | |||
| 112 | if (\getenv('MONGO_URL')) { |
||
| 113 | $c->loadFromExtension('doctrine_mongodb', [ |
||
| 114 | 'connections' => [ |
||
| 115 | 'default' => ['server' => '%env(resolve:MONGO_URL)%'], |
||
| 116 | ], |
||
| 117 | 'default_database' => 'mongo', |
||
| 118 | 'document_managers' => [ |
||
| 119 | 'default' => [ |
||
| 120 | 'auto_mapping' => true, |
||
| 121 | 'mappings' => [ |
||
| 122 | 'Test' => [ |
||
| 123 | 'is_bundle' => false, |
||
| 124 | 'type' => 'annotation', |
||
| 125 | 'dir' => '%kernel.project_dir%/tests/Fixtures/Document', |
||
| 126 | 'prefix' => 'Zenstruck\Foundry\Tests\Fixtures\Document', |
||
| 127 | 'alias' => 'Test', |
||
| 128 | ], |
||
| 141 |