Conditions | 1 |
Paths | 1 |
Total Lines | 62 |
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 |
||
67 | public function performUpdate(array &$dbQueries, &$customMessages) |
||
68 | { |
||
69 | $table = 'tx_calendarize_domain_model_configuration'; |
||
70 | |||
71 | $q = HelperUtility::getDatabaseConnection($table)->createQueryBuilder(); |
||
72 | $q->update($table) |
||
73 | ->where( |
||
74 | $q->expr()->eq('type', 'timeExclude') |
||
75 | ) |
||
76 | ->values([ |
||
77 | 'type' => ConfigurationInterface::TYPE_TIME, |
||
78 | 'handling' => ConfigurationInterface::HANDLING_INCLUDE, |
||
79 | ]); |
||
80 | |||
81 | $dbQueries[] = $q->getSQL(); |
||
82 | $q->execute(); |
||
83 | $q->resetQueryParts(); |
||
84 | |||
85 | $q->update('tx_calendarize_domain_model_configuration') |
||
86 | ->where( |
||
87 | $q->expr()->eq('type', 'include') |
||
88 | ) |
||
89 | ->values([ |
||
90 | 'type' => ConfigurationInterface::TYPE_GROUP, |
||
91 | 'handling' => ConfigurationInterface::HANDLING_INCLUDE, |
||
92 | ]); |
||
93 | |||
94 | $dbQueries[] = $q->getSQL(); |
||
95 | $q->execute(); |
||
96 | $q->resetQueryParts(); |
||
97 | |||
98 | $q->update('tx_calendarize_domain_model_configuration') |
||
99 | ->where( |
||
100 | $q->expr()->eq('type', 'exclude') |
||
101 | ) |
||
102 | ->values([ |
||
103 | 'type' => ConfigurationInterface::TYPE_GROUP, |
||
104 | 'handling' => ConfigurationInterface::HANDLING_EXCLUDE, |
||
105 | ]); |
||
106 | |||
107 | $dbQueries[] = $q->getSQL(); |
||
108 | $q->execute(); |
||
109 | $q->resetQueryParts(); |
||
110 | |||
111 | $q->update('tx_calendarize_domain_model_configuration') |
||
112 | ->where( |
||
113 | $q->expr()->orX( |
||
114 | $q->expr()->eq('handling', ''), |
||
115 | $q->expr()->isNull('handling') |
||
116 | ) |
||
117 | ) |
||
118 | ->values([ |
||
119 | 'handling' => ConfigurationInterface::HANDLING_INCLUDE, |
||
120 | ]); |
||
121 | |||
122 | $dbQueries[] = $q->getSQL(); |
||
123 | $q->execute(); |
||
124 | |||
125 | $customMessages = 'All queries are done! :)'; |
||
126 | |||
127 | return true; |
||
128 | } |
||
129 | } |
||
130 |