Showing 8 of 8 total issues
Function mappingsForMap
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
private function mappingsForMap(string $map_id): array
{
$mapping = [];
if ($this->endsWith($map_id, '-departements')) {
return self::MAPPINGS_DEPARTEMENTS;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method listMapDefinition
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function listMapDefinition(): array
{
$filesystem = new Filesystem(new LocalFilesystemAdapter($this->resourcesFolder() . 'maps/'));
//phpcs:disable Generic.Files.LineLength.TooLong
Method placeMapProvider
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function placeMapProvider(): array
{
$valid_resources = __DIR__ . '/../../resources/valid';
$invalid_resources = __DIR__ . '/../../resources/invalid';
$not_exist_resources = __DIR__ . '/../../resources/doesnotexist';
Method mappingsForMap
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function mappingsForMap(string $map_id): array
{
$mapping = [];
if ($this->endsWith($map_id, '-departements')) {
return self::MAPPINGS_DEPARTEMENTS;
Avoid too many return
statements within this method. Open
Open
return $mapping;
Avoid too many return
statements within this method. Open
Open
return $mapping;
Avoid too many return
statements within this method. Open
Open
return array_merge(
$mapping,
$mappings_new_communes['12'] ?? [],
$mappings_new_communes['15'] ?? [],
$mappings_new_communes['43'] ?? [],
Avoid too many return
statements within this method. Open
Open
return array_merge($mapping, $mappings_new_communes[$dept_match[1]] ?? []);