mdmsoft/yii2-admin

View on GitHub
models/Route.php

Summary

Maintainability
C
1 day
Test Coverage

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

    public function getRoutes()
    {
        $manager = Configs::authManager();
        // Get advanced configuration
        $advanced = Configs::instance()->advanced;
Severity: Minor
Found in models/Route.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 getControllerFiles has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getControllerFiles($module, $namespace, $prefix, &$result)
    {
        $path = Yii::getAlias('@' . str_replace('\\', '/', $namespace), false);
        $token = "Get controllers from '$path'";
        Yii::beginProfile($token, __METHOD__);
Severity: Minor
Found in models/Route.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 getRoutes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getRoutes()
    {
        $manager = Configs::authManager();
        // Get advanced configuration
        $advanced = Configs::instance()->advanced;
Severity: Minor
Found in models/Route.php - About 1 hr to fix

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

        public function addNew($routes)
        {
            $manager = Configs::authManager();
            foreach ($routes as $route) {
                try {
    Severity: Minor
    Found in models/Route.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 addNew has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function addNew($routes)
        {
            $manager = Configs::authManager();
            foreach ($routes as $route) {
                try {
    Severity: Minor
    Found in models/Route.php - About 1 hr to fix

      Method getControllerFiles has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getControllerFiles($module, $namespace, $prefix, &$result)
          {
              $path = Yii::getAlias('@' . str_replace('\\', '/', $namespace), false);
              $token = "Get controllers from '$path'";
              Yii::beginProfile($token, __METHOD__);
      Severity: Minor
      Found in models/Route.php - About 1 hr to fix

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

            protected function getActionRoutes($controller, &$result)
            {
                $token = "Get actions of controller '" . $controller->uniqueId . "'";
                Yii::beginProfile($token, __METHOD__);
                try {
        Severity: Minor
        Found in models/Route.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 getAppRoutes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getAppRoutes($module = null)
            {
                if ($module === null) {
                    $module = Yii::$app;
                } elseif (is_string($module)) {
        Severity: Minor
        Found in models/Route.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

        There are no issues that match your filters.

        Category
        Status