| Conditions | 4 |
| Paths | 5 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function isCompatible(Map $map): bool |
||
| 24 | { |
||
| 25 | if (!$map->lapRace) { |
||
| 26 | return false; |
||
| 27 | } |
||
| 28 | |||
| 29 | $nbLaps = 1; |
||
| 30 | if ($map->lapRace) { |
||
| 31 | $nbLaps = $map->nbLaps; |
||
| 32 | } |
||
| 33 | |||
| 34 | $scriptSettings = $this->gameDataStorage->getScriptOptions(); |
||
| 35 | if ($scriptSettings['S_ForceLapsNb'] != -1) { |
||
| 36 | $nbLaps = $scriptSettings['S_ForceLapsNb']; |
||
| 37 | } |
||
| 38 | |||
| 39 | // If rounds is configured to be single laps then no need for race data. lap is sufficient. |
||
| 40 | return $nbLaps > 1; } |
||
| 41 | |||
| 63 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.