Showing 1,726 of 2,403 total issues
File Tree.php
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Consider simplifying this complex logical expression. Open
if ($linked === null) {
$message = I18N::translate('%s does not exist.', e($xref1));
$errors[] = $this->lineError($tree, $record->type, $record->xref, $line_number, $line, $message, $tag . '-' . $xref1);
} elseif ($element instanceof XrefFamily && $linked->type !== Family::RECORD_TYPE) {
$message = $this->linkErrorMessage($tree, $xref1, $linked->type, Family::RECORD_TYPE);
HtmlRenderer
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class HtmlRenderer extends AbstractRenderer
{
// Cell padding
public float $cPadding = 2;
Method handle
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$this->checkRegistrationAllowed();
$tree = Validator::attributes($request)->treeOptional();
Method chart
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function chart(Individual $individual1, Individual $individual2, int $recursion, int $ancestors): ResponseInterface
{
$tree = $individual1->tree();
$max_recursion = (int) $tree->getPreference('RELATIONSHIP_RECURSION', static::DEFAULT_RECURSION);
Method textBoxStartHandler
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function textBoxStartHandler(array $attrs): void
{
// string Background color code
$bgcolor = '';
if (!empty($attrs['bgcolor'])) {
Function getEventsList
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function getEventsList(int $jd1, int $jd2, string $events, bool $only_living, string $sort_by, Tree $tree): Collection
{
$found_facts = [];
$facts = new Collection();
- 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 render
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function render($renderer): void
{
$temptext = str_replace('#PAGENUM#', (string) $renderer->tcpdf->PageNo(), $this->text);
// underline «title» part of Source item
$temptext = str_replace([
- 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 extractNamesFromFacts
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
protected function extractNamesFromFacts(int $level, string $fact_type, Collection $facts): void
{
$sublevel = $level + 1;
$subsublevel = $sublevel + 1;
foreach ($facts as $fact) {
- 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 CheckTree.php
has 329 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Method getAnniversaryEvents
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAnniversaryEvents(int $jd, string $facts, Tree $tree, string $filterof = '', string $filtersx = ''): array
{
$found_facts = [];
$anniversaries = [
Method relativesStartHandler
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function relativesStartHandler(array $attrs): void
{
$this->process_repeats++;
if ($this->process_repeats > 1) {
return;
Method format
has 94 lines of code (exceeds 25 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.
Function chart
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function chart(Tree $tree, array $xrefs, int $scale): ResponseInterface
{
/** @var Individual[] $individuals */
$individuals = array_map(static fn (string $xref): Individual|null => Registry::individualFactory()->make($xref, $tree), $xrefs);
- 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 26 (exceeds 5 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$query = Validator::queryParams($request)->string('query', '');
- 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 run
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function run(): void
{
// Setting up the styles
echo '<style>';
echo '#bodydiv { font: 10px sans-serif;}';
- 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 cellStartHandler
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function cellStartHandler(array $attrs): void
{
// string The text alignment of the text in this box.
$align = $attrs['align'] ?? '';
// RTL supported left/right alignment
- 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 listEndHandler
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function listEndHandler(): 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"
Further reading
Method render
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render($renderer): void
{
$temptext = str_replace('#PAGENUM#', (string) $renderer->tcpdf->PageNo(), $this->text);
// underline «title» part of Source item
$temptext = str_replace([
Method handle
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$xref1 = Validator::parsedBody($request)->isXref()->string('xref1');
$xref2 = Validator::parsedBody($request)->isXref()->string('xref2');