Formula9/Framework

View on GitHub

Showing 487 of 487 total issues

File Container.php has 547 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php namespace Nine\Containers;

/**
 * **A Dependency Injection and Service Locator container.**
 *
Severity: Major
Found in Nine/Containers/Container.php - About 1 day to fix

    Container has 62 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Container implements ArrayAccess, ContainerContract
    {
        /**
         * The contextual binding map.
         *
    Severity: Major
    Found in Nine/Containers/Container.php - About 1 day to fix

      Method register has 192 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function register(Container $app)
          {
              $app['profiler.mount_prefix'] = '/_profiler';
              $app->extend('dispatcher', function ($dispatcher, $app) {
                  return new TraceableEventDispatcher($dispatcher, $app['stopwatch'], $app['logger']);
      Severity: Major
      Found in F9/Providers/F9WebProfilerServiceProvider.php - About 7 hrs to fix

        File Arrays.php has 391 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php namespace Nine\Library;
        
        /**
         * @package Nine Library
         * @version 0.3.1
        Severity: Minor
        Found in Nine/Library/Arrays.php - About 5 hrs to fix

          Function register has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              public function register(Container $app)
              {
                  // only register if twig templates are enabled by the framework
                  if ($this->config['view.twig.enabled']) {
          
          
          Severity: Minor
          Found in F9/Providers/TwigViewServiceProvider.php - About 4 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 data_set has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function data_set(&$target, $key, $value, $overwrite = TRUE)
              {
                  $segments = is_array($key) ? $key : explode('.', $key);
          
                  if (($segment = array_shift($segments)) === '*') {
          Severity: Minor
          Found in Nine/Library/Support.php - About 3 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 register has 91 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function register(Container $app)
              {
                  // only register if twig templates are enabled by the framework
                  if ($this->config['view.twig.enabled']) {
          
          
          Severity: Major
          Found in F9/Providers/TwigViewServiceProvider.php - About 3 hrs to fix

            The class Container has an overall complexity of 136 which is very high. The configured complexity threshold is 50.
            Open

            class Container implements ArrayAccess, ContainerContract
            {
                /**
                 * The contextual binding map.
                 *
            Severity: Minor
            Found in Nine/Containers/Container.php by phpmd

            The class Container has 44 non-getter- and setter-methods. Consider refactoring Container to keep number of methods under 25.
            Open

            class Container implements ArrayAccess, ContainerContract
            {
                /**
                 * The contextual binding map.
                 *
            Severity: Minor
            Found in Nine/Containers/Container.php by phpmd

            TooManyMethods

            Since: 0.1

            A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

            By default it ignores methods starting with 'get' or 'set'.

            The default was changed from 10 to 25 in PHPMD 2.3.

            Example

            Source https://phpmd.org/rules/codesize.html#toomanymethods

            The class Container has 31 public methods. Consider refactoring Container to keep number of public methods under 10.
            Open

            class Container implements ArrayAccess, ContainerContract
            {
                /**
                 * The contextual binding map.
                 *
            Severity: Minor
            Found in Nine/Containers/Container.php by phpmd

            TooManyPublicMethods

            Since: 0.1

            A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

            By default it ignores methods starting with 'get' or 'set'.

            Example

            Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

            The class Potion has 12 public methods. Consider refactoring Potion to keep number of public methods under 10.
            Open

            class Potion implements ContainerContract, \ArrayAccess
            {
                use WithInjectorArrayAccess, WithConfigurableInjector;
            
                /**
            Severity: Minor
            Found in F9/Container/Potion.php by phpmd

            TooManyPublicMethods

            Since: 0.1

            A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

            By default it ignores methods starting with 'get' or 'set'.

            Example

            Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

            Method register has 74 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function register(Container $app)
                {
                    $app['db.default_options'] = [
                        'driver'   => 'pdo_mysql',
                        'dbname'   => env('DB_DATABASE', NULL),
            Severity: Major
            Found in F9/Providers/DoctrineServiceProvider.php - About 2 hrs to fix

              Function register has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function register(Container $app)
                  {
                      $app['profiler.mount_prefix'] = '/_profiler';
                      $app->extend('dispatcher', function ($dispatcher, $app) {
                          return new TraceableEventDispatcher($dispatcher, $app['stopwatch'], $app['logger']);
              Severity: Minor
              Found in F9/Providers/F9WebProfilerServiceProvider.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

              File F9WebProfilerServiceProvider.php has 276 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /*
               * This file is part of the Silex framework.
               *
              Severity: Minor
              Found in F9/Providers/F9WebProfilerServiceProvider.php - About 2 hrs to fix

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

                    public function getMethodArguments(Request $request, $controller, array $parameters) : array
                    {
                        // use this request
                        $this->current_request = $request;
                
                
                Severity: Minor
                Found in Nine/Support/Reflector.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 parseItem has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function parseItem(Container $container, $name)
                    {
                        try {
                            $element = $container[$name];
                        } catch (\Exception $e) {
                Severity: Major
                Found in F9/Providers/PimpleDumpProvider.php - About 2 hrs to fix

                  Function parseItem has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function parseItem(Container $container, $name)
                      {
                          try {
                              $element = $container[$name];
                          } catch (\Exception $e) {
                  Severity: Minor
                  Found in F9/Providers/PimpleDumpProvider.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 data_get has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function data_get($target, $key, $default = NULL)
                      {
                          if (NULL === $key) {
                              return $target;
                          }
                  Severity: Minor
                  Found in Nine/Library/Support.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 extract_dependencies has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function extract_dependencies($class, $method = NULL)
                      {
                          // collect the request attributes
                          $attributes = $this->current_request->attributes->all();
                  
                  
                  Severity: Minor
                  Found in Nine/Support/Reflector.php - About 1 hr to fix

                    Avoid excessively long variable names like $outOfRequestScopeTypes. Keep variable name length under 20.
                    Open

                        private $outOfRequestScopeTypes = [];
                    Severity: Minor
                    Found in F9/Providers/PimpleDumpProvider.php by phpmd

                    LongVariable

                    Since: 0.2

                    Detects when a field, formal or local variable is declared with a long name.

                    Example

                    class Something {
                        protected $reallyLongIntName = -3; // VIOLATION - Field
                        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                            $otherReallyLongName = -5; // VIOLATION - Local
                            for ($interestingIntIndex = 0; // VIOLATION - For
                                 $interestingIntIndex < 10;
                                 $interestingIntIndex++ ) {
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#longvariable

                    Severity
                    Category
                    Status
                    Source
                    Language