Showing 1,726 of 2,403 total issues
Method addName
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function addName(string $type, string $value, string $gedcom): void
{
////////////////////////////////////////////////////////////////////////////
// Extract the structured name parts - use for "sortable" names and indexes
////////////////////////////////////////////////////////////////////////////
Method calculateRelationships
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function calculateRelationships(
Individual $individual1,
Individual $individual2,
int $recursion,
bool $ancestor = false
Method handle
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$user = Validator::attributes($request)->user();
$xref = Validator::attributes($request)->isXref()->string('xref');
Method duplicateRecords
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function duplicateRecords(Tree $tree): array
{
// We can't do any reasonable checks using MySQL.
// Will need to wait for a "repositories" table.
$repositories = [];
Method commonCountriesList
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function commonCountriesList(): string
{
$countries = DB::table('places')
->join('placelinks', static function (JoinClause $join): void {
$join
File ManageMediaData.php
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Consider simplifying this complex logical expression. Open
Open
if ($hd->day === 30 && $hd->month === 2 && $hd->year !== 0 && $hd1->daysInMonth() < 30) {
// 30 CSH - Last day in CSH
$jd_yahrtzeit = $jewish_calendar->ymdToJd($today->year, 3, 1) - 1;
} elseif ($hd->day === 30 && $hd->month === 3 && $hd->year !== 0 && $hd1->daysInMonth() < 30) {
// 30 KSL - Last day in KSL
Timestamp
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Timestamp implements TimestampInterface
{
private CarbonImmutable $carbon;
public function __construct(int $timestamp, string $timezone, string $locale)
Consider simplifying this complex logical expression. Open
Open
if (($this->process_footnote || $name === 'Footnote') && ($this->process_ifs === 0 || $name === 'if') && ($this->process_gedcoms === 0 || $name === 'Gedcom') && ($this->process_repeats === 0 || $name === 'Facts' || $name === 'RepeatTag' || $name === 'List' || $name === 'Relatives')) {
$method = $name . 'EndHandler';
if (method_exists($this, $method)) {
$this->{$method}();
MediaRepository
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class MediaRepository implements MediaRepositoryInterface
{
private ColorService $color_service;
private Tree $tree;
Method historicEventsAll
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function historicEventsAll(): Collection
{
switch (I18N::languageTag()) {
case 'en-AU':
case 'en-GB':
Method getBlock
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
{
$days = (int) $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
$sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
Method handle
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$user = Validator::attributes($request)->user();
$place_id = Validator::attributes($request)->integer('place_id', 0);
Method handle
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$xref = Validator::attributes($request)->isXref()->string('xref');
$xref2 = Validator::attributes($request)->isXref()->string('xref2', '');
Method handle
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$user = Validator::attributes($request)->user();
$xref = Validator::attributes($request)->isXref()->string('xref');
Method handle
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$ip = Validator::attributes($request)->string('client-ip');
$base_url = Validator::attributes($request)->string('base_url');
Method process
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
// Ugly URLs store the path in a query parameter.
$url_route = Validator::queryParams($request)->string('route', '');
Method repeatTagStartHandler
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function repeatTagStartHandler(array $attrs): void
{
$this->process_repeats++;
if ($this->process_repeats > 1) {
return;
Function drawChildren
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
private function drawChildren(Collection $familyList, int $gen = 1, bool $ajax = false): string
{
$html = '';
$children2draw = [];
$f2load = [];
- 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 17 (exceeds 5 allowed). Consider refactoring. Open
Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$fact_id = Validator::parsedBody($request)->string('fact_id');
$indi_xref = Validator::parsedBody($request)->isXref()->string('indi_xref');
$obje_xref = Validator::parsedBody($request)->isXref()->string('obje_xref');
- 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"