Conditions | 1 |
Paths | 1 |
Total Lines | 51 |
Code Lines | 41 |
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 |
||
36 | public function buildSettings(AbstractSettingsBuilder $builder): void |
||
37 | { |
||
38 | $builder |
||
39 | ->setDefaults( |
||
40 | [ |
||
41 | 'institution' => 'Chamilo.org', |
||
42 | 'institution_url' => 'http://www.chamilo.org', |
||
43 | 'institution_address' => '', |
||
44 | 'site_name' => 'Chamilo site', |
||
45 | 'timezone' => 'Europe/Paris', |
||
46 | 'cookie_warning' => 'false', |
||
47 | 'donotlistcampus' => 'false', |
||
48 | 'use_custom_pages' => 'false', |
||
49 | 'allow_my_files' => 'true', |
||
50 | 'registered' => 'false', |
||
51 | 'server_type' => 'prod', |
||
52 | 'show_tabs' => array_values(array_diff(self::$tabs, ['videoconference', 'diagnostics'])), |
||
53 | 'chamilo_database_version' => '2.0.0', |
||
54 | 'unoconv_binaries' => '/usr/bin/unoconv', |
||
55 | 'pdf_img_dpi' => '96', |
||
56 | 'hosting_limit_users_per_course' => '0', |
||
57 | 'generate_random_login' => 'false', |
||
58 | 'timepicker_increment' => '5', |
||
59 | 'user_status_show_options_enabled' => 'false', |
||
60 | 'user_status_show_option' => '', |
||
61 | 'platform_logo_url' => 'https://chamilo.org', |
||
62 | 'use_career_external_id_as_identifier_in_diagrams' => 'false', |
||
63 | 'portfolio_advanced_sharing' => 'false', |
||
64 | 'notification_event' => 'false', |
||
65 | 'push_notification_settings' => '', |
||
66 | 'hosting_limit_identical_email' => '0', |
||
67 | 'session_admin_access_to_all_users_on_all_urls' => 'false', |
||
68 | 'use_virtual_keyboard' => 'false', |
||
69 | 'disable_copy_paste' => 'false', |
||
70 | ] |
||
71 | ) |
||
72 | ->setTransformer( |
||
73 | 'show_tabs', |
||
74 | new ArrayToIdentifierTransformer() |
||
75 | ) |
||
76 | ; |
||
77 | |||
78 | $allowedTypes = [ |
||
79 | 'institution' => ['string'], |
||
80 | 'institution_url' => ['string'], |
||
81 | 'site_name' => ['string'], |
||
82 | 'timezone' => ['string'], |
||
83 | 'show_tabs' => ['array', 'null'], |
||
84 | ]; |
||
85 | |||
86 | $this->setMultipleAllowedTypes($allowedTypes, $builder); |
||
87 | } |
||
157 |