Showing 5 of 5 total issues

Function findAllSorted has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function findAllSorted($className, array $sorting, array $filterValues, array $filerOperators)
    {
        $fields = array_keys($this->getClassMetadata($className)->fieldMappings);
        $repository = $this->objectManager->getRepository($className);

Severity: Minor
Found in src/Halapi/ObjectManager/DoctrineOrmObjectManager.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 __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        UrlGeneratorInterface $urlGenerator,
        ObjectManagerInterface $objectManager,
        ServerRequestInterface $request,
        PagerInterface $pager,
        AnnotationReaderInterface $annotationReader
Severity: Minor
Found in src/Halapi/Factory/PaginationFactory.php - About 35 mins to fix

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

        private function parseSorting($sort)
        {
            $parsed = [];
    
            if ($sort) {
    Severity: Minor
    Found in src/Halapi/Factory/PaginationFactory.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 getRelation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getRelation($resource)
        {
            $this->classMetadata = $this->objectManager->getClassMetadata(get_class($resource));
            $this->reflectionClass = new \ReflectionClass($resource);
            $links = $this->getSelfLink($resource);
    Severity: Minor
    Found in src/Halapi/Relation/LinksRelation.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 getRelations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getRelations($resource)
        {
            $resourceRelations = [];
    
            foreach ($this->relations as $relation) {
    Severity: Minor
    Found in src/Halapi/Factory/RelationFactory.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