devstackphp/di

View on GitHub

Showing 21 of 21 total issues

Method parseValue has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected static function parseValue($value)
    {
        $value = trim($value, ', ');

        $isNumberOrBool = function (&$value) {
Severity: Minor
Found in src/Definition/Source/PhpDocReader.php - About 1 hr to fix

    Function parseValue has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected static function parseValue($value)
        {
            $value = trim($value, ', ');
    
            $isNumberOrBool = function (&$value) {
    Severity: Minor
    Found in src/Definition/Source/PhpDocReader.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 setMethods has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        private function setMethods(\ReflectionClass $class, ObjectDefinition $objectDefinition)
        {
            $isConstructor = false;
            $methodName    = [];
            foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
    Severity: Minor
    Found in src/Definition/Source/Annotation.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 getPropertyClass has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getPropertyClass(\ReflectionProperty $property)
        {
            $propertyComment = $property->getDocComment();
            if (!preg_match('/@var\s+([^\s\(\*\/]+)/', $propertyComment, $matches)) {
                return;
    Severity: Minor
    Found in src/Definition/Source/PhpDocReader.php - About 1 hr to fix

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

          private function readProperties(\ReflectionClass $class, ObjectDefinition $object)
          {
              $namespace = $class->getNamespaceName();
              foreach ($class->getProperties() as $property) {
                  if ($property->isStatic()) {
      Severity: Minor
      Found in src/Definition/Source/Annotation.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 setMethods has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function setMethods(\ReflectionClass $class, ObjectDefinition $objectDefinition)
          {
              $isConstructor = false;
              $methodName    = [];
              foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
      Severity: Minor
      Found in src/Definition/Source/Annotation.php - About 1 hr to fix

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

            public function get($name)
            {
                $service = $name;
                $name    = strtolower($name);
        
        
        Severity: Minor
        Found in src/Container.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 getPropertyClass has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getPropertyClass(\ReflectionProperty $property)
            {
                $propertyComment = $property->getDocComment();
                if (!preg_match('/@var\s+([^\s\(\*\/]+)/', $propertyComment, $matches)) {
                    return;
        Severity: Minor
        Found in src/Definition/Source/PhpDocReader.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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function get($name)
            {
                if ($this->has($name)) {
                    return $this->definitions[$name];
                }
        Severity: Minor
        Found in src/Definition/Source/Autowiring.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

        Avoid too many return statements within this method.
        Open

                return $autowiring($name);
        Severity: Major
        Found in src/Definition/Source/Autowiring.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return false;
          Severity: Major
          Found in src/Definition/Source/PhpDocReader.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return $object;
            Severity: Major
            Found in src/Definition/Source/Autowiring.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return $value;
              Severity: Major
              Found in src/Definition/Source/PhpDocReader.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return $createNewObject($propertyComment, $className, $classWithNamespace);
                Severity: Major
                Found in src/Definition/Source/PhpDocReader.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return true;
                  Severity: Major
                  Found in src/Definition/Source/PhpDocReader.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return $value;
                    Severity: Major
                    Found in src/Definition/Source/PhpDocReader.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return $isBool($value);
                      Severity: Major
                      Found in src/Definition/Source/PhpDocReader.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return $value;
                        Severity: Major
                        Found in src/Definition/Source/PhpDocReader.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return true;
                          Severity: Major
                          Found in src/Definition/Source/PhpDocReader.php - About 30 mins to fix

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

                                public function getParametersDefinition(\ReflectionFunctionAbstract $constructor)
                                {
                                    $parameters = [];
                            
                                    foreach ($constructor->getParameters() as $index => $parameter) {
                            Severity: Minor
                            Found in src/Definition/Source/Autowiring.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