atelierspierrot/mvc-fundamental

View on GitHub

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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        public function renderLayout(array $params = array())
        {
            $params = array_merge($this->getParams(), $params);
    
            $children = array();
    Severity: Major
    Found in src/MVCFundamental/Commons/DefaultLayout.php and 1 other location - About 3 hrs to fix
    src/MVCFundamental/Basic/Layout.php on lines 200..216

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 142.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        public function renderLayout(array $params = array())
        {
            $params = array_merge($this->getParams(), $params);
    
            $children = array();
    Severity: Major
    Found in src/MVCFundamental/Basic/Layout.php and 1 other location - About 3 hrs to fix
    src/MVCFundamental/Commons/DefaultLayout.php on lines 67..83

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 142.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  <?php if (!empty($contents)) : ?>
                      <?php foreach ($contents as $_content) : ?>
                      <div class="sidebar-module">
                          <?php if (is_array($_content)) : ?>
                              <?php if (isset($_content['title']) && !empty($_content['title'])) : ?>
                  Severity: Major
                  Found in src/MVCFundamental/Resources/templates/layout_extra.php and 1 other location - About 1 hr to fix
                  src/MVCFundamental/Resources/templates/layout_aside.php on lines 60..75

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 105.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  <?php if (!empty($contents)) : ?>
                      <?php foreach ($contents as $_content) : ?>
                          <div class="sidebar-module">
                              <?php if (is_array($_content)) : ?>
                                  <?php if (isset($_content['title']) && !empty($_content['title'])) : ?>
                  Severity: Major
                  Found in src/MVCFundamental/Resources/templates/layout_aside.php and 1 other location - About 1 hr to fix
                  src/MVCFundamental/Resources/templates/layout_extra.php on lines 75..90

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 105.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  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
                    Severity
                    Category
                    Status
                    Source
                    Language