GoIntegro/hateoas

View on GitHub

Showing 64 of 64 total issues

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

Method parse has 31 lines of code (exceeds 25 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

    Method parse has 30 lines of code (exceeds 25 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 1 hr to fix

      Method getRelationships has 30 lines of code (exceeds 25 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 1 hr to fix

        Method getResourceLinks has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getResourceLinks(EntityResource $resource)
            {
                $links = [];
        
                foreach (
        Severity: Minor
        Found in JsonApi/Serializer/ResourceObjectSerializer.php - About 1 hr to fix

          Method parseDeleteAction has 29 lines of code (exceeds 25 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 1 hr to fix

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

                private function processLinkedResources(
                    ResourceCollectionInterface $resources,
                    array $include,
                    LinkedResourcesSerialization $resourcesSerialization,
                    $depth = 0
            Severity: Minor
            Found in JsonApi/Serializer/LinkedResourcesSerializer.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 create has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Method parse has 26 lines of code (exceeds 25 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 1 hr to fix

                Function updateTranslations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function updateTranslations(
                        ResourceEntityInterface $entity, array $translations
                    )
                    {
                        $repository = $this->em->getRepository(self::TRANSLATION_ENTITY);
                Severity: Minor
                Found in Entity/DefaultMutator.php - About 55 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 mergeTopLevelLinks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

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

                    private function processToManyRelationship(
                        ResourceCollectionInterface $resources,
                        $relationshipName,
                        array &$linkedResources,
                        LinkedResourcesSerialization $resourcesSerialization
                Severity: Minor
                Found in JsonApi/Serializer/LinkedResourcesSerializer.php - About 55 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 serializeObject has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function serializeObject($object)
                    {
                        $json = NULL;
                
                        if ($object instanceof \JsonSerializable) {
                Severity: Minor
                Found in JsonApi/Serializer/ObjectFieldValueSerializer.php - About 55 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 filter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function filter(
                        QueryBuilder $qb, array $filters, $alias = 'e'
                    ) {
                        $expressions = [];
                        foreach ($filters as $type => $filter) {
                Severity: Minor
                Found in JsonApi/Request/DefaultFilter.php - About 55 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 __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        JsonCoder $jsonCoder,
                        Raml\DocNavigator $docNavigator,
                        ResourceLinksHydrant $hydrant,
                        CreateBodyParser $creationBodyParser,
                        UpdateBodyParser $mutationBodyParser,
                Severity: Major
                Found in JsonApi/Request/BodyParser.php - About 50 mins to fix

                  Method findPaginated has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          $entityClass,
                          array $criteria,
                          $sorting = [],
                          $offset = Request\Params::DEFAULT_PAGE_OFFSET,
                          $limit = Request\Params::DEFAULT_PAGE_SIZE,
                  Severity: Minor
                  Found in Util/RepositoryHelper.php - About 45 mins to fix

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

                        public function create()
                        {
                            $include = NULL;
                            $fields = NULL;
                    
                    
                    Severity: Minor
                    Found in JsonApi/DocumentFactory.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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            $class, $type, $subtype, $kind, $name, $mappingField
                    Severity: Minor
                    Found in Metadata/Resource/ResourceRelationship.php - About 45 mins to fix

                      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

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

                          public function __construct(
                              DocumentResource $documentResource,
                              ResourceCache $resourceCache,
                              array $include = [],
                              array $sparseFields = [],
                      Severity: Minor
                      Found in JsonApi/Document.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

                      Severity
                      Category
                      Status
                      Source
                      Language