fisharebest/webtrees

View on GitHub
app/Module/ClippingsCartModule.php

Summary

Maintainability
F
1 wk
Test Coverage

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

<?php

/**
 * webtrees: online genealogy
 * Copyright (C) 2023 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 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getMenu(Tree $tree): Menu|null
            {
                $request = Registry::container()->get(ServerRequestInterface::class);
                $route   = Validator::attributes($request)->route();
                $cart    = Session::get('cart');
        Severity: Minor
        Found in app/Module/ClippingsCartModule.php - About 1 hr to fix

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

              public function postAddIndividualAction(ServerRequestInterface $request): ResponseInterface
              {
                  $tree   = Validator::attributes($request)->tree();
                  $xref   = Validator::parsedBody($request)->isXref()->string('xref');
                  $option = Validator::parsedBody($request)->string('option');
          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       = Validator::queryParams($request)->isXref()->string('xref');
                    $individual = Registry::individualFactory()->make($xref, $tree);
            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();
                      $xref   = Validator::parsedBody($request)->isXref()->string('xref');
                      $option = Validator::parsedBody($request)->string('option');
              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 5 locations. Consider refactoring.
              Open

                  public function getAddNoteAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
                      $xref = Validator::queryParams($request)->isXref()->string('xref');
                      $note = Registry::noteFactory()->make($xref, $tree);
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 4 other locations - About 4 hrs to fix
              app/Module/ClippingsCartModule.php on lines 646..666
              app/Module/ClippingsCartModule.php on lines 690..710
              app/Module/ClippingsCartModule.php on lines 778..798
              app/Module/ClippingsCartModule.php on lines 882..902

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

              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  = Validator::queryParams($request)->isXref()->string('xref');
                      $media = Registry::mediaFactory()->make($xref, $tree);
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 4 other locations - About 4 hrs to fix
              app/Module/ClippingsCartModule.php on lines 646..666
              app/Module/ClippingsCartModule.php on lines 734..754
              app/Module/ClippingsCartModule.php on lines 778..798
              app/Module/ClippingsCartModule.php on lines 882..902

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

              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     = Validator::queryParams($request)->isXref()->string('xref');
                      $location = Registry::locationFactory()->make($xref, $tree);
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 4 other locations - About 4 hrs to fix
              app/Module/ClippingsCartModule.php on lines 690..710
              app/Module/ClippingsCartModule.php on lines 734..754
              app/Module/ClippingsCartModule.php on lines 778..798
              app/Module/ClippingsCartModule.php on lines 882..902

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

              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      = Validator::queryParams($request)->isXref()->string('xref');
                      $submitter = Registry::submitterFactory()->make($xref, $tree);
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 4 other locations - About 4 hrs to fix
              app/Module/ClippingsCartModule.php on lines 646..666
              app/Module/ClippingsCartModule.php on lines 690..710
              app/Module/ClippingsCartModule.php on lines 734..754
              app/Module/ClippingsCartModule.php on lines 778..798

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

              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       = Validator::queryParams($request)->isXref()->string('xref');
                      $repository = Registry::repositoryFactory()->make($xref, $tree);
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 4 other locations - About 4 hrs to fix
              app/Module/ClippingsCartModule.php on lines 646..666
              app/Module/ClippingsCartModule.php on lines 690..710
              app/Module/ClippingsCartModule.php on lines 734..754
              app/Module/ClippingsCartModule.php on lines 882..902

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

              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 952..970

              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 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 975..993

              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 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 1121..1136
              app/Module/ClippingsCartModule.php on lines 1157..1171

              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 1014..1029
              app/Module/ClippingsCartModule.php on lines 1157..1171

              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 1014..1029
              app/Module/ClippingsCartModule.php on lines 1121..1136

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

                  public function postAddMediaAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree  = Validator::attributes($request)->tree();
                      $xref  = Validator::queryParams($request)->isXref()->string('xref');
                      $media = Registry::mediaFactory()->make($xref, $tree);
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 3 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 673..683
              app/Module/ClippingsCartModule.php on lines 761..771
              app/Module/ClippingsCartModule.php on lines 909..919

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

              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      = Validator::queryParams($request)->isXref()->string('xref');
                      $submitter = Registry::submitterFactory()->make($xref, $tree);
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 3 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 673..683
              app/Module/ClippingsCartModule.php on lines 717..727
              app/Module/ClippingsCartModule.php on lines 761..771

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

              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     = Validator::queryParams($request)->isXref()->string('xref');
                      $location = Registry::locationFactory()->make($xref, $tree);
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 3 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 717..727
              app/Module/ClippingsCartModule.php on lines 761..771
              app/Module/ClippingsCartModule.php on lines 909..919

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

              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 = Validator::queryParams($request)->isXref()->string('xref');
                      $note = Registry::noteFactory()->make($xref, $tree);
              Severity: Major
              Found in app/Module/ClippingsCartModule.php and 3 other locations - About 1 hr to fix
              app/Module/ClippingsCartModule.php on lines 673..683
              app/Module/ClippingsCartModule.php on lines 717..727
              app/Module/ClippingsCartModule.php on lines 909..919

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

              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 528..546

              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

                      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 537..546

              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 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 998..1009
              app/Module/ClippingsCartModule.php on lines 1034..1045
              app/Module/ClippingsCartModule.php on lines 1105..1116
              app/Module/ClippingsCartModule.php on lines 1141..1152
              app/Module/ClippingsCartModule.php on lines 1176..1187

              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 998..1009
              app/Module/ClippingsCartModule.php on lines 1034..1045
              app/Module/ClippingsCartModule.php on lines 1068..1079
              app/Module/ClippingsCartModule.php on lines 1105..1116
              app/Module/ClippingsCartModule.php on lines 1176..1187

              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 1034..1045
              app/Module/ClippingsCartModule.php on lines 1068..1079
              app/Module/ClippingsCartModule.php on lines 1105..1116
              app/Module/ClippingsCartModule.php on lines 1141..1152
              app/Module/ClippingsCartModule.php on lines 1176..1187

              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 998..1009
              app/Module/ClippingsCartModule.php on lines 1034..1045
              app/Module/ClippingsCartModule.php on lines 1068..1079
              app/Module/ClippingsCartModule.php on lines 1141..1152
              app/Module/ClippingsCartModule.php on lines 1176..1187

              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 998..1009
              app/Module/ClippingsCartModule.php on lines 1068..1079
              app/Module/ClippingsCartModule.php on lines 1105..1116
              app/Module/ClippingsCartModule.php on lines 1141..1152
              app/Module/ClippingsCartModule.php on lines 1176..1187

              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 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 998..1009
              app/Module/ClippingsCartModule.php on lines 1034..1045
              app/Module/ClippingsCartModule.php on lines 1068..1079
              app/Module/ClippingsCartModule.php on lines 1105..1116
              app/Module/ClippingsCartModule.php on lines 1141..1152

              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