Conditions | 18 |
Paths | 19 |
Total Lines | 71 |
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 |
||
96 | continue 2; |
||
97 | } |
||
98 | |||
99 | list($domain, $context, $original, $plural) = $args; |
||
100 | break; |
||
101 | |||
102 | case 'dngettext': |
||
103 | if (!isset($args[2])) { |
||
104 | continue 2; |
||
105 | } |
||
106 | |||
107 | list($domain, $original, $plural) = $args; |
||
108 | break; |
||
109 | |||
110 | default: |
||
111 | throw new Exception(sprintf('Not valid function %s', $functions[$name])); |
||
112 | } |
||
113 | |||
114 | if ((string)$original === '') { |
||
115 | continue; |
||
116 | } |
||
117 | |||
118 | $isDefaultDomain = $domain === null; |
||
119 | $isMatchingDomain = $domain === $translations->getDomain(); |
||
120 | |||
121 | if (!empty($options['domainOnly']) && $isDefaultDomain) { |
||
122 | // If we want to find translations for a specific domain, skip default domain messages |
||
123 | continue; |
||
124 | } |
||
125 | |||
126 | if (!$isDefaultDomain && !$isMatchingDomain) { |
||
127 | continue; |
||
128 | } |
||
129 | |||
130 | $translation = $translations->insert($context, $original, $plural); |
||
131 | $translation->addReference($file, $line); |
||
132 | |||
133 | if (isset($function[3])) { |
||
134 | foreach ($function[3] as $extractedComment) { |
||
135 | $translation->addExtractedComment($extractedComment); |
||
136 | } |
||
137 | } |
||
138 | } |
||
139 | } |
||
140 | } |
||
141 |