fisharebest/webtrees

View on GitHub
app/Factories/GedcomRecordFactory.php

Summary

Maintainability
C
1 day
Test Coverage

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]) {
Severity: Minor
Found in app/Factories/GedcomRecordFactory.php - About 1 hr to fix

    Method newGedcomRecord has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        private function newGedcomRecord(string $type, string $xref, string $gedcom, string|null $pending, Tree $tree): GedcomRecord
    Severity: Minor
    Found in app/Factories/GedcomRecordFactory.php - About 35 mins to fix

      Avoid too many return statements within this method.
      Open

                          return Registry::repositoryFactory()->make($xref, $tree, $gedcom);
      Severity: Major
      Found in app/Factories/GedcomRecordFactory.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return Registry::sourceFactory()->make($xref, $tree, $gedcom);
        Severity: Major
        Found in app/Factories/GedcomRecordFactory.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return Registry::noteFactory()->make($xref, $tree, $gedcom);
          Severity: Major
          Found in app/Factories/GedcomRecordFactory.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return Registry::submitterFactory()->make($xref, $tree, $gedcom);
            Severity: Major
            Found in app/Factories/GedcomRecordFactory.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return Registry::submitterFactory()->new($xref, $gedcom, $pending, $tree);
              Severity: Major
              Found in app/Factories/GedcomRecordFactory.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                    return Registry::mediaFactory()->make($xref, $tree, $gedcom);
                Severity: Major
                Found in app/Factories/GedcomRecordFactory.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return Registry::noteFactory()->new($xref, $gedcom, $pending, $tree);
                  Severity: Major
                  Found in app/Factories/GedcomRecordFactory.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return
                                Registry::familyFactory()->make($xref, $tree, $gedcom) ??
                                Registry::individualFactory()->make($xref, $tree, $gedcom) ??
                                Registry::mediaFactory()->make($xref, $tree, $gedcom) ??
                                Registry::noteFactory()->make($xref, $tree, $gedcom) ??
                    Severity: Major
                    Found in app/Factories/GedcomRecordFactory.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return Registry::repositoryFactory()->new($xref, $gedcom, $pending, $tree);
                      Severity: Major
                      Found in app/Factories/GedcomRecordFactory.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                            return Registry::submissionFactory()->make($xref, $tree, $gedcom);
                        Severity: Major
                        Found in app/Factories/GedcomRecordFactory.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return Registry::submissionFactory()->new($xref, $gedcom, $pending, $tree);
                          Severity: Major
                          Found in app/Factories/GedcomRecordFactory.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return Registry::sourceFactory()->new($xref, $gedcom, $pending, $tree);
                            Severity: Major
                            Found in app/Factories/GedcomRecordFactory.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return $this->new($xref, $gedcom, $pending, $tree);
                              Severity: Major
                              Found in app/Factories/GedcomRecordFactory.php - About 30 mins to fix

                                There are no issues that match your filters.

                                Category
                                Status