Showing 96 of 758 total issues
Method visits
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function visits(WelcomeBlockModule $module, int $block_id, string $period): ?int
{
$settings = $module->matomoSettings($block_id);
if (
Method targetId
has 33 lines of code (exceeds 25 allowed). Consider refactoring. 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);
Method all
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function all(bool $include_disabled = false): Collection
{
return Registry::cache()->array()->remember('all-hooks', function () use ($include_disabled): Collection {
$hooks_info = DB::table('maj_hook_order')
->get()
Method handle
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
if ($this->module === null) {
Function handle
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$this->layout = 'layouts/ajax';
if ($this->module === null) {
- 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
Function results
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function results(Tree $tree, int $depth): GeoAnalysisResults
{
$results = new GeoAnalysisResults();
$unique_ancestors = $this->records_service
- 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 handle
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$this->layout = 'layouts/ajax';
if ($this->module === null) {
Method map
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function map(Place $place, string $feature_property): ?string
{
$location = new PlaceLocation($place->gedcomName());
$longitude = $location->longitude();
$latitude = $location->latitude();
Method handle
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
if ($this->module === null) {
Method loadRoutes
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loadRoutes($router): void
{
$router->attach('', '', static function (Map $router): void {
$router->attach('', '/module-maj/certificates', static function (Map $router): void {
Method ancestorsDispersionForGeneration
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function ancestorsDispersionForGeneration(int $gen): Collection
{
if (!$this->isPdoSupported()) {
return collect();
}
Method topMultipleAncestorsWithNoTies
has 30 lines of code (exceeds 25 allowed). Consider refactoring. 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 migrateGeoAnalysisMap
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function migrateGeoAnalysisMap(
stdClass $old_view,
Tree $tree,
GeoAnalysisViewDataService $geoview_data_service
): bool {
Method handle
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
if ($this->module === null) {
throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
}
Method handle
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
if ($this->module === null) {
FlashMessages::addMessage(
I18N::translate('The attached module could not be found.'),
Function results
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function results(Tree $tree, int $depth): GeoAnalysisResults
{
$results = new GeoAnalysisResults();
foreach ($this->geoanalysis_data_service->individualsAndFamilies($tree) as $record) {
- 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 getLineageRootIndividual
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getLineageRootIndividual(Individual $indi): ?Individual
{
$child_families = $indi->childFamilies();
if ($this->used_indis->get($indi->xref(), false) !== false) {
return null;
Method listMissingAncestorsAtGeneration
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function listMissingAncestorsAtGeneration(Tree $tree, UserInterface $user, int $gen): Collection
{
if ($gen === 1) {
return collect();
}
Method handle
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
if ($this->module === null) {
throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
}
Method handle
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
if ($this->module === null) {
FlashMessages::addMessage(
I18N::translate('The attached module could not be found.'),