Showing 1,726 of 2,403 total issues
Method values
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function values(string $sex = 'U'): array
{
$values = [
'M' => [
'' => '',
Method customSubTags
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function customSubTags(): array
{
$custom_family_tags = array_filter(explode(',', Site::getPreference('CUSTOM_FAMILY_TAGS')));
$custom_individual_tags = array_filter(explode(',', Site::getPreference('CUSTOM_INDIVIDUAL_TAGS')));
Method handle
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$this->layout = 'layouts/administration';
$filesystem = new Filesystem(new LocalFilesystemAdapter(Webtrees::ROOT_DIR));
Function individualBoxFacts
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function individualBoxFacts(Individual $individual): string
{
$html = '';
$opt_tags = preg_split('/\W/', $individual->tree()->getPreference('CHART_BOX_TAGS'), 0, PREG_SPLIT_NO_EMPTY);
- 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 make
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function make(string $date): AbstractCalendarDate
{
// Valid calendar escape specified? - use it
if (preg_match('/^(@#D(?:GREGORIAN|JULIAN|HEBREW|HIJRI|JALALI|FRENCH R|ROMAN)+@) ?(.*)/', $date, $match)) {
$cal = $match[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 process
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. 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', '');
- 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 varStartHandler
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
protected function varStartHandler(array $attrs): void
{
if (empty($attrs['var'])) {
throw new DomainException('REPORT ERROR var: The attribute "var=" is missing or not set in the XML file on line: ' . xml_get_current_line_number($this->parser));
}
- 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 SiteMapModule.php
has 301 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Method daitchMokotoffWord
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function daitchMokotoffWord(string $name): array
{
// Apply special transformation rules to the input string
$name = I18N::strtoupper($name);
foreach (self::TRANSFORM_NAMES as $transformRule) {
File BranchesListModule.php
has 299 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Auth
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Auth
{
// Privacy constants
public const PRIV_PRIVATE = 2; // Allows visitors to view the item
public const PRIV_USER = 1; // Allows members to access the item
PdfRenderer
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class PdfRenderer extends AbstractRenderer
{
/**
* PDF compression - Zlib extension is required
*
Method getBlock
has 79 lines of code (exceeds 25 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');
Method handle
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$this->layout = 'layouts/administration';
$tree = Validator::attributes($request)->tree();
Method cellStartHandler
has 79 lines of code (exceeds 25 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
File SetupWizard.php
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Method detect
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function detect(string $header): EncodingInterface|null
{
$utf_bom = [
'/^' . UTF8::BYTE_ORDER_MARK . '/' => UTF8::NAME,
'/^' . UTF16BE::BYTE_ORDER_MARK . '/' => UTF16BE::NAME,
Method handle
has 78 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) {
Function updateTree
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
TreeViewHandler.prototype.updateTree = function (center, button) {
var tv = this; // Store "this" for usage within jQuery functions where "this" is not this ;-)
var to_load = [];
var elts = [];
this.getSize();
- 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 getBlock
has 77 lines of code (exceeds 25 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);