fisharebest/webtrees

View on GitHub
app/Report/ReportParserGenerate.php

Summary

Maintainability
F
1 mo
Test Coverage

File ReportParserGenerate.php has 2059 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * webtrees: online genealogy
 * Copyright (C) 2023 webtrees development team
Severity: Major
Found in app/Report/ReportParserGenerate.php - About 5 days to fix

    Function listStartHandler has a Cognitive Complexity of 221 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function listStartHandler(array $attrs): void
        {
            $this->process_repeats++;
            if ($this->process_repeats > 1) {
                return;
    Severity: Minor
    Found in app/Report/ReportParserGenerate.php - About 4 days to fix

    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 listStartHandler has 339 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function listStartHandler(array $attrs): void
        {
            $this->process_repeats++;
            if ($this->process_repeats > 1) {
                return;
    Severity: Major
    Found in app/Report/ReportParserGenerate.php - About 1 day to fix

      ReportParserGenerate has 54 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ReportParserGenerate extends ReportParserBase
      {
          /** Are we collecting data from <Footnote> elements */
          private bool $process_footnote = true;
      
      
      Severity: Major
      Found in app/Report/ReportParserGenerate.php - About 7 hrs to fix

        Function repeatTagStartHandler has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function repeatTagStartHandler(array $attrs): void
            {
                $this->process_repeats++;
                if ($this->process_repeats > 1) {
                    return;
        Severity: Minor
        Found in app/Report/ReportParserGenerate.php - About 7 hrs to fix

        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 relativesStartHandler has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function relativesStartHandler(array $attrs): void
            {
                $this->process_repeats++;
                if ($this->process_repeats > 1) {
                    return;
        Severity: Minor
        Found in app/Report/ReportParserGenerate.php - About 6 hrs to fix

        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 getGedcomValue has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getGedcomValue(string $tag, int $level, string $gedrec): string
            {
                if ($gedrec === '') {
                    return '';
                }
        Severity: Minor
        Found in app/Report/ReportParserGenerate.php - About 6 hrs to fix

        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 gedcomValueStartHandler has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function gedcomValueStartHandler(array $attrs): void
            {
                $id    = '';
                $match = [];
                if (preg_match('/0 @(.+)@/', $this->gedrec, $match)) {
        Severity: Minor
        Found in app/Report/ReportParserGenerate.php - About 5 hrs to fix

        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 addDescendancy has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

            private function addDescendancy(&$list, $pid, $parents = false, $generations = -1): void
            {
                $person = Registry::individualFactory()->make($pid, $this->tree);
                if ($person === null) {
                    return;
        Severity: Minor
        Found in app/Report/ReportParserGenerate.php - About 5 hrs to fix

        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 textBoxStartHandler has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function textBoxStartHandler(array $attrs): void
            {
                // string Background color code
                $bgcolor = '';
                if (!empty($attrs['bgcolor'])) {
        Severity: Minor
        Found in app/Report/ReportParserGenerate.php - About 5 hrs to fix

        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 docStartHandler has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function docStartHandler(array $attrs): void
            {
                $this->parser = $this->xml_parser;
        
                // Custom page width
        Severity: Minor
        Found in app/Report/ReportParserGenerate.php - About 5 hrs to fix

        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 getPersonNameStartHandler has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function getPersonNameStartHandler(array $attrs): void
            {
                $id    = '';
                $match = [];
                if (empty($attrs['id'])) {
        Severity: Minor
        Found in app/Report/ReportParserGenerate.php - About 4 hrs to fix

        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 addAncestors has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            private function addAncestors(array &$list, string $pid, bool $children = false, int $generations = -1): void
            {
                $genlist                = [$pid];
                $list[$pid]->generation = 1;
                while (count($genlist) > 0) {
        Severity: Minor
        Found in app/Report/ReportParserGenerate.php - About 4 hrs to fix

        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 gedcomStartHandler has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function gedcomStartHandler(array $attrs): void
            {
                if ($this->process_gedcoms > 0) {
                    $this->process_gedcoms++;
        
        
        Severity: Minor
        Found in app/Report/ReportParserGenerate.php - About 4 hrs to fix

        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 factsEndHandler has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function factsEndHandler(): void
            {
                $this->process_repeats--;
                if ($this->process_repeats > 0) {
                    return;
        Severity: Minor
        Found in app/Report/ReportParserGenerate.php - About 4 hrs to fix

        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 textBoxStartHandler has 98 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function textBoxStartHandler(array $attrs): void
            {
                // string Background color code
                $bgcolor = '';
                if (!empty($attrs['bgcolor'])) {
        Severity: Major
        Found in app/Report/ReportParserGenerate.php - About 3 hrs to fix

          Method relativesStartHandler has 95 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function relativesStartHandler(array $attrs): void
              {
                  $this->process_repeats++;
                  if ($this->process_repeats > 1) {
                      return;
          Severity: Major
          Found in app/Report/ReportParserGenerate.php - About 3 hrs to fix

            Function listEndHandler has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function listEndHandler(): void
                {
                    $this->process_repeats--;
                    if ($this->process_repeats > 0) {
                        return;
            Severity: Minor
            Found in app/Report/ReportParserGenerate.php - About 3 hrs to fix

            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 cellStartHandler has a Cognitive Complexity of 26 (exceeds 5 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
            Severity: Minor
            Found in app/Report/ReportParserGenerate.php - About 3 hrs to fix

            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 relativesEndHandler has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function relativesEndHandler(): void
                {
                    $this->process_repeats--;
                    if ($this->process_repeats > 0) {
                        return;
            Severity: Minor
            Found in app/Report/ReportParserGenerate.php - About 3 hrs to fix

            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));
                    }
            Severity: Minor
            Found in app/Report/ReportParserGenerate.php - About 3 hrs to fix

            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 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
            Severity: Major
            Found in app/Report/ReportParserGenerate.php - About 3 hrs to fix

              Method factsEndHandler has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function factsEndHandler(): void
                  {
                      $this->process_repeats--;
                      if ($this->process_repeats > 0) {
                          return;
              Severity: Major
              Found in app/Report/ReportParserGenerate.php - About 3 hrs to fix

                Function imageStartHandler has a Cognitive Complexity of 21 (exceeds 5 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);
                
                
                Severity: Minor
                Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                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 listEndHandler has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function listEndHandler(): void
                    {
                        $this->process_repeats--;
                        if ($this->process_repeats > 0) {
                            return;
                Severity: Major
                Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                  Function lineStartHandler has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function lineStartHandler(array $attrs): void
                      {
                          // Start horizontal position, current position (default)
                          $x1 = ReportBaseElement::CURRENT_POSITION;
                          if (isset($attrs['x1'])) {
                  Severity: Minor
                  Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                  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 repeatTagEndHandler has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function repeatTagEndHandler(): void
                      {
                          $this->process_repeats--;
                          if ($this->process_repeats > 0) {
                              return;
                  Severity: Minor
                  Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                  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 relativesEndHandler has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function relativesEndHandler(): void
                      {
                          $this->process_repeats--;
                          if ($this->process_repeats > 0) {
                              return;
                  Severity: Major
                  Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                    Method docStartHandler has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function docStartHandler(array $attrs): void
                        {
                            $this->parser = $this->xml_parser;
                    
                            // Custom page width
                    Severity: Major
                    Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                      Method repeatTagEndHandler has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function repeatTagEndHandler(): void
                          {
                              $this->process_repeats--;
                              if ($this->process_repeats > 0) {
                                  return;
                      Severity: Major
                      Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                        Function factsStartHandler has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function factsStartHandler(array $attrs): void
                            {
                                $this->process_repeats++;
                                if ($this->process_repeats > 1) {
                                    return;
                        Severity: Minor
                        Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                        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 gedcomValueStartHandler has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function gedcomValueStartHandler(array $attrs): void
                            {
                                $id    = '';
                                $match = [];
                                if (preg_match('/0 @(.+)@/', $this->gedrec, $match)) {
                        Severity: Major
                        Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                          Method getGedcomValue has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function getGedcomValue(string $tag, int $level, string $gedrec): string
                              {
                                  if ($gedrec === '') {
                                      return '';
                                  }
                          Severity: Major
                          Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                            Function ifStartHandler has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected function ifStartHandler(array $attrs): void
                                {
                                    if ($this->process_ifs > 0) {
                                        $this->process_ifs++;
                            
                            
                            Severity: Minor
                            Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                            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

                            Consider simplifying this complex logical expression.
                            Open

                                    if (($this->process_footnote || $name === 'Footnote') && ($this->process_ifs === 0 || $name === 'if') && ($this->process_gedcoms === 0 || $name === 'Gedcom') && ($this->process_repeats === 0 || $name === 'Facts' || $name === 'RepeatTag' || $name === 'List' || $name === 'Relatives')) {
                                        $method = $name . 'EndHandler';
                            
                                        if (method_exists($this, $method)) {
                                            $this->{$method}();
                            Severity: Critical
                            Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                              Method repeatTagStartHandler has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function repeatTagStartHandler(array $attrs): void
                                  {
                                      $this->process_repeats++;
                                      if ($this->process_repeats > 1) {
                                          return;
                              Severity: Major
                              Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                                Function setVarStartHandler has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    protected function setVarStartHandler(array $attrs): void
                                    {
                                        if (empty($attrs['name'])) {
                                            throw new DomainException('REPORT ERROR var: The attribute "name" is missing or not set in the XML file');
                                        }
                                Severity: Minor
                                Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                                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 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++;
                                
                                
                                Severity: Major
                                Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                                  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) {
                                  Severity: Minor
                                  Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                                  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 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++;
                                  
                                  
                                  Severity: Major
                                  Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix

                                    Method setVarStartHandler has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        protected function setVarStartHandler(array $attrs): void
                                        {
                                            if (empty($attrs['name'])) {
                                                throw new DomainException('REPORT ERROR var: The attribute "name" is missing or not set in the XML file');
                                            }
                                    Severity: Minor
                                    Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                                      Method addDescendancy has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          private function addDescendancy(&$list, $pid, $parents = false, $generations = -1): void
                                          {
                                              $person = Registry::individualFactory()->make($pid, $this->tree);
                                              if ($person === null) {
                                                  return;
                                      Severity: Minor
                                      Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                                        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);
                                        
                                        
                                        Severity: Minor
                                        Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                                          Method getPersonNameStartHandler has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              protected function getPersonNameStartHandler(array $attrs): void
                                              {
                                                  $id    = '';
                                                  $match = [];
                                                  if (empty($attrs['id'])) {
                                          Severity: Minor
                                          Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                                            Method lineStartHandler has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                protected function lineStartHandler(array $attrs): void
                                                {
                                                    // Start horizontal position, current position (default)
                                                    $x1 = ReportBaseElement::CURRENT_POSITION;
                                                    if (isset($attrs['x1'])) {
                                            Severity: Minor
                                            Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                                              Method factsStartHandler has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                  protected function factsStartHandler(array $attrs): void
                                                  {
                                                      $this->process_repeats++;
                                                      if ($this->process_repeats > 1) {
                                                          return;
                                              Severity: Minor
                                              Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                                                Method varStartHandler has 36 lines of code (exceeds 25 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));
                                                        }
                                                Severity: Minor
                                                Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                                                  Method addAncestors has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                      private function addAncestors(array &$list, string $pid, bool $children = false, int $generations = -1): void
                                                      {
                                                          $genlist                = [$pid];
                                                          $list[$pid]->generation = 1;
                                                          while (count($genlist) > 0) {
                                                  Severity: Minor
                                                  Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                                                    Consider simplifying this complex logical expression.
                                                    Open

                                                            if ($this->process_footnote && ($this->process_ifs === 0 || $name === 'if') && ($this->process_gedcoms === 0 || $name === 'Gedcom') && ($this->process_repeats === 0 || $name === 'Facts' || $name === 'RepeatTag')) {
                                                                $method = $name . 'StartHandler';
                                                    
                                                                if (method_exists($this, $method)) {
                                                                    $this->{$method}($attrs);
                                                    Severity: Critical
                                                    Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                                                      Method highlightedImageStartHandler has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                          protected function highlightedImageStartHandler(array $attrs): void
                                                          {
                                                              $id = '';
                                                              if (preg_match('/0 @(.+)@/', $this->gedrec, $match)) {
                                                                  $id = $match[1];
                                                      Severity: Minor
                                                      Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                                                        Function endElement has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                            protected function endElement($parser, string $name): void
                                                            {
                                                                if (($this->process_footnote || $name === 'Footnote') && ($this->process_ifs === 0 || $name === 'if') && ($this->process_gedcoms === 0 || $name === 'Gedcom') && ($this->process_repeats === 0 || $name === 'Facts' || $name === 'RepeatTag' || $name === 'List' || $name === 'Relatives')) {
                                                                    $method = $name . 'EndHandler';
                                                        
                                                        
                                                        Severity: Minor
                                                        Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                                                        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 getSubRecord has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                            public static function getSubRecord(int $level, string $tag, string $gedrec, int $num = 1): string
                                                            {
                                                                if ($gedrec === '') {
                                                                    return '';
                                                                }
                                                        Severity: Minor
                                                        Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                                                          Avoid deeply nested control flow statements.
                                                          Open

                                                                                              if (!empty($searchstr)) {
                                                                                                  $searchstr .= "[^\n]*(\n[2-9][^\n]*)*\n";
                                                                                              }
                                                          Severity: Major
                                                          Found in app/Report/ReportParserGenerate.php - About 45 mins to fix

                                                            Avoid deeply nested control flow statements.
                                                            Open

                                                                                                if ($t === 'EMAIL' || $t === '_EMAIL') {
                                                                                                    $t = '_?EMAIL';
                                                                                                }
                                                            Severity: Major
                                                            Found in app/Report/ReportParserGenerate.php - About 45 mins to fix

                                                              Avoid deeply nested control flow statements.
                                                              Open

                                                                                          switch ($expr) {
                                                                                              case 'CONTAINS':
                                                                                                  if ($t === 'PLAC') {
                                                                                                      $searchstr .= "[^\n]*[, ]*" . $val;
                                                                                                  } else {
                                                              Severity: Major
                                                              Found in app/Report/ReportParserGenerate.php - About 45 mins to fix

                                                                Avoid deeply nested control flow statements.
                                                                Open

                                                                                                if ($tag === 'EMAIL' || $tag === '_EMAIL') {
                                                                                                    $tag = '_?EMAIL';
                                                                                                }
                                                                Severity: Major
                                                                Found in app/Report/ReportParserGenerate.php - About 45 mins to fix

                                                                  Avoid deeply nested control flow statements.
                                                                  Open

                                                                                              if (empty($subrec)) {
                                                                                                  $level--;
                                                                                                  $subrec = self::getSubRecord($level, "@ $t", $this->gedrec);
                                                                                                  if (empty($subrec)) {
                                                                                                      return;
                                                                  Severity: Major
                                                                  Found in app/Report/ReportParserGenerate.php - About 45 mins to fix

                                                                    Avoid deeply nested control flow statements.
                                                                    Open

                                                                                                    if ($match[1] != '') {
                                                                                                        $names = explode(' ', $match[1]);
                                                                                                        foreach ($names as $name) {
                                                                                                            $query->where($attr . '.n_full', 'LIKE', '%' . addcslashes($name, '\\%_') . '%');
                                                                                                        }
                                                                    Severity: Major
                                                                    Found in app/Report/ReportParserGenerate.php - About 45 mins to fix

                                                                      Function highlightedImageStartHandler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          protected function highlightedImageStartHandler(array $attrs): void
                                                                          {
                                                                              $id = '';
                                                                              if (preg_match('/0 @(.+)@/', $this->gedrec, $match)) {
                                                                                  $id = $match[1];
                                                                      Severity: Minor
                                                                      Found in app/Report/ReportParserGenerate.php - About 35 mins to fix

                                                                      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

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                              return ltrim($subrec);
                                                                      Severity: Major
                                                                      Found in app/Report/ReportParserGenerate.php - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                return '';
                                                                        Severity: Major
                                                                        Found in app/Report/ReportParserGenerate.php - About 30 mins to fix

                                                                          Function getSubRecord has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                              public static function getSubRecord(int $level, string $tag, string $gedrec, int $num = 1): string
                                                                              {
                                                                                  if ($gedrec === '') {
                                                                                      return '';
                                                                                  }
                                                                          Severity: Minor
                                                                          Found in app/Report/ReportParserGenerate.php - About 25 mins to fix

                                                                          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 getCont has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                              public static function getCont(int $nlevel, string $nrec): string
                                                                              {
                                                                                  $text = '';
                                                                          
                                                                                  $subrecords = explode("\n", $nrec);
                                                                          Severity: Minor
                                                                          Found in app/Report/ReportParserGenerate.php - About 25 mins to fix

                                                                          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 footnoteStartHandler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                              protected function footnoteStartHandler(array $attrs): void
                                                                              {
                                                                                  $id = '';
                                                                                  if (preg_match('/[0-9] (.+) @(.+)@/', $this->gedrec, $match)) {
                                                                                      $id = $match[2];
                                                                          Severity: Minor
                                                                          Found in app/Report/ReportParserGenerate.php - About 25 mins to fix

                                                                          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

                                                                          Identical blocks of code found in 2 locations. Consider refactoring.
                                                                          Open

                                                                                  if ($media_file instanceof MediaFile && $media_file->fileExists()) {
                                                                                      $image      = imagecreatefromstring($media_file->fileContents());
                                                                                      $attributes = [imagesx($image), imagesy($image)];
                                                                          
                                                                                      if ($width > 0 && $height == 0) {
                                                                          Severity: Major
                                                                          Found in app/Report/ReportParserGenerate.php and 1 other location - About 7 hrs to fix
                                                                          app/Report/ReportParserGenerate.php on lines 1768..1784

                                                                          Duplicated Code

                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                          Tuning

                                                                          This issue has a mass of 242.

                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                          Refactorings

                                                                          Further Reading

                                                                          Identical blocks of code found in 2 locations. Consider refactoring.
                                                                          Open

                                                                                          if ($media_file instanceof MediaFile && $media_file->fileExists()) {
                                                                                              $image      = imagecreatefromstring($media_file->fileContents());
                                                                                              $attributes = [imagesx($image), imagesy($image)];
                                                                          
                                                                                              if ($width > 0 && $height == 0) {
                                                                          Severity: Major
                                                                          Found in app/Report/ReportParserGenerate.php and 1 other location - About 7 hrs to fix
                                                                          app/Report/ReportParserGenerate.php on lines 1716..1732

                                                                          Duplicated Code

                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                          Tuning

                                                                          This issue has a mass of 242.

                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                          Refactorings

                                                                          Further Reading

                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                          Open

                                                                                                  } elseif (preg_match('/^(?:\w*):PLAC CONTAINS (.+)$/', $value, $match)) {
                                                                                                      // Don't unset this filter. This is just initial filtering for performance
                                                                                                      $query
                                                                                                          ->join('placelinks AS ' . $attr . 'a', static function (JoinClause $join) use ($attr): void {
                                                                                                              $join
                                                                          Severity: Major
                                                                          Found in app/Report/ReportParserGenerate.php and 1 other location - About 5 hrs to fix
                                                                          app/Report/ReportParserGenerate.php on lines 1958..1972

                                                                          Duplicated Code

                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                          Tuning

                                                                          This issue has a mass of 198.

                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                          Refactorings

                                                                          Further Reading

                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                          Open

                                                                                                  } elseif (preg_match('/^(?:\w*):PLAC CONTAINS (.+)$/', $value, $match)) {
                                                                                                      // Don't unset this filter. This is just initial filtering for performance
                                                                                                      $query
                                                                                                          ->join('placelinks AS ' . $attr . 'a', static function (JoinClause $join) use ($attr): void {
                                                                                                              $join
                                                                          Severity: Major
                                                                          Found in app/Report/ReportParserGenerate.php and 1 other location - About 5 hrs to fix
                                                                          app/Report/ReportParserGenerate.php on lines 2052..2066

                                                                          Duplicated Code

                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                          Tuning

                                                                          This issue has a mass of 198.

                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                          Refactorings

                                                                          Further Reading

                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                          Open

                                                                                                  if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
                                                                                                      $query->join('dates AS ' . $attr, static function (JoinClause $join) use ($attr): void {
                                                                                                          $join
                                                                                                              ->on($attr . '.d_gid', '=', 'f_id')
                                                                                                              ->on($attr . '.d_file', '=', 'f_file');
                                                                          Severity: Major
                                                                          Found in app/Report/ReportParserGenerate.php and 1 other location - About 4 hrs to fix
                                                                          app/Report/ReportParserGenerate.php on lines 1917..1982

                                                                          Duplicated Code

                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                          Tuning

                                                                          This issue has a mass of 174.

                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                          Refactorings

                                                                          Further Reading

                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                          Open

                                                                                                  if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
                                                                                                      $query->join('dates AS ' . $attr, static function (JoinClause $join) use ($attr): void {
                                                                                                          $join
                                                                                                              ->on($attr . '.d_gid', '=', 'i_id')
                                                                                                              ->on($attr . '.d_file', '=', 'i_file');
                                                                          Severity: Major
                                                                          Found in app/Report/ReportParserGenerate.php and 1 other location - About 4 hrs to fix
                                                                          app/Report/ReportParserGenerate.php on lines 2003..2076

                                                                          Duplicated Code

                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                          Tuning

                                                                          This issue has a mass of 174.

                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                          Refactorings

                                                                          Further Reading

                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                          Open

                                                                                                  } elseif (preg_match('/^(\w*):(\w+) CONTAINS (.+)$/', $value, $match)) {
                                                                                                      // Don't unset this filter. This is just initial filtering for performance
                                                                                                      $match[3] = strtr($match[3], ['\\' => '\\\\', '%'  => '\\%', '_'  => '\\_', ' ' => '%']);
                                                                                                      $like = "%\n1 " . $match[1] . "%\n2 " . $match[2] . '%' . $match[3] . '%';
                                                                                                      $query->where('f_gedcom', 'LIKE', $like);
                                                                          Severity: Major
                                                                          Found in app/Report/ReportParserGenerate.php and 1 other location - About 2 hrs to fix
                                                                          app/Report/ReportParserGenerate.php on lines 1972..1977

                                                                          Duplicated Code

                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                          Tuning

                                                                          This issue has a mass of 121.

                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                          Refactorings

                                                                          Further Reading

                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                          Open

                                                                                                  } elseif (preg_match('/^(\w*):(\w+) CONTAINS (.+)$/', $value, $match)) {
                                                                                                      // Don't unset this filter. This is just initial filtering for performance
                                                                                                      $match[3] = strtr($match[3], ['\\' => '\\\\', '%'  => '\\%', '_'  => '\\_', ' ' => '%']);
                                                                                                      $like = "%\n1 " . $match[1] . "%\n2 " . $match[2] . '%' . $match[3] . '%';
                                                                                                      $query->where('i_gedcom', 'LIKE', $like);
                                                                          Severity: Major
                                                                          Found in app/Report/ReportParserGenerate.php and 1 other location - About 2 hrs to fix
                                                                          app/Report/ReportParserGenerate.php on lines 2066..2071

                                                                          Duplicated Code

                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                          Tuning

                                                                          This issue has a mass of 121.

                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                          Refactorings

                                                                          Further Reading

                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                          Open

                                                                                      if (preg_match('/^I18N::number\((.+)\)$/', $var, $match)) {
                                                                                          $var = I18N::number((int) $match[1]);
                                                                                      } elseif (preg_match('/^I18N::translate\(\'(.+)\'\)$/', $var, $match)) {
                                                                                          $var = I18N::translate($match[1]);
                                                                                      } elseif (preg_match('/^I18N::translateContext\(\'(.+)\', *\'(.+)\'\)$/', $var, $match)) {
                                                                          Severity: Major
                                                                          Found in app/Report/ReportParserGenerate.php and 1 other location - About 1 hr to fix
                                                                          app/Report/ReportParserGenerate.php on lines 1489..1495

                                                                          Duplicated Code

                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                          Tuning

                                                                          This issue has a mass of 115.

                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                          Refactorings

                                                                          Further Reading

                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                          Open

                                                                                  if (preg_match('/^I18N::number\((.+)\)$/', $value, $match)) {
                                                                                      $value = I18N::number((int) $match[1]);
                                                                                  } elseif (preg_match('/^I18N::translate\(\'(.+)\'\)$/', $value, $match)) {
                                                                                      $value = I18N::translate($match[1]);
                                                                                  } elseif (preg_match('/^I18N::translateContext\(\'(.+)\', *\'(.+)\'\)$/', $value, $match)) {
                                                                          Severity: Major
                                                                          Found in app/Report/ReportParserGenerate.php and 1 other location - About 1 hr to fix
                                                                          app/Report/ReportParserGenerate.php on lines 1278..1284

                                                                          Duplicated Code

                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                          Tuning

                                                                          This issue has a mass of 115.

                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                          Refactorings

                                                                          Further Reading

                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                          Open

                                                                                                  } elseif (preg_match('/^(\w+) CONTAINS (.*)$/', $value, $match)) {
                                                                                                      // Don't unset this filter. This is just initial filtering for performance
                                                                                                      $match[2] = strtr($match[2], ['\\' => '\\\\', '%'  => '\\%', '_'  => '\\_', ' ' => '%']);
                                                                                                      $like = "%\n1 " . $match[1] . '%' . $match[2] . '%';
                                                                                                      $query->where('i_gedcom', 'LIKE', $like);
                                                                          Severity: Major
                                                                          Found in app/Report/ReportParserGenerate.php and 1 other location - About 1 hr to fix
                                                                          app/Report/ReportParserGenerate.php on lines 2071..2076

                                                                          Duplicated Code

                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                          Tuning

                                                                          This issue has a mass of 109.

                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                          Refactorings

                                                                          Further Reading

                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                          Open

                                                                                                  } elseif (preg_match('/^(\w+) CONTAINS (.+)$/', $value, $match)) {
                                                                                                      // Don't unset this filter. This is just initial filtering for performance
                                                                                                      $match[2] = strtr($match[2], ['\\' => '\\\\', '%'  => '\\%', '_'  => '\\_', ' ' => '%']);
                                                                                                      $like = "%\n1 " . $match[1] . '%' . $match[2] . '%';
                                                                                                      $query->where('f_gedcom', 'LIKE', $like);
                                                                          Severity: Major
                                                                          Found in app/Report/ReportParserGenerate.php and 1 other location - About 1 hr to fix
                                                                          app/Report/ReportParserGenerate.php on lines 1977..1982

                                                                          Duplicated Code

                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                          Tuning

                                                                          This issue has a mass of 109.

                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                          Refactorings

                                                                          Further Reading

                                                                          There are no issues that match your filters.

                                                                          Category
                                                                          Status