Showing 1,726 of 2,403 total issues
Function getBlock
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
{
$old_language = I18N::languageTag();
$sendmail = (bool) $this->getBlockSetting($block_id, 'sendmail', '1');
- 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 editLinesToGedcom
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function editLinesToGedcom(string $record_type, array $levels, array $tags, array $values, bool $append = true): string
{
// Assert all arrays are the same size.
$count = count($levels);
assert($count > 0);
- 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 docStartHandler
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
protected function docStartHandler(array $attrs): void
{
$this->parser = $this->xml_parser;
// Custom page width
- 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 usersLoggedInQuery
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
private function usersLoggedInQuery(string $type): string
{
$content = '';
$anonymous = 0;
$logged_in = [];
- 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 censusPlaces
has 129 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function censusPlaces(string $locale): array
{
switch ($locale) {
case 'cs':
return [
Function getStepFamilyLabel
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public function getStepFamilyLabel(Family $step_family): string
{
foreach ($this->childFamilies() as $family) {
if ($family !== $step_family) {
// Must be a step-family
- 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
FamilyDatesRepository
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
class FamilyDatesRepository implements FamilyDatesRepositoryInterface
{
/**
* Sorting directions.
*/
Function getCalendarEvents
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function getCalendarEvents(int $jd1, int $jd2, string $facts, Tree $tree, string $filterof = '', string $filtersx = ''): array
{
// Events that start or end during the period
$query = DB::table('dates')
->where('d_file', '=', $tree->id())
- 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 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$this->layout = 'layouts/ajax';
$tree = Validator::attributes($request)->tree();
SearchService
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class SearchService
{
// Do not attempt to show search results larger than this/
protected const MAX_SEARCH_RESULTS = 5000;
Relationship
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class Relationship
{
// The basic components of a relationship.
// These strings are needed for compatibility with the legacy algorithm.
// Once that has been replaced, it may be more efficient to use integers here.
Function getPersonNameStartHandler
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
protected function getPersonNameStartHandler(array $attrs): void
{
$id = '';
$match = [];
if (empty($attrs['id'])) {
- 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 upgrade
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function upgrade(): void
{
// It is simpler to create a new table than to update the existing one.
if (!DB::schema()->hasTable('place_location')) {
File I18N.php
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Function handle
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$this->layout = 'layouts/ajax';
$tree = Validator::attributes($request)->tree();
- 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 handle
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$source = Validator::parsedBody($request)->isInArray(['client', 'server'])->string('source');
$options = Validator::parsedBody($request)->isInArray(['add', 'addupdate', 'update'])->string('options');
- 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 addAncestors
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
private function addAncestors(array &$list, string $pid, bool $children = false, int $generations = -1): void
{
$genlist = [$pid];
$list[$pid]->generation = 1;
while (count($genlist) > 0) {
- 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 getAllNames
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function getAllNames(): array
{
if ($this->getAllNames === []) {
// Check the script used by each name, so we can match cyrillic with cyrillic, greek with greek, etc.
$husb_names = [];
- 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
File FanChartModule.php
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Method historicEventsAll
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function historicEventsAll(): Collection
{
switch (I18N::languageTag()) {
case 'fr':
case 'fr-CA':