| @@ 162-175 (lines=14) @@ | ||
| 159 | } |
|
| 160 | ||
| 161 | // If both structures are equal compare lengths of NPCG |
|
| 162 | for ($i = 0; $i < $maxStructureSize; $i++) { |
|
| 163 | // If current CG is NPCG |
|
| 164 | if ($initial[$i][0] === 1) { |
|
| 165 | if ($initial[$i][1] > $compared[$i][1]) { |
|
| 166 | return 1; |
|
| 167 | } |
|
| 168 | ||
| 169 | if ($initial[$i][1] < $compared[$i][1]) { |
|
| 170 | return -1; |
|
| 171 | } |
|
| 172 | } |
|
| 173 | ||
| 174 | // Current NPCG character groups have equal length - continue |
|
| 175 | } |
|
| 176 | ||
| 177 | $return = $this->compareStructureLengths($maxStructureSize, $initial, $compared, self::G_FIXED); |
|
| 178 | if ($return === 0) { |
|
| @@ 201-215 (lines=15) @@ | ||
| 198 | protected function compareStructureLengths(int $size, array $initial, array $compared, int $type = self::G_FIXED): int |
|
| 199 | { |
|
| 200 | // Iterate character group structures |
|
| 201 | for ($i = 0; $i < $size; $i++) { |
|
| 202 | // Check if character group matches passed character group type |
|
| 203 | if ($initial[$i][$type] === $type) { |
|
| 204 | // Compare character group length |
|
| 205 | if ($initial[$i][1] > $compared[$i][1]) { |
|
| 206 | return -1; |
|
| 207 | } |
|
| 208 | ||
| 209 | if ($initial[$i][1] < $compared[$i][1]) { |
|
| 210 | return 1; |
|
| 211 | } |
|
| 212 | ||
| 213 | // Continue to next character group structure |
|
| 214 | } |
|
| 215 | } |
|
| 216 | ||
| 217 | // Character group structures have equal length |
|
| 218 | return 0; |
|