Conditions | 1 |
Paths | 1 |
Total Lines | 71 |
Code Lines | 3 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
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 |
||
38 | public function getUpSQL() |
||
39 | { |
||
40 | return array ( |
||
41 | 'keeko' => ' |
||
42 | # This is a fix for InnoDB in MySQL >= 4.1.x |
||
43 | # It "suspends judgement" for fkey relationships until are tables are set. |
||
44 | SET FOREIGN_KEY_CHECKS = 0; |
||
45 | |||
46 | DROP TABLE IF EXISTS `kk_auth`; |
||
47 | |||
48 | ALTER TABLE `kk_application_uri` DROP FOREIGN KEY `application_uri_fk_application`; |
||
49 | |||
50 | ALTER TABLE `kk_application_uri` DROP FOREIGN KEY `application_uri_fk_localization`; |
||
51 | |||
52 | ALTER TABLE `kk_application_uri` ADD CONSTRAINT `application_uri_fk_application` |
||
53 | FOREIGN KEY (`application_id`) |
||
54 | REFERENCES `kk_application` (`id`) |
||
55 | ON DELETE RESTRICT; |
||
56 | |||
57 | ALTER TABLE `kk_application_uri` ADD CONSTRAINT `application_uri_fk_localization` |
||
58 | FOREIGN KEY (`localization_id`) |
||
59 | REFERENCES `kk_localization` (`id`) |
||
60 | ON DELETE RESTRICT; |
||
61 | |||
62 | ALTER TABLE `kk_group_action` DROP FOREIGN KEY `group_action_fk_action`; |
||
63 | |||
64 | ALTER TABLE `kk_group_action` DROP FOREIGN KEY `group_action_fk_group`; |
||
65 | |||
66 | ALTER TABLE `kk_group_action` ADD CONSTRAINT `group_action_fk_action` |
||
67 | FOREIGN KEY (`action_id`) |
||
68 | REFERENCES `kk_action` (`id`) |
||
69 | ON DELETE RESTRICT; |
||
70 | |||
71 | ALTER TABLE `kk_group_action` ADD CONSTRAINT `group_action_fk_group` |
||
72 | FOREIGN KEY (`group_id`) |
||
73 | REFERENCES `kk_group` (`id`) |
||
74 | ON DELETE RESTRICT; |
||
75 | |||
76 | ALTER TABLE `kk_localization_variant` DROP FOREIGN KEY `localization_variant_fk_localization`; |
||
77 | |||
78 | ALTER TABLE `kk_localization_variant` DROP FOREIGN KEY `localization_variant_fk_variant`; |
||
79 | |||
80 | ALTER TABLE `kk_localization_variant` ADD CONSTRAINT `localization_variant_fk_localization` |
||
81 | FOREIGN KEY (`localization_id`) |
||
82 | REFERENCES `kk_localization` (`id`) |
||
83 | ON DELETE RESTRICT; |
||
84 | |||
85 | ALTER TABLE `kk_localization_variant` ADD CONSTRAINT `localization_variant_fk_variant` |
||
86 | FOREIGN KEY (`variant_id`) |
||
87 | REFERENCES `kk_language_variant` (`id`) |
||
88 | ON DELETE RESTRICT; |
||
89 | |||
90 | ALTER TABLE `kk_user_group` DROP FOREIGN KEY `user_group_fk_group`; |
||
91 | |||
92 | ALTER TABLE `kk_user_group` DROP FOREIGN KEY `user_group_fk_user`; |
||
93 | |||
94 | ALTER TABLE `kk_user_group` ADD CONSTRAINT `user_group_fk_group` |
||
95 | FOREIGN KEY (`group_id`) |
||
96 | REFERENCES `kk_group` (`id`) |
||
97 | ON DELETE RESTRICT; |
||
98 | |||
99 | ALTER TABLE `kk_user_group` ADD CONSTRAINT `user_group_fk_user` |
||
100 | FOREIGN KEY (`user_id`) |
||
101 | REFERENCES `kk_user` (`id`) |
||
102 | ON DELETE RESTRICT; |
||
103 | |||
104 | # This restores the fkey checks, after having unset them earlier |
||
105 | SET FOREIGN_KEY_CHECKS = 1; |
||
106 | ', |
||
107 | ); |
||
108 | } |
||
109 | |||
191 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.