app/Module/Sosa/Services/SosaStatisticsService.php
File SosaStatisticsService.php
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* webtrees-lib: MyArtJaub library for webtrees
*
Method pedigreeCollapseByGenerationData
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function pedigreeCollapseByGenerationData(): array
{
if (!$this->isPdoSupported()) {
return [];
}
The class SosaStatisticsService has 13 public methods. Consider refactoring SosaStatisticsService to keep number of public methods under 10. Open
Open
class SosaStatisticsService
{
private UserInterface $user;
private Tree $tree;
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Method generationDepthStatsAtGeneration
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function generationDepthStatsAtGeneration(int $gen): Collection
{
if (!$this->isPdoSupported()) {
return collect();
}
Method topMultipleAncestorsWithNoTies
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function topMultipleAncestorsWithNoTies(int $limit): Collection
{
$table_prefix = DB::connection()->getTablePrefix();
$multiple_ancestors = DB::table('maj_sosa AS sosa')
->select('sosa.majs_i_id AS sosa_i_id')
Method ancestorsDispersionForGeneration
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function ancestorsDispersionForGeneration(int $gen): Collection
{
if (!$this->isPdoSupported()) {
return collect();
}
The method pedigreeCollapseByGenerationData() has 135 lines of code. Current threshold is set to 100. Avoid really long methods. Open
Open
public function pedigreeCollapseByGenerationData(): array
{
if (!$this->isPdoSupported()) {
return [];
}
- Exclude checks
Avoid excessively long variable names like $root_ancestors_contributions. Keep variable name length under 20. Open
Open
$root_ancestors_contributions = DB::table('maj_sosa AS sosa')
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $missing_ancestors_by_gen. Keep variable name length under 20. Open
Open
$missing_ancestors_by_gen = DB::table('maj_sosa AS sosa')
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $consolidated_ancestors_branches. Keep variable name length under 20. Open
Open
$consolidated_ancestors_branches = DB::table('maj_sosa')
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $ancestors_contributions_sum. Keep variable name length under 20. Open
Open
$ancestors_contributions_sum = DB::connection()->query()
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $known_ancestors_contributions. Keep variable name length under 20. Open
Open
$known_ancestors_contributions = DB::table('maj_sosa AS sosa')
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}