HaaseIT/HCSF

View on GitHub
src/HCSF.php

Summary

Maintainability
D
2 days
Test Coverage

Method generatePage has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function generatePage(Page $P)
    {
        $requesturi = $this->helper->getCleanRequestTarget();

        $aP = [
Severity: Major
Found in src/HCSF.php - About 3 hrs to fix

    Function generatePage has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        public function generatePage(Page $P)
        {
            $requesturi = $this->helper->getCleanRequestTarget();
    
            $aP = [
    Severity: Minor
    Found in src/HCSF.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

    File HCSF.php has 311 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace HaaseIT\HCSF;
    
    use Zend\ServiceManager\ServiceManager;
    Severity: Minor
    Found in src/HCSF.php - About 3 hrs to fix

      Method init has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function init()
          {
              $this->serviceManager = new ServiceManager();
      
              if (!CLI) {
      Severity: Major
      Found in src/HCSF.php - About 2 hrs to fix

        Function setupSession has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function setupSession()
            {
                if (
                    (
                        $this->config->getCore('enable_module_customer')
        Severity: Minor
        Found in src/HCSF.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 setupSession has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function setupSession()
            {
                if (
                    (
                        $this->config->getCore('enable_module_customer')
        Severity: Minor
        Found in src/HCSF.php - About 1 hr to fix

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

              protected function setupTwig()
              {
                  $this->serviceManager->setFactory('twig', function (ServiceManager $serviceManager) {
                      $loader = new \Twig_Loader_Filesystem([PATH_BASEDIR.'customization/views', HCSF_BASEDIR.'src/views/']);
          
          
          Severity: Minor
          Found in src/HCSF.php - About 1 hr to fix

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

                public function init()
                {
                    $this->serviceManager = new ServiceManager();
            
                    if (!CLI) {
            Severity: Minor
            Found in src/HCSF.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

            Avoid too many return statements within this method.
            Open

                        return $router->getPage();
            Severity: Major
            Found in src/HCSF.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return true;
              Severity: Major
              Found in src/HCSF.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $this->setupHardcodedTextcats();
                Severity: Major
                Found in src/HCSF.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return null;
                  Severity: Major
                  Found in src/HCSF.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return new \HaaseIT\HCSF\Shop\Items($serviceManager);
                    Severity: Major
                    Found in src/HCSF.php - About 30 mins to fix

                      There are no issues that match your filters.

                      Category
                      Status