Formula9/Framework

View on GitHub

Showing 120 of 487 total issues

Method importByExtension has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function importByExtension($extension, $filePath, $key = '')
    {
        $extension = strtolower(str_replace('*', '', $extension));

        if ( ! in_array($extension, ['.json', '.php', '.yaml', '.yml'], TRUE)) {
Severity: Minor
Found in Nine/Collections/Config.php - About 1 hr to fix

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

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

          public static function encode_readable_json($data, $indent = 0)
          {
              $_escape = function ($str) {
                  return preg_replace("!([\b\t\n\r\f\"\\'])!", "\\\\\\1", $str);
              };
      Severity: Minor
      Found in Nine/Library/Strings.php - About 1 hr to fix

        Method build has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function build($concrete, array $parameters = [])
            {
                // If the concrete type is actually a Closure, we will just execute it and
                // hand back the results of the functions, which allows functions to be
                // used as resolvers for more fine-tuned resolution of these objects.
        Severity: Minor
        Found in Nine/Containers/Container.php - About 1 hr to fix

          Method getReflection has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getReflection($class, $method = NULL)
              {
                  $reflection = NULL;
          
                  switch ($class) {
          Severity: Minor
          Found in Nine/Support/Reflector.php - About 1 hr to fix

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

                public function getReflection($class, $method = NULL)
                {
                    $reflection = NULL;
            
                    switch ($class) {
            Severity: Minor
            Found in Nine/Support/Reflector.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 data_get has 26 lines of code (exceeds 25 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

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

                  public function register(Container $app)
                  {
                      $app['db.default_options'] = [
                          'driver'   => 'pdo_mysql',
                          'dbname'   => env('DB_DATABASE', NULL),
              Severity: Minor
              Found in F9/Providers/DoctrineServiceProvider.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 importDeclaration has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function importDeclaration($configurationType, $definition)
                  {
                      switch ($configurationType) {
                          case 'add':
                              $this->registerAdds($definition);
              Severity: Minor
              Found in F9/Container/WithConfigurableInjector.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 set_loader has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function set_loader($configuration)
                  {
                      switch (TRUE) {
              
                          case ($this->template_type === static::TWIG_LOADER_ARRAY):
              Severity: Minor
              Found in Nine/Views/TwigView.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 encode_readable_json has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function encode_readable_json($data, $indent = 0)
                  {
                      $_escape = function ($str) {
                          return preg_replace("!([\b\t\n\r\f\"\\'])!", "\\\\\\1", $str);
                      };
              Severity: Minor
              Found in Nine/Library/Strings.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 subRequest has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      string $uri,
                      string $method = 'GET',
                      array $parameters = [],
                      array $cookies = [],
                      array $files = [],
              Severity: Major
              Found in F9/Application/Application.php - About 50 mins to fix

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

                    public static function var_to_string($var)
                    {
                        if (is_object($var)) {
                            return sprintf('Object(%s)', get_class($var));
                        }
                Severity: Minor
                Found in Nine/Library/Strings.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 merge_recursive_replace has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function merge_recursive_replace($key, $value)
                    {
                        // Holds all the arrays passed
                        $params = func_get_args();
                
                
                Severity: Minor
                Found in Nine/Library/Arrays.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 registerInstances has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    private function registerInstances($config, $app, $events, $container, $global_scope)
                Severity: Minor
                Found in F9/Console/ConsoleFactory.php - About 35 mins to fix

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

                      public static function value($array, $key, $default = NULL)
                      {
                          if ($key instanceof \Closure or is_callable($key)) {
                              return $key($array, $default);
                          }
                  Severity: Minor
                  Found in Nine/Library/Support.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 array_forget has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function array_forget(&$array, $keys)
                      {
                          $original = &$array;
                  
                          foreach ((array) $keys as $key) {
                  Severity: Minor
                  Found in Nine/Library/Arrays.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 onKernelRequest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function onKernelRequest(GetResponseEvent $event)
                      {
                          $request = $event->getRequest();
                  
                          $this->setCurrentRequest($request);
                  Severity: Minor
                  Found in F9/Support/Events/Listeners/RouterListener.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 boot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function boot()
                      {
                          if ($this->booted) {
                              return;
                          }
                  Severity: Minor
                  Found in F9/Application/Application.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 NULL;
                  Severity: Major
                  Found in Nine/Library/helpers.php - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language