| Conditions | 1 |
| Paths | 1 |
| Total Lines | 96 |
| Code Lines | 70 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 39 | function it_processes(ContainerBuilder $container, Definition $definition) |
||
| 40 | { |
||
| 41 | $container->getParameter('bengor_user.config')->shouldBeCalled()->willReturn([ |
||
| 42 | 'user_class' => [ |
||
| 43 | 'user' => [ |
||
| 44 | 'class' => 'AppBundle\Entity\User', |
||
| 45 | 'firewall' => 'main', |
||
| 46 | 'persistence' => 'doctrine_orm', |
||
| 47 | 'default_roles' => [ |
||
| 48 | 'ROLE_USER', |
||
| 49 | ], |
||
| 50 | 'use_cases' => [ |
||
| 51 | 'security' => [ |
||
| 52 | 'enabled' => true, |
||
| 53 | ], |
||
| 54 | 'sign_up' => [ |
||
| 55 | 'enabled' => true, |
||
| 56 | 'type' => 'default', |
||
| 57 | ], |
||
| 58 | 'change_password' => [ |
||
| 59 | 'enabled' => true, |
||
| 60 | 'type' => 'default', |
||
| 61 | ], |
||
| 62 | 'remove' => [ |
||
| 63 | 'enabled' => true, |
||
| 64 | ], |
||
| 65 | ], |
||
| 66 | 'routes' => [ |
||
| 67 | 'security' => [ |
||
| 68 | 'login' => [ |
||
| 69 | 'name' => 'bengor_user_user_login', |
||
| 70 | 'path' => '/user/login', |
||
| 71 | ], |
||
| 72 | 'login_check' => [ |
||
| 73 | 'name' => 'bengor_user_user_login_check', |
||
| 74 | 'path' => '/user/login_check', |
||
| 75 | ], |
||
| 76 | 'logout' => [ |
||
| 77 | 'name' => 'bengor_user_user_logout', |
||
| 78 | 'path' => '/user/logout', |
||
| 79 | ], |
||
| 80 | 'success_redirection_route' => 'bengor_user_user_homepage', |
||
| 81 | ], |
||
| 82 | 'sign_up' => [ |
||
| 83 | 'name' => 'bengor_user_user_sign_up', |
||
| 84 | 'path' => '/user/sign-up', |
||
| 85 | 'success_redirection_route' => 'bengor_user_user_homepage', |
||
| 86 | ], |
||
| 87 | 'invite' => [ |
||
| 88 | 'name' => 'bengor_user_user_invite', |
||
| 89 | 'path' => '/user/invite', |
||
| 90 | 'success_redirection_route' => null, |
||
| 91 | ], |
||
| 92 | 'enable' => [ |
||
| 93 | 'name' => 'bengor_user_user_enable', |
||
| 94 | 'path' => '/user/confirmation-token', |
||
| 95 | 'success_redirection_route' => null, |
||
| 96 | ], |
||
| 97 | 'change_password' => [ |
||
| 98 | 'name' => 'bengor_user_user_change_password', |
||
| 99 | 'path' => '/user/change-password', |
||
| 100 | 'success_redirection_route' => null, |
||
| 101 | ], |
||
| 102 | 'request_remember_password' => [ |
||
| 103 | 'name' => 'bengor_user_user_request_remember_password', |
||
| 104 | 'path' => '/user/remember-password', |
||
| 105 | 'success_redirection_route' => null, |
||
| 106 | ], |
||
| 107 | 'remove' => [ |
||
| 108 | 'name' => 'bengor_user_user_remove', |
||
| 109 | 'path' => '/user/remove', |
||
| 110 | 'success_redirection_route' => null, |
||
| 111 | ], |
||
| 112 | ], |
||
| 113 | ], |
||
| 114 | ], |
||
| 115 | ]); |
||
| 116 | |||
| 117 | $container->setDefinition( |
||
| 118 | 'user_password_encoder', |
||
| 119 | Argument::type(Definition::class) |
||
| 120 | )->shouldBeCalled()->willReturn($definition); |
||
| 121 | $container->getDefinition('user_password_encoder')->shouldBeCalled()->willReturn($definition); |
||
| 122 | |||
| 123 | $container->setDefinition( |
||
| 124 | 'bengor.user.infrastructure.security.symfony.user_password_encoder', |
||
| 125 | Argument::type(Definition::class) |
||
| 126 | )->shouldBeCalled()->willReturn($definition); |
||
| 127 | |||
| 128 | $container->setAlias( |
||
| 129 | 'bengor_user.user.symfony_password_encoder', |
||
| 130 | 'bengor.user.infrastructure.security.symfony.user_password_encoder' |
||
| 131 | )->shouldBeCalled(); |
||
| 132 | |||
| 133 | $this->process($container); |
||
| 134 | } |
||
| 135 | } |
||
| 136 |