Showing 1,726 of 2,403 total issues
Function commonCountriesList
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function commonCountriesList(): string
{
$countries = DB::table('places')
->join('placelinks', static function (JoinClause $join): void {
$join
- 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 17 (exceeds 5 allowed). Consider refactoring. Open
public function render($renderer, bool $attrib = true): void
{
// Set up the style
if ($renderer->getCurrentStyle() !== $this->styleName) {
$renderer->setCurrentStyle($this->styleName);
- 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 setVarStartHandler
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function setVarStartHandler(array $attrs): void
{
if (empty($attrs['name'])) {
throw new DomainException('REPORT ERROR var: The attribute "name" is missing or not set in the XML file');
}
- 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 historicEventsAll
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function historicEventsAll(): Collection
{
switch (I18N::languageTag()) {
case 'nl':
return new Collection([
Method handle
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$xref = Validator::attributes($request)->isXref()->string('xref');
$fact_id = Validator::attributes($request)->string('fact_id');
Method render
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render($renderer): void
{
static $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright;
// Check for a pagebreak first
Method usersLoggedInQuery
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function usersLoggedInQuery(string $type): string
{
$content = '';
$anonymous = 0;
$logged_in = [];
Method getBlock
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
{
$default_events = implode(',', self::DEFAULT_EVENTS);
$days = (int)$this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
Method historicEventsAll
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function historicEventsAll(): Collection
{
switch (I18N::languageTag()) {
case 'en-AU':
case 'en-GB':
Method handle
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$parent_id = $request->getAttribute('parent_id');
if ($parent_id === null) {
File Registry.php
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Validator
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Validator
{
/** @var array<int|string|Tree|UserInterface|array<int|string>> */
private array $parameters;
ModuleService
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class ModuleService
{
// Components are pieces of user-facing functionality, are managed together in the control panel.
private const COMPONENTS = [
ModuleAnalyticsInterface::class,
Method getMapData
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getMapData(ServerRequestInterface $request): array
{
$facts = $this->getPedigreeMapFacts($request, $this->chart_service);
$geojson = [
Method leafletJsTileLayers
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function leafletJsTileLayers(): array
{
$api_key = $this->getPreference('api_key');
if ($api_key === '') {
Method tags
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function tags(): array
{
return [
'FAM:*:_EVN' => new CustomElement('Event number'),
'FAM:CHIL:_FREL' => new CustomElement(I18N::translate('Relationship to father')),
Method postDownloadAction
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function postDownloadAction(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
if (Auth::isAdmin()) {
Method handle
has 53 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();
$aliases = Validator::queryParams($request)->boolean('aliases', false);
Method searchIndividualsPhonetic
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function searchIndividualsPhonetic(string $soundex, string $lastname, string $firstname, string $place, array $search_trees): Collection
{
switch ($soundex) {
default:
case 'Russell':
Method columns
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function columns(): array
{
return [
new CensusColumnFullName($this, 'Name', 'Name of head of family'),
new CensusColumnNull($this, 'M0', 'Free white males 0-5 years'),