Conditions | 10 |
Paths | 4 |
Total Lines | 37 |
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 |
||
97 | private function argumentsAreValid($newIndexName, $oldIndexName, $aliasName): bool |
||
98 | { |
||
99 | if ($newIndexName === null || |
||
100 | !is_string($newIndexName) || |
||
101 | mb_strlen($newIndexName) === 0 |
||
102 | ) { |
||
103 | $this->output->writeln( |
||
104 | '<error>Argument new-index-name must be a non empty string.</error>' |
||
105 | ); |
||
106 | |||
107 | return false; |
||
108 | } |
||
109 | |||
110 | if ($oldIndexName === null || |
||
111 | !is_string($oldIndexName) || |
||
112 | mb_strlen($oldIndexName) === 0 |
||
113 | ) { |
||
114 | $this->output->writeln( |
||
115 | '<error>Argument old-index-name must be a non empty string.</error>' |
||
116 | ); |
||
117 | |||
118 | return false; |
||
119 | } |
||
120 | |||
121 | if ($aliasName === null || |
||
122 | !is_string($aliasName) || |
||
123 | mb_strlen($aliasName) === 0 |
||
124 | ) { |
||
125 | $this->output->writeln( |
||
126 | '<error>Argument alias-name must be a non empty string.</error>' |
||
127 | ); |
||
128 | |||
129 | return false; |
||
130 | } |
||
131 | |||
132 | return true; |
||
133 | } |
||
134 | } |
||
135 |