Showing 1,726 of 2,403 total issues
Method tags
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function tags(): array
{
$tags = [
'FAM:NO' => new FamilyNonEvent(I18N::translate('Event did not occur')),
'INDI:NO' => new IndividualNonEvent(I18N::translate('Event did not occur')),
Method handle
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$user = Validator::attributes($request)->user();
Method display
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function display(Tree|null $tree = null, string|null $date_format = null, bool $convert_calendars = false): string
{
if ($tree instanceof Tree) {
$CALENDAR_FORMAT = $tree->getPreference('CALENDAR_FORMAT');
} else {
File CalendarService.php
has 351 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Function getBlock
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
{
$calendar_service = new CalendarService();
$days = (int) $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
- 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 format
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function format(string $format, string $qualifier = ''): string
{
// Dates can include additional punctuation and symbols. e.g.
// %F %j, %Y
// %Y. %F %d.
- 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 gedcomStartHandler
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
protected function gedcomStartHandler(array $attrs): void
{
if ($this->process_gedcoms > 0) {
$this->process_gedcoms++;
- 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 HtmlRenderer.php
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Method handle
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$query = Validator::queryParams($request)->string('query', '');
Individual
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class Individual extends GedcomRecord
{
public const RECORD_TYPE = 'INDI';
// Placeholders to indicate unknown names
Function nameAtCensusDate
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
protected function nameAtCensusDate(Individual $individual): array
{
$names = $individual->getAllNames();
$name = $names[0];
$family = $this->spouseFamily($individual);
- 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 relationships
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function relationships(): array
{
// Genitive forms in English are simple/regular, as no relationship name ends in "s".
$genitive = static fn (string $s): array => [$s, $s . '’s %s'];
Method legacyCousinName
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function legacyCousinName(int $n, string $sex): string
{
if ($sex === 'M') {
switch ($n) {
case 1:
Method handle
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
// For backwards compatibility with webtrees 1.x we store the two calendar formats in one variable
Method historicEventsAll
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function historicEventsAll(): Collection
{
switch (I18N::languageTag()) {
case 'cs':
return new Collection([
Method render
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render($renderer): void
{
if (str_contains($this->text, '{{:ptp:}}')) {
return;
}
Method reformatRecord
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function reformatRecord(string $rec, Tree $tree): string
{
$gedcom_service = Registry::container()->get(GedcomService::class);
// Strip out mac/msdos line endings
Method tags
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function tags(): array
{
return [
'FAM:*:ADDR:_PRIV' => new CustomElement(I18N::translate('Private')),
'FAM:*:PLAC:_VERI' => new CustomElement(I18N::translate('Verified')),
Function calculateRelationships
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
private function calculateRelationships(
Individual $individual1,
Individual $individual2,
int $recursion,
bool $ancestor = false
- 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 factsEndHandler
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
protected function factsEndHandler(): void
{
$this->process_repeats--;
if ($this->process_repeats > 0) {
return;
- 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"