Conditions | 4 |
Paths | 8 |
Total Lines | 67 |
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 |
||
28 | public function prepend(ContainerBuilder $container) |
||
29 | { |
||
30 | $configs = $container->getExtensionConfig($this->getAlias()); |
||
31 | $configuration = $this->getConfiguration($configs, $container); |
||
32 | $config = $this->processConfiguration($configuration, $configs); |
||
|
|||
33 | |||
34 | $hwiOauthConfig = [ |
||
35 | 'resource_owners' => [] |
||
36 | ]; |
||
37 | |||
38 | // $securityConfig = [ |
||
39 | // 'firewalls' => [ |
||
40 | // 'secured_area' => [ |
||
41 | // 'oauth' => [ |
||
42 | // 'resource_owners' => [] |
||
43 | // ] |
||
44 | // ] |
||
45 | // ] |
||
46 | // ]; |
||
47 | |||
48 | // if (isset($config['authentication']['oauth']['default_provider'])) { |
||
49 | // $securityConfig['firewalls']['secured_area']['oauth']['login_path'] = |
||
50 | // '/connect/' . $config['authentication']['oauth']['default_provider']; |
||
51 | // } else { |
||
52 | // $securityConfig['firewalls']['secured_area']['oauth']['login_path'] = '/login'; |
||
53 | // } |
||
54 | |||
55 | $formLoginEnabled = true; |
||
56 | if (isset($config['authentication']['form_login_enabled'])) { |
||
57 | $formLoginEnabled = $config['authentication']['form_login_enabled']; |
||
58 | } |
||
59 | $twigConfig['globals']['ddr_gitki_form_login_enabled'] = $formLoginEnabled; |
||
60 | |||
61 | if (isset($config['authentication']['oauth']['providers']['github'])) { |
||
62 | $githubConfig = $config['authentication']['oauth']['providers']['github']; |
||
63 | $hwiOauthConfig['fosub']['properties']['github'] = 'githubId'; |
||
64 | $hwiOauthConfig['resource_owners']['github'] = [ |
||
65 | 'type' => 'github', |
||
66 | 'client_id' => $githubConfig['client_id'], |
||
67 | 'client_secret' => $githubConfig['secret'], |
||
68 | 'scope' => 'user:email' |
||
69 | ]; |
||
70 | // $securityConfig['firewalls']['secured_area']['oauth']['resource_owners']['github'] = '/login/check-github'; |
||
71 | } |
||
72 | |||
73 | if (isset($config['authentication']['oauth']['providers']['google'])) { |
||
74 | $googleConfig = $config['authentication']['oauth']['providers']['google']; |
||
75 | $hwiOauthConfig['fosub']['properties']['google'] = 'googleId'; |
||
76 | $hwiOauthConfig['resource_owners']['google'] = [ |
||
77 | 'type' => 'google', |
||
78 | 'client_id' => $googleConfig['client_id'], |
||
79 | 'client_secret' => $googleConfig['secret'], |
||
80 | 'scope' => 'email profile', |
||
81 | 'options' => [ |
||
82 | 'access_type' => 'online', |
||
83 | 'approval_prompt' => 'auto', |
||
84 | 'display' => 'page', |
||
85 | 'login_hint' => 'email address' |
||
86 | ] |
||
87 | ]; |
||
88 | // $securityConfig['firewalls']['secured_area']['oauth']['resource_owners']['google'] = '/login/check-google'; |
||
89 | } |
||
90 | |||
91 | // $container->prependExtensionConfig('security', $securityConfig); |
||
92 | $container->prependExtensionConfig('hwi_oauth', $hwiOauthConfig); |
||
93 | $container->prependExtensionConfig('twig', $twigConfig); |
||
94 | } |
||
95 | } |
||
96 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: