fisharebest/webtrees

View on GitHub
app/Module/ClippingsCartModule.php

Summary

Maintainability
F
1 wk
Test Coverage

File ClippingsCartModule.php has 772 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * webtrees: online genealogy
 * Copyright (C) 2022 webtrees development team
Severity: Major
Found in app/Module/ClippingsCartModule.php - About 1 day to fix

    ClippingsCartModule has 46 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface
    {
        use ModuleMenuTrait;
    
        // What to add to the cart?
    Severity: Minor
    Found in app/Module/ClippingsCartModule.php - About 6 hrs to fix

      Function postDownloadAction has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          public function postDownloadAction(ServerRequestInterface $request): ResponseInterface
          {
              $tree = Validator::attributes($request)->tree();
      
              if (Auth::isAdmin()) {
      Severity: Minor
      Found in app/Module/ClippingsCartModule.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 postDownloadAction has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function postDownloadAction(ServerRequestInterface $request): ResponseInterface
          {
              $tree = Validator::attributes($request)->tree();
      
              if (Auth::isAdmin()) {
      Severity: Major
      Found in app/Module/ClippingsCartModule.php - About 2 hrs to fix

        Method getMenu has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getMenu(Tree $tree): ?Menu
            {
                $request = app(ServerRequestInterface::class);
                assert($request instanceof ServerRequestInterface);
        
        
        Severity: Minor
        Found in app/Module/ClippingsCartModule.php - About 1 hr to fix

          Method postAddIndividualAction has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function postAddIndividualAction(ServerRequestInterface $request): ResponseInterface
              {
                  $tree = Validator::attributes($request)->tree();
          
                  $params = (array) $request->getParsedBody();
          Severity: Minor
          Found in app/Module/ClippingsCartModule.php - About 1 hr to fix

            Method getAddIndividualAction has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getAddIndividualAction(ServerRequestInterface $request): ResponseInterface
                {
                    $tree = Validator::attributes($request)->tree();
            
                    $xref = $request->getQueryParams()['xref'] ?? '';
            Severity: Minor
            Found in app/Module/ClippingsCartModule.php - About 1 hr to fix

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

                  public function postAddIndividualAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
              
                      $params = (array) $request->getParsedBody();
              Severity: Minor
              Found in app/Module/ClippingsCartModule.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

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

                  protected function addIndividualToCart(Individual $individual): void
                  {
                      $cart = Session::get('cart');
                      $cart = is_array($cart) ? $cart : [];
              
              
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 1 other location - About 4 hrs to fix
              app/Module/ClippingsCartModule.php on lines 1027..1045

              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 163.

              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

                  protected function addLocationToCart(Location $location): void
                  {
                      $cart = Session::get('cart');
                      $cart = is_array($cart) ? $cart : [];
              
              
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 1 other location - About 4 hrs to fix
              app/Module/ClippingsCartModule.php on lines 1004..1022

              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 163.

              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 5 locations. Consider refactoring.
              Open

                  public function getAddLocationAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
              
                      $xref = $request->getQueryParams()['xref'] ?? '';
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 4 other locations - About 3 hrs to fix
              app/Module/ClippingsCartModule.php on lines 721..743
              app/Module/ClippingsCartModule.php on lines 769..791
              app/Module/ClippingsCartModule.php on lines 817..839
              app/Module/ClippingsCartModule.php on lines 930..952

              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 159.

              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 5 locations. Consider refactoring.
              Open

                  public function getAddMediaAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
              
                      $xref = $request->getQueryParams()['xref'] ?? '';
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 4 other locations - About 3 hrs to fix
              app/Module/ClippingsCartModule.php on lines 673..695
              app/Module/ClippingsCartModule.php on lines 769..791
              app/Module/ClippingsCartModule.php on lines 817..839
              app/Module/ClippingsCartModule.php on lines 930..952

              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 159.

              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 5 locations. Consider refactoring.
              Open

                  public function getAddNoteAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
              
                      $xref = $request->getQueryParams()['xref'] ?? '';
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 4 other locations - About 3 hrs to fix
              app/Module/ClippingsCartModule.php on lines 673..695
              app/Module/ClippingsCartModule.php on lines 721..743
              app/Module/ClippingsCartModule.php on lines 817..839
              app/Module/ClippingsCartModule.php on lines 930..952

              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 159.

              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 5 locations. Consider refactoring.
              Open

                  public function getAddSubmitterAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
              
                      $xref = $request->getQueryParams()['xref'] ?? '';
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 4 other locations - About 3 hrs to fix
              app/Module/ClippingsCartModule.php on lines 673..695
              app/Module/ClippingsCartModule.php on lines 721..743
              app/Module/ClippingsCartModule.php on lines 769..791
              app/Module/ClippingsCartModule.php on lines 817..839

              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 159.

              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 5 locations. Consider refactoring.
              Open

                  public function getAddRepositoryAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
              
                      $xref = $request->getQueryParams()['xref'] ?? '';
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 4 other locations - About 3 hrs to fix
              app/Module/ClippingsCartModule.php on lines 673..695
              app/Module/ClippingsCartModule.php on lines 721..743
              app/Module/ClippingsCartModule.php on lines 769..791
              app/Module/ClippingsCartModule.php on lines 930..952

              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 159.

              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 3 locations. Consider refactoring.
              Open

                  protected function addMediaToCart(Media $media): void
                  {
                      $cart = Session::get('cart');
                      $cart = is_array($cart) ? $cart : [];
              
              
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 2 other locations - About 2 hrs to fix
              app/Module/ClippingsCartModule.php on lines 1173..1188
              app/Module/ClippingsCartModule.php on lines 1209..1223

              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 136.

              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 3 locations. Consider refactoring.
              Open

                  protected function addSubmitterToCart(Submitter $submitter): void
                  {
                      $cart = Session::get('cart');
                      $cart = is_array($cart) ? $cart : [];
                      $tree = $submitter->tree()->name();
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 2 other locations - About 2 hrs to fix
              app/Module/ClippingsCartModule.php on lines 1066..1081
              app/Module/ClippingsCartModule.php on lines 1173..1188

              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 136.

              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 3 locations. Consider refactoring.
              Open

                  protected function addRepositoryToCart(Repository $repository): void
                  {
                      $cart = Session::get('cart');
                      $cart = is_array($cart) ? $cart : [];
              
              
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 2 other locations - About 2 hrs to fix
              app/Module/ClippingsCartModule.php on lines 1066..1081
              app/Module/ClippingsCartModule.php on lines 1209..1223

              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 136.

              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 ($individual->sex() === 'F') {
                          $options = [
                              self::ADD_RECORD_ONLY       => $name,
                              self::ADD_PARENT_FAMILIES   => I18N::translate('%s, her parents and siblings', $name),
                              self::ADD_SPOUSE_FAMILIES   => I18N::translate('%s, her spouses and children', $name),
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 1 other location - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 561..570

              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 107.

              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

                      } else {
                          $options = [
                              self::ADD_RECORD_ONLY       => $name,
                              self::ADD_PARENT_FAMILIES   => I18N::translate('%s, his parents and siblings', $name),
                              self::ADD_SPOUSE_FAMILIES   => I18N::translate('%s, his spouses and children', $name),
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 1 other location - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 552..570

              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 107.

              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 4 locations. Consider refactoring.
              Open

                  public function postAddLocationAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
              
                      $xref = $request->getQueryParams()['xref'] ?? '';
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 3 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 750..762
              app/Module/ClippingsCartModule.php on lines 798..810
              app/Module/ClippingsCartModule.php on lines 959..971

              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 105.

              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 4 locations. Consider refactoring.
              Open

                  public function postAddSubmitterAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
              
                      $xref = $request->getQueryParams()['xref'] ?? '';
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 3 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 702..714
              app/Module/ClippingsCartModule.php on lines 750..762
              app/Module/ClippingsCartModule.php on lines 798..810

              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 105.

              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 4 locations. Consider refactoring.
              Open

                  public function postAddMediaAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
              
                      $xref = $request->getQueryParams()['xref'] ?? '';
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 3 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 702..714
              app/Module/ClippingsCartModule.php on lines 798..810
              app/Module/ClippingsCartModule.php on lines 959..971

              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 105.

              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 4 locations. Consider refactoring.
              Open

                  public function postAddNoteAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
              
                      $xref = $request->getQueryParams()['xref'] ?? '';
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 3 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 702..714
              app/Module/ClippingsCartModule.php on lines 750..762
              app/Module/ClippingsCartModule.php on lines 959..971

              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 105.

              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 6 locations. Consider refactoring.
              Open

                  protected function addSubmitterLinksToCart(GedcomRecord $record): void
                  {
                      preg_match_all('/\n\d SUBM @(' . Gedcom::REGEX_XREF . ')@/', $record->gedcom(), $matches);
              
                      foreach ($matches[1] as $xref) {
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 5 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 1050..1061
              app/Module/ClippingsCartModule.php on lines 1086..1097
              app/Module/ClippingsCartModule.php on lines 1120..1131
              app/Module/ClippingsCartModule.php on lines 1157..1168
              app/Module/ClippingsCartModule.php on lines 1193..1204

              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 100.

              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 6 locations. Consider refactoring.
              Open

                  protected function addSourceLinksToCart(GedcomRecord $record): void
                  {
                      preg_match_all('/\n\d SOUR @(' . Gedcom::REGEX_XREF . ')@/', $record->gedcom(), $matches);
              
                      foreach ($matches[1] as $xref) {
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 5 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 1050..1061
              app/Module/ClippingsCartModule.php on lines 1086..1097
              app/Module/ClippingsCartModule.php on lines 1120..1131
              app/Module/ClippingsCartModule.php on lines 1193..1204
              app/Module/ClippingsCartModule.php on lines 1228..1239

              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 100.

              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 6 locations. Consider refactoring.
              Open

                  protected function addMediaLinksToCart(GedcomRecord $record): void
                  {
                      preg_match_all('/\n\d OBJE @(' . Gedcom::REGEX_XREF . ')@/', $record->gedcom(), $matches);
              
                      foreach ($matches[1] as $xref) {
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 5 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 1050..1061
              app/Module/ClippingsCartModule.php on lines 1120..1131
              app/Module/ClippingsCartModule.php on lines 1157..1168
              app/Module/ClippingsCartModule.php on lines 1193..1204
              app/Module/ClippingsCartModule.php on lines 1228..1239

              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 100.

              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 6 locations. Consider refactoring.
              Open

                  protected function addLocationLinksToCart(GedcomRecord $record): void
                  {
                      preg_match_all('/\n\d _LOC @(' . Gedcom::REGEX_XREF . ')@/', $record->gedcom(), $matches);
              
                      foreach ($matches[1] as $xref) {
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 5 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 1086..1097
              app/Module/ClippingsCartModule.php on lines 1120..1131
              app/Module/ClippingsCartModule.php on lines 1157..1168
              app/Module/ClippingsCartModule.php on lines 1193..1204
              app/Module/ClippingsCartModule.php on lines 1228..1239

              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 100.

              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 6 locations. Consider refactoring.
              Open

                  protected function addNoteLinksToCart(GedcomRecord $record): void
                  {
                      preg_match_all('/\n\d NOTE @(' . Gedcom::REGEX_XREF . ')@/', $record->gedcom(), $matches);
              
                      foreach ($matches[1] as $xref) {
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 5 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 1050..1061
              app/Module/ClippingsCartModule.php on lines 1086..1097
              app/Module/ClippingsCartModule.php on lines 1157..1168
              app/Module/ClippingsCartModule.php on lines 1193..1204
              app/Module/ClippingsCartModule.php on lines 1228..1239

              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 100.

              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 6 locations. Consider refactoring.
              Open

                  protected function addRepositoryLinksToCart(GedcomRecord $record): void
                  {
                      preg_match_all('/\n\d REPO @(' . Gedcom::REGEX_XREF . '@)/', $record->gedcom(), $matches);
              
                      foreach ($matches[1] as $xref) {
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 5 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 1050..1061
              app/Module/ClippingsCartModule.php on lines 1086..1097
              app/Module/ClippingsCartModule.php on lines 1120..1131
              app/Module/ClippingsCartModule.php on lines 1157..1168
              app/Module/ClippingsCartModule.php on lines 1228..1239

              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 100.

              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