app/Module/GeoDispersion/Services/PlacesReferenceTableService.php
Method targetId
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function targetId(string $source, string $source_format, string $target_format): ?string
{
// Extract parts for the WHERE clause
$source_format = str_replace(['{', '}'], ['{#', '#}'], $source_format);
$source_parts = preg_split('/[{}]/i', $source_format);
Avoid too many return
statements within this method. Open
Open
return $target_format;
Avoid too many return
statements within this method. Open
Open
return str_replace(
array_map(fn($tag) => '{' . $tag . '}', $columns_select[1]),
array_map(fn($tag) => $mapping[$this->columnName($tag)] ?? '', $columns_select[1]),
$target_format
);
Avoid variables with short names like $id. Configured minimum length is 3. Open
Open
$columns = array_unique(array_filter(array_map(fn($id) => $this->columnName($id), $columns_select[1])));
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}