skqr/hateoas-bundle

View on GitHub

Showing 191 of 191 total issues

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

        try {
            $params = $this->get('hateoas.request_parser')->parse($this->getRequest());
        } catch (NotFoundException $e) {
            throw new NotFoundHttpException($e->getMessage(), $e);
        } catch (ActionNotAllowedException $e) {
Severity: Major
Found in Controller/MagicAlterController.php and 1 other location - About 5 hrs to fix
Controller/MagicAlterController.php on lines 213..231

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

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

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

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

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

Refactorings

Further Reading

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

        try {
            $params = $this->get('hateoas.request_parser')->parse($this->getRequest());
        } catch (NotFoundException $e) {
            throw new NotFoundHttpException($e->getMessage(), $e);
        } catch (ActionNotAllowedException $e) {
Severity: Major
Found in Controller/MagicAlterController.php and 1 other location - About 5 hrs to fix
Controller/MagicAlterController.php on lines 134..152

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

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

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

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

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

Refactorings

Further Reading

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

        try {
            $params = $this->get('hateoas.request_parser')
                ->parse($this->getRequest());
        } catch (NotFoundException $e) {
            throw new NotFoundHttpException($e->getMessage(), $e);
Severity: Major
Found in Controller/MagicAlterController.php and 1 other location - About 4 hrs to fix
Controller/MagicAlterController.php on lines 295..311

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

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

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

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

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

Refactorings

Further Reading

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

        try {
            $params = $this->get('hateoas.request_parser')->parse($this->getRequest());
        } catch (NotFoundException $e) {
            throw new NotFoundHttpException($e->getMessage(), $e);
        } catch (ActionNotAllowedException $e) {
Severity: Major
Found in Controller/MagicAlterController.php and 1 other location - About 4 hrs to fix
Controller/MagicAlterController.php on lines 71..88

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

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

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

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

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

Refactorings

Further Reading

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

        try {
            foreach ($params->entities->primary as &$entity) {
                $data = $params->resources[$entity->getId()];
                $links = $this->extractLinks($data);
                $metadata = $this->extractMetadata($data);
Severity: Major
Found in Controller/MagicAlterController.php and 1 other location - About 4 hrs to fix
Controller/MagicAlterController.php on lines 236..258

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

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

        try {
            foreach ($params->entities->primary as &$entity) {
                $data = $params->resources[$entity->getId()];
                $links = $this->extractLinks($data);
                $metadata = $this->extractMetadata($data);
Severity: Major
Found in Controller/MagicAlterController.php and 1 other location - About 4 hrs to fix
Controller/MagicAlterController.php on lines 93..115

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

The class MagicAlterController has an overall complexity of 50 which is very high. The configured complexity threshold is 50.
Open

class MagicAlterController extends SymfonyController
{
    use CommonResponseTrait;

    const ERROR_ACCESS_DENIED = "Access to the resource was denied.",
Severity: Minor
Found in Controller/MagicAlterController.php by phpmd

Method updateAction has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function updateAction($primaryType, $ids)
    {
        try {
            $params = $this->get('hateoas.request_parser')->parse($this->getRequest());
        } catch (NotFoundException $e) {
Severity: Major
Found in Controller/MagicAlterController.php - About 2 hrs to fix

    Method getConfigTreeBuilder has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getConfigTreeBuilder()
        {
            $treeBuilder = new TreeBuilder();
            $rootNode = $treeBuilder->root('go_integro_hateoas');
    
    
    Severity: Major
    Found in DependencyInjection/Configuration.php - About 2 hrs to fix

      Method createAction has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createAction($primaryType)
          {
              try {
                  $params = $this->get('hateoas.request_parser')->parse($this->getRequest());
              } catch (NotFoundException $e) {
      Severity: Major
      Found in Controller/MagicAlterController.php - About 2 hrs to fix

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

        <?php
        /**
         * @copyright 2014 Integ S.A.
         * @license http://opensource.org/licenses/MIT The MIT License (MIT)
         * @author Javier Lorenzana <javier.lorenzana@gointegro.com>
        Severity: Major
        Found in DependencyInjection/Compiler/FilterCompilerPass.php and 1 other location - About 2 hrs to fix
        DependencyInjection/Compiler/LocaleCompilerPass.php on lines 1..39

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

        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

        <?php
        /**
         * @copyright 2014 Integ S.A.
         * @license http://opensource.org/licenses/MIT The MIT License (MIT)
         * @author Javier Lorenzana <javier.lorenzana@gointegro.com>
        Severity: Major
        Found in DependencyInjection/Compiler/LocaleCompilerPass.php and 1 other location - About 2 hrs to fix
        DependencyInjection/Compiler/FilterCompilerPass.php on lines 1..39

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

        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

        File MagicAlterController.php has 254 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * @copyright 2014 Integ S.A.
         * @license http://opensource.org/licenses/MIT The MIT License (MIT)
         * @author Javier Lorenzana <javier.lorenzana@gointegro.com>
        Severity: Minor
        Found in Controller/MagicAlterController.php - About 2 hrs to fix

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

                  try {
                      $params = $this->get('hateoas.request_parser')->parse($this->getRequest());
                  } catch (NotFoundException $e) {
                      throw new NotFoundHttpException($e->getMessage(), $e);
                  } catch (ActionNotAllowedException $e) {
          Severity: Major
          Found in Controller/MagicFetchController.php and 3 other locations - About 2 hrs to fix
          Controller/MagicFetchController.php on lines 114..126
          Controller/MagicFetchController.php on lines 153..165
          Controller/MagicFetchController.php on lines 199..211

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

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

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

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

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

          Refactorings

          Further Reading

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

                  try {
                      $params = $this->get('hateoas.request_parser')->parse($this->getRequest());
                  } catch (NotFoundException $e) {
                      throw new NotFoundHttpException($e->getMessage(), $e);
                  } catch (ActionNotAllowedException $e) {
          Severity: Major
          Found in Controller/MagicFetchController.php and 3 other locations - About 2 hrs to fix
          Controller/MagicFetchController.php on lines 58..70
          Controller/MagicFetchController.php on lines 114..126
          Controller/MagicFetchController.php on lines 199..211

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

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

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

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

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

          Refactorings

          Further Reading

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

                  try {
                      $params = $this->get('hateoas.request_parser')->parse($this->getRequest());
                  } catch (NotFoundException $e) {
                      throw new NotFoundHttpException($e->getMessage(), $e);
                  } catch (ActionNotAllowedException $e) {
          Severity: Major
          Found in Controller/MagicFetchController.php and 3 other locations - About 2 hrs to fix
          Controller/MagicFetchController.php on lines 58..70
          Controller/MagicFetchController.php on lines 153..165
          Controller/MagicFetchController.php on lines 199..211

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

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

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

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

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

          Refactorings

          Further Reading

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

                  try {
                      $params = $this->get('hateoas.request_parser')->parse($this->getRequest());
                  } catch (NotFoundException $e) {
                      throw new NotFoundHttpException($e->getMessage(), $e);
                  } catch (ActionNotAllowedException $e) {
          Severity: Major
          Found in Controller/MagicFetchController.php and 3 other locations - About 2 hrs to fix
          Controller/MagicFetchController.php on lines 58..70
          Controller/MagicFetchController.php on lines 114..126
          Controller/MagicFetchController.php on lines 153..165

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

          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

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

              public function linkAction($primaryType, $id, $relationship, $ids = NULL)
              {
                  try {
                      $params = $this->get('hateoas.request_parser')
                          ->parse($this->getRequest());
          Severity: Minor
          Found in Controller/MagicAlterController.php - About 1 hr to fix

            Function createAction has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                public function createAction($primaryType)
                {
                    try {
                        $params = $this->get('hateoas.request_parser')->parse($this->getRequest());
                    } catch (NotFoundException $e) {
            Severity: Minor
            Found in Controller/MagicAlterController.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

            Function updateAction has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                public function updateAction($primaryType, $ids)
                {
                    try {
                        $params = $this->get('hateoas.request_parser')->parse($this->getRequest());
                    } catch (NotFoundException $e) {
            Severity: Minor
            Found in Controller/MagicAlterController.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

            Severity
            Category
            Status
            Source
            Language