Showing 1,726 of 2,403 total issues
Method getAllNames
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAllNames(): array
{
if ($this->getAllNames === []) {
// Check the script used by each name, so we can match cyrillic with cyrillic, greek with greek, etc.
$husb_names = [];
Method ifStartHandler
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function ifStartHandler(array $attrs): void
{
if ($this->process_ifs > 0) {
$this->process_ifs++;
Function label
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function label(): string
{
if (str_ends_with($this->tag(), ':NOTE') && preg_match('/^@' . Gedcom::REGEX_XREF . '@$/', $this->value())) {
return I18N::translate('Shared note');
}
- 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 fromUtf8
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function fromUtf8(string $text): string
{
$out = '';
$len = strlen($text);
- 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 detect
has a Cognitive Complexity of 16 (exceeds 5 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,
- 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 cleanFiles
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function cleanFiles(FilesystemOperator $filesystem, Collection $folders_to_clean, Collection $files_to_keep): void
{
foreach ($folders_to_clean as $folder_to_clean) {
try {
foreach ($filesystem->listContents($folder_to_clean, FilesystemReader::LIST_DEEP) as $path) {
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$parent_id = $request->getAttribute('parent_id');
if ($parent_id === null) {
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
// Fatal errors. We may be out of memory, so do not create any variables.
register_shutdown_function(static function (): void {
if (error_get_last() !== null && error_get_last()['type'] & E_ERROR) {
- 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 startElement
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function startElement($parser, string $name, array $attrs): void
{
$newattrs = [];
foreach ($attrs as $key => $value) {
- 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 significantIndividual
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function significantIndividual(UserInterface $user, string $xref = ''): Individual
{
if ($xref === '') {
$individual = null;
} else {
- 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 handle
has 52 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();
Method all
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function all(): Collection
{
return Registry::cache()->array()->remember('all-trees', static function (): Collection {
// All trees
$query = DB::table('gedcom')
Method queryRecords
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function queryRecords(): Collection
{
$male = DB::table('dates as married')
->select([
new Expression('AVG(' . DB::prefix('married.d_julianday2') . ' - ' . DB::prefix('birth.d_julianday1') . ' - 182.5) / 365.25 AS age'),
Method gedcomStartHandler
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function gedcomStartHandler(array $attrs): void
{
if ($this->process_gedcoms > 0) {
$this->process_gedcoms++;
Method handle
has 51 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 isRelated
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function isRelated(Individual $target, int $distance): bool
{
static $cache = null;
$user_individual = Registry::individualFactory()->make($target->tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF), $target->tree);
Method upgrade
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function upgrade(): void
{
// These tables were created by webtrees 1.x, and may not exist if we first installed webtrees 2.x
DB::schema()->dropIfExists('site_access_rule');
DB::schema()->dropIfExists('next_id');
Method updateFact
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateFact(string $fact_id, string $gedcom, bool $update_chan): void
{
// Not all record types allow a CHAN event.
$update_chan = $update_chan && in_array(static::RECORD_TYPE, Gedcom::RECORDS_WITH_CHAN, true);
Method handle
has 50 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();
Method leafletJsTileLayers
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function leafletJsTileLayers(): array
{
$api_key = $this->getPreference('api_key');
if ($api_key === '') {