skqr/hateoas

View on GitHub

Showing 58 of 662 total issues

Function getSortOrder has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSortOrder($field, $relationship = NULL)
    {
        $sortedByRelationship = NULL;

        if (empty($relationship)) {
Severity: Minor
Found in JsonApi/Request/Params.php - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function parseCreateAction has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function parseCreateAction($ids, array $relation)
    {
        if (is_array($ids)) {
            if (!is_array($relation)) {
                throw new ParseException(
Severity: Minor
Found in JsonApi/Request/LinkBodyParser.php - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

        Params $params,
        ResourceEntityInterface $entity,
        array $fields,
        array $relationships = [],
        array $metadata = []
Severity: Minor
Found in Entity/Mutator.php - About 35 mins to fix

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

            $field,
            $resource,
            $message = "",
            $code = 0,
            \Exception $previous = NULL
    Severity: Minor
    Found in JsonApi/Serializer/InvalidFieldException.php - About 35 mins to fix

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

          public function parse(Request $request, Params $params)
          {
              $filters = [];
      
              if (empty($params->primaryClass)) return $filters;
      Severity: Minor
      Found in JsonApi/Request/FilterParser.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          public function parse(Request $request, Params $params, array $body)
          {
              $entity = $params->entities->primary->first();
              $ids = NULL;
      
      
      Severity: Minor
      Found in JsonApi/Request/LinkBodyParser.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          public function serialize(Document $document)
          {
              $json = [];
      
              if (!empty($document->pagination)) {
      Severity: Minor
      Found in JsonApi/Serializer/PaginationMetadataSerializer.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          protected function parseDeleteAction(Params $params, $relation)
          {
              $ids = NULL;
      
              if (!empty($params->relationshipIds)) {
      Severity: Minor
      Found in JsonApi/Request/UnlinkBodyParser.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          private function mineMetadata(array $entities)
          {
              $metadata = NULL;
      
              if (0 < count($entities)) {
      Severity: Minor
      Found in JsonApi/ResourceCollectionFactory.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          public function clean(array $blacklist, $linkOnly)
          {
              $blacklist = array_flip($blacklist);
      
              // Se usa "kind" y no "type" para no confundir con sus otros usos.
      Severity: Minor
      Found in Metadata/Resource/ResourceRelationships.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          public function create()
          {
              $include = NULL;
              $fields = NULL;
      
      
      Severity: Minor
      Found in JsonApi/SerializerFactory.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          protected function getFields(
              $entityClassName,
              ResourceRelationships $relationships
          )
          {
      Severity: Minor
      Found in Metadata/Resource/MiningTools.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          public function serialize(Document $document)
          {
              $json = [];
              $pagination = $document->pagination;
      
      
      Severity: Minor
      Found in JsonApi/Serializer/TopLevelPaginationLinksSerializer.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          public function mergePrimaryResources(array &$champion, array $challenger)
          {
              foreach ($challenger as $key => $value) {
                  if (in_array($key, static::$reservedTopLevel)) continue;
      
      
      Severity: Minor
      Found in JsonApi/Merge/Blender.php - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          private function findTranslations(JsonApi\ResourceCollection $resources)
          {
              $allTranslations = [];
              $repository = $this->em->getRepository(
                  'Gedmo\\Translatable\\Entity\\Translation'
      Severity: Minor
      Found in JsonApi/Serializer/TranslationsMetadataSerializer.php - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          private function canAccessEntities(Params $params, Collection $entities)
          {
              $access = NULL;
      
              if (RequestAction::TARGET_RELATIONSHIP === $params->action->target) {
      Severity: Minor
      Found in JsonApi/Request/ParamEntityFinder.php - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          protected function getRelationships($entityClassName, $primaryType)
          {
              $relationships = new ResourceRelationships;
              $metadata = $this->metadataCache->getMapping($entityClassName);
              $class = $this->metadataCache->getReflection($entityClassName);
      Severity: Minor
      Found in Metadata/Resource/EntityMetadataMiner.php - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          public function serialize()
          {
              $json = [];
      
              foreach ($this->error as $field => $value) {
      Severity: Minor
      Found in JsonApi/ErrorSerializer.php - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Severity
      Category
      Status
      Source
      Language