Showing 1,726 of 2,403 total issues
Method getWidth
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getWidth($renderer): array
{
// Setup the style name, a font must be selected to calculate the width
$renderer->setCurrentStyle('footnotenum');
Method commonGivenQuery
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function commonGivenQuery(string $sex, string $type, bool $show_tot, int $threshold, int $maxtoshow)
{
$query = DB::table('name')
->join('individuals', static function (JoinClause $join): void {
$join
Method docStartHandler
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function docStartHandler(array $attrs): void
{
$this->parser = $this->xml_parser;
// Custom page width
Method make
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
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];
Method getCalendarEvents
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getCalendarEvents(int $jd1, int $jd2, string $facts, Tree $tree, string $filterof = '', string $filtersx = ''): array
{
// Events that start or end during the period
$query = DB::table('dates')
->where('d_file', '=', $tree->id())
Method getWidth
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getWidth($renderer): array
{
// Setup the style name, a font must be selected to calculate the width
if ($renderer->getCurrentStyle() !== $this->styleName) {
$renderer->setCurrentStyle($this->styleName);
Method getWidth
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getWidth($renderer): array
{
// Setup the style name, a font must be selected to calculate the width
if ($renderer->getCurrentStyle() !== $this->styleName) {
$renderer->setCurrentStyle($this->styleName);
Method handle
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$ignore_facts = [
'INDI:NAME',
'INDI:SEX',
Method createMediaObject
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function createMediaObject(string $gedcom, Tree $tree): string
{
preg_match('/\n\d FILE (.+)/', $gedcom, $match);
$file = $match[1] ?? '';
Method repeatTagEndHandler
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function repeatTagEndHandler(): void
{
$this->process_repeats--;
if ($this->process_repeats > 0) {
return;
Function paginateQuery
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
private function paginateQuery(Builder $query, Closure $row_mapper, Closure $row_filter, int $offset, int $limit): Collection
{
$collection = new Collection();
foreach ($query->cursor() as $row) {
- 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 factsStartHandler
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function factsStartHandler(array $attrs): void
{
$this->process_repeats++;
if ($this->process_repeats > 1) {
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 historicEventsAll
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function historicEventsAll(): Collection
{
switch (I18N::languageTag()) {
case 'en-AU':
case 'en-GB':
Method process
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$ua = Validator::serverParams($request)->string('HTTP_USER_AGENT', '');
$ip = Validator::attributes($request)->string('client-ip');
$address = IPFactory::parseAddressString($ip);
Method webtreesSubTags
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function webtreesSubTags(): array
{
return [
'FAM' => [['_UID', '0:M']],
'FAM:*:SOUR:DATA' => [['TEXT', '0:1']],
Method gedcomValueStartHandler
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function gedcomValueStartHandler(array $attrs): void
{
$id = '';
$match = [];
if (preg_match('/0 @(.+)@/', $this->gedrec, $match)) {
File GedcomL.php
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Method chart
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Method handle
has 63 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();
$style = Validator::attributes($request)->isInArrayKeys($this->styles())->string('style');
Method getGedcomValue
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getGedcomValue(string $tag, int $level, string $gedrec): string
{
if ($gedrec === '') {
return '';
}