atelierspierrot/mvc-fundamental

View on GitHub

Showing 33 of 37 total issues

Function distribute has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function distribute($uri, array $arguments = array(), $method = 'get')
    {
        // strip double slashes
        $uri        = str_replace('//', '/', $uri);

Severity: Minor
Found in src/MVCFundamental/Basic/Router.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

File FrontController.php has 323 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * This file is part of the MVC-Fundamental package.
 *
 * Copyright (c) 2013-2016 Pierre Cassat <me@e-piwi.fr> and contributors
Severity: Minor
Found in src/MVCFundamental/FrontController.php - About 3 hrs to fix

    Function callRoute has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        public function callRoute($route, array $arguments = array(), $method = 'get')
        {
            $this->boot();
    
            @list($callback, $params) = $this->get('router')->distribute(
    Severity: Minor
    Found in src/MVCFundamental/FrontController.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

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

        public function callControllerAction($controller = null, $action = null, array $arguments = array())
        {
            $this->boot();
            $controller_name = $controller;
    
    
    Severity: Minor
    Found in src/MVCFundamental/FrontController.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

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

        public static function __callStatic($name, array $arguments)
        {
            // getNew('name')
            if ($name=='getNew') {
                $service_name = isset($arguments[0]) ? $arguments[0] : null;
    Severity: Minor
    Found in src/MVCFundamental/Commons/ServiceContainerProviderTrait.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 callRoute has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function callRoute($route, array $arguments = array(), $method = 'get')
        {
            $this->boot();
    
            @list($callback, $params) = $this->get('router')->distribute(
    Severity: Major
    Found in src/MVCFundamental/FrontController.php - About 2 hrs to fix

      Method boot has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function boot(FrontControllerInterface $app)
          {
              // stores the FrontController
              self::setFrontController($app);
      
      
      Severity: Major
      Found in src/MVCFundamental/AppKernel.php - About 2 hrs to fix

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

            public function callControllerAction($controller = null, $action = null, array $arguments = array())
            {
                $this->boot();
                $controller_name = $controller;
        
        
        Severity: Minor
        Found in src/MVCFundamental/FrontController.php - About 1 hr to fix

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

              public static function boot(FrontControllerInterface $app)
              {
                  // stores the FrontController
                  self::setFrontController($app);
          
          
          Severity: Minor
          Found in src/MVCFundamental/AppKernel.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 __callStatic has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function __callStatic($name, array $arguments)
              {
                  // getNew('name')
                  if ($name=='getNew') {
                      $service_name = isset($arguments[0]) ? $arguments[0] : null;
          Severity: Minor
          Found in src/MVCFundamental/Commons/ServiceContainerProviderTrait.php - About 1 hr to fix

            Method _getExceptionMessage has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function _getExceptionMessage(\Exception $e, $primary = 0)
                {
                    $errno      = $e->getCode();
                    $errstr     = $e->getMessage();
                    $errfile    = $e->getFile();
            Severity: Minor
            Found in src/MVCFundamental/Basic/ErrorController.php - About 1 hr to fix

              Method distribute has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function distribute($uri, array $arguments = array(), $method = 'get')
                  {
                      // strip double slashes
                      $uri        = str_replace('//', '/', $uri);
              
              
              Severity: Minor
              Found in src/MVCFundamental/Basic/Router.php - About 1 hr to fix

                Method defaultLayoutAction has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function defaultLayoutAction(TemplateEngineInterface $template_engine, FrontControllerInterface $app)
                    {
                        $layout     = $template_engine->getDefaultLayout();
                        $req        = $app->get('request')->getBaseUrl();
                        $content    = $template_engine->renderTemplate(self::$views_dir.'lorem_ipsum_content.php');
                Severity: Minor
                Found in demo/src/Demo/DefaultController.php - About 1 hr to fix

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

                      public function locateController($name)
                      {
                          // case $name is a real class name
                          if (is_object($name) || class_exists($name)) {
                              return $name;
                  Severity: Minor
                  Found in src/MVCFundamental/Basic/Locator.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 boot has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function boot()
                      {
                          if (!self::$_is_booted) {
                              if (empty($this->_options['temp_dir'])) {
                                  $this->_options['temp_dir'] =
                  Severity: Minor
                  Found in src/MVCFundamental/FrontController.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 locateController has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function locateController($name)
                      {
                          // case $name is a real class name
                          if (is_object($name) || class_exists($name)) {
                              return $name;
                  Severity: Minor
                  Found in src/MVCFundamental/Basic/Locator.php - About 1 hr to fix

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

                        protected function _prepare()
                        {
                            $this->_match = $this->_route;
                            if (false!==preg_match_all('~{([^}]+)}~', $this->_route, $matches) && count($matches)>1 && !empty($matches[1])) {
                                foreach ($matches[1] as $i=>$item) {
                    Severity: Minor
                    Found in src/MVCFundamental/Basic/Route.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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function __construct($message = '', $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, \Exception $previous = null)
                    Severity: Minor
                    Found in src/MVCFundamental/Exception/ErrorException.php - About 45 mins to fix

                      Method error has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function error($message, $status = 500, $code = 0, $filename = __FILE__, $lineno = __LINE__);
                      Severity: Minor
                      Found in src/MVCFundamental/Interfaces/FrontControllerInterface.php - About 35 mins to fix

                        Method error has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public function error($message, $status = 500, $code = 0, $filename = __FILE__, $lineno = __LINE__)
                        Severity: Minor
                        Found in src/MVCFundamental/FrontController.php - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language