GoIntegro/hateoas

View on GitHub

Showing 64 of 64 total issues

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

    public function parse(Request $request, Params $params)
    {
        $sorting = [];
        if (!$request->query->has('sort')) return $sorting;
        if (empty($params->primaryClass)) return $sorting;
Severity: Minor
Found in JsonApi/Request/SortingParser.php - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

    public function parse(Request $request, Params $params, array $body)
    {
        $entityData = [];

        if (empty($body[$params->primaryType])) {
Severity: Minor
Found in JsonApi/Request/UpdateBodyParser.php - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method processLinkedResources has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function processLinkedResources(
        ResourceCollectionInterface $resources,
        array $include,
        LinkedResourcesSerialization $resourcesSerialization,
        $depth = 0
Severity: Major
Found in JsonApi/Serializer/LinkedResourcesSerializer.php - About 2 hrs to fix

    Function findTranslations has a Cognitive Complexity of 14 (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 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Method parse has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function parse(Request $request)
        {
            $content = $request->getContent();
    
            if (!empty($content) && self::HTTP_DELETE == $request->getMethod()) {
    Severity: Minor
    Found in JsonApi/Request/Parser.php - About 1 hr to fix

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

          protected function serializeTransationObject(array $resourceTranslations)
          {
              $translations = [];
      
              foreach (
      Severity: Minor
      Found in JsonApi/Request/TranslationsParser.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 setRelationships has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function setRelationships(
              \ReflectionClass $class,
              ResourceEntityInterface $entity,
              array $relationships
          )
      Severity: Minor
      Found in Entity/AltersEntities.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 sort has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public function sort(
              QueryBuilder $qb, array $sorts, $alias = 'e'
          ) {
              foreach($sorts as $type => $sorting) {
                  foreach($sorting as $resourceName => $sort) {
      Severity: Minor
      Found in JsonApi/Request/DefaultSorting.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 mergeResourceMeta has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public function mergeResourceMeta(array &$champion, array $challenger)
          {
              static $key = 'meta';
      
              if (isset($champion[$key]) || isset($challenger[$key])) {
      Severity: Minor
      Found in JsonApi/Merge/Blender.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 hydrate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public function hydrate(Params $params, array &$resourceObject)
          {
              if (empty($resourceObject[self::LINKS])) {
                  return;
              } elseif (!is_array($resourceObject[self::LINKS])) {
      Severity: Minor
      Found in JsonApi/Request/ResourceLinksHydrant.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 mergeLinkedResources has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public function mergeLinkedResources(array &$champion, array $challenger)
          {
              static $key = 'linked';
      
              if (isset($champion[$key]) || isset($challenger[$key])) {
      Severity: Minor
      Found in JsonApi/Merge/Blender.php - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public function serialize()
          {
              $metadata = $this->resource->getMetadata();
              $json = [
                  'id' => $this->resource->id,
      Severity: Minor
      Found in JsonApi/Serializer/ResourceObjectSerializer.php - About 1 hr to fix

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

            private function processToManyRelationship(
                ResourceCollectionInterface $resources,
                $relationshipName,
                array &$linkedResources,
                LinkedResourcesSerialization $resourcesSerialization
        Severity: Minor
        Found in JsonApi/Serializer/LinkedResourcesSerializer.php - About 1 hr to fix

          Method parse has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function parse(Request $request, Params $params, array $body)
              {
                  $entityData = [];
          
                  if (empty($body[$params->primaryType])) {
          Severity: Minor
          Found in JsonApi/Request/UpdateBodyParser.php - About 1 hr to fix

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

                public function parse(Request $request, Params $params, array $body)
                {
                    $translations = [];
            
                    if (
            Severity: Minor
            Found in JsonApi/Request/TranslationsParser.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 parse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function parse(Request $request, Params $params, array $body)
                {
                    $entityData = [];
            
                    if (empty($body[$params->primaryType])) {
            Severity: Minor
            Found in JsonApi/Request/CreateBodyParser.php - About 1 hr to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                    ResourceEntityMapper $resourceEntityMapper,
                    DocNavigator $docNavigator,
                    FilterParser $filterParser,
                    SortingParser $sortingParser,
                    PaginationParser $paginationParser,
            Severity: Major
            Found in JsonApi/Request/Parser.php - About 1 hr to fix

              Method hydrate has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function hydrate(Params $params, array &$resourceObject)
                  {
                      if (empty($resourceObject[self::LINKS])) {
                          return;
                      } elseif (!is_array($resourceObject[self::LINKS])) {
              Severity: Minor
              Found in JsonApi/Request/ResourceLinksHydrant.php - About 1 hr to fix

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

                    private function processToOneRelationship(
                        ResourceCollectionInterface $resources,
                        $relationshipName,
                        array &$linkedResources,
                        LinkedResourcesSerialization $resourcesSerialization
                Severity: Minor
                Found in JsonApi/Serializer/LinkedResourcesSerializer.php - About 1 hr to fix

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

                      public function serialize(JsonApi\Document $document)
                      {
                          $json = [];
                  
                          if ($document->i18n) {
                  Severity: Minor
                  Found in JsonApi/Serializer/TranslationsMetadataSerializer.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