Showing 1,726 of 2,403 total issues
Function handle
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$this->layout = 'layouts/administration';
$tree = Validator::attributes($request)->tree();
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$xref = Validator::attributes($request)->isXref()->string('xref');
$individual = Registry::individualFactory()->make($xref, $tree);
- 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 facts
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function facts(
array $filter = [],
bool $sort = false,
int|null $access_level = null,
bool $ignore_deleted = false
- 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 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function historicEventsAll(): Collection
{
switch (I18N::languageTag()) {
case 'de':
return new Collection([
Method getBlock
has 47 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();
$default_events = implode(',', self::DEFAULT_EVENTS);
Method boundingRectangle
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function boundingRectangle(): array
{
if ($this->id() === null) {
return [[-180.0, -90.0], [180.0, 90.0]];
}
Method chartAge
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function chartAge(): string
{
$out = [];
foreach ($this->queryRecords() as $record) {
$out[$record->century][$record->sex] = $record->age;
Method chartMarriageAge
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function chartMarriageAge(): string
{
$out = [];
foreach ($this->queryRecords() as $record) {
Method oldStyleRelationshipPath
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function oldStyleRelationshipPath(Tree $tree, array $path): array
{
$spouse_codes = [
'M' => 'hus',
'F' => 'wif',
Method alphabet
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function alphabet(): array
{
return [
'A',
UTF8::LATIN_CAPITAL_LETTER_A_WITH_ACUTE,
Method legacyCousinName2
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function legacyCousinName2(int $n, string $sex, string $relation): string
{
if ($sex === 'M') {
switch ($n) {
case 1:
Method handleCollection
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleCollection(ServerRequestInterface $request, Collection $collection, array $search_columns, array $sort_columns, Closure $callback): ResponseInterface
{
$search = Validator::queryParams($request)->array('search')['value'] ?? '';
$start = Validator::queryParams($request)->integer('start', 0);
$length = Validator::queryParams($request)->integer('length', 0);
Method handle
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$mail_ssl_options = $this->email_service->mailSslOptions();
$mail_transport_options = $this->email_service->mailTransportOptions();
Method handle
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$search = Validator::parsedBody($request)->string('search');
$replace = Validator::parsedBody($request)->string('replace');
Method ageBetweenSpousesQuery
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function ageBetweenSpousesQuery(string $age_dir, int $total): array
{
$query = DB::table('families')
->where('f_file', '=', $this->tree->id())
->join('dates AS wife', static function (JoinClause $join): void {
Method imageStartHandler
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function imageStartHandler(array $attrs): void
{
// Position the top corner of this box on the page. the default is the current position
$top = (float) ($attrs['top'] ?? ReportBaseElement::CURRENT_POSITION);
Method make
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function make(string $xref, Tree $tree, string|null $gedcom = null): GedcomRecord|null
{
// We know the type of the record. Return it directly.
if ($gedcom !== null && preg_match('/^0(?: @[^@]+@)? ([A-Z_]+)/', $gedcom, $match)) {
switch ($match[1]) {
Method search
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function search(ServerRequestInterface $request): Collection
{
$tree = Validator::attributes($request)->tree();
$query = Validator::queryParams($request)->string('query');
$xref = Validator::queryParams($request)->string('extra', '');
Method handle
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$params = $request->getQueryParams();
$params['tree'] = $tree->name();
Method editLinesToGedcom
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function editLinesToGedcom(string $record_type, array $levels, array $tags, array $values, bool $append = true): string
{
// Assert all arrays are the same size.
$count = count($levels);
assert($count > 0);