atelierspierrot/mvc-fundamental

View on GitHub
src/MVCFundamental/FrontController.php

Summary

Maintainability
D
2 days
Test Coverage

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

    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 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 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 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

          Avoid too many return statements within this method.
          Open

                                  return $this->render($view_file, $arguments);
          Severity: Major
          Found in src/MVCFundamental/FrontController.php - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status