HaaseIT/HCSF

View on GitHub

Showing 151 of 151 total issues

Method getItemPathTree has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getItemPathTree()
    {
        $itemindexpathtree = [];
        $aItemoverviewpages = [];
        $sql = "SELECT * FROM content_base WHERE cb_pagetype = 'itemoverview' OR cb_pagetype = 'itemoverviewgrpd'";
Severity: Minor
Found in src/Shop/Items.php - About 1 hr to fix

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

        private function handleForgotPassword($aErr) {
            if (!filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL)) {
                $aErr[] = 'emailinvalid';
            } else {
                $querybuilder = $this->dbal->createQueryBuilder();
    Severity: Minor
    Found in src/Controller/Customer/Forgotpassword.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 getItemlist has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getItemlist()
        {
            $sSearchstring = filter_input(INPUT_GET, 'searchstring', FILTER_SANITIZE_SPECIAL_CHARS);
            $sSearchstring = str_replace('*', '%', $sSearchstring);
    
    
    Severity: Minor
    Found in src/Controller/Admin/Shop/Itemadmin.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 getItemImage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getItemImage($aV)
        {
            // base64 encode img and prepare for db
            // image/png image/jpeg image/gif
            // data:{mimetype};base64,XXXX
    Severity: Minor
    Found in src/Controller/Shop/Shoppingcart.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

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

        protected function loadCustomer()
        {
            $customer = Yaml::parse(file_get_contents(HCSF_BASEDIR.'config/customer.yml'));
            if (is_file(PATH_BASEDIR.'/config/customer.yml')) {
                $customer = array_merge($customer, Yaml::parse(file_get_contents(PATH_BASEDIR.'config/customer.yml')));
    Severity: Major
    Found in src/HelperConfig.php and 2 other locations - About 55 mins to fix
    src/HelperConfig.php on lines 148..156
    src/HelperConfig.php on lines 174..182

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

    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 3 locations. Consider refactoring.
    Open

        protected function loadCountries()
        {
            $countries = Yaml::parse(file_get_contents(HCSF_BASEDIR.'config/countries.yml'));
            if (is_file(PATH_BASEDIR.'config/countries.yml')) {
                $countries = array_merge($countries, Yaml::parse(file_get_contents(PATH_BASEDIR.'config/countries.yml')));
    Severity: Major
    Found in src/HelperConfig.php and 2 other locations - About 55 mins to fix
    src/HelperConfig.php on lines 174..182
    src/HelperConfig.php on lines 200..208

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

    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 3 locations. Consider refactoring.
    Open

        protected function loadSecrets()
        {
            $secrets = Yaml::parse(file_get_contents(HCSF_BASEDIR.'config/secrets.yml'));
            if (is_file(PATH_BASEDIR.'config/secrets.yml')) {
                $secrets = array_merge($secrets, Yaml::parse(file_get_contents(PATH_BASEDIR.'config/secrets.yml')));
    Severity: Major
    Found in src/HelperConfig.php and 2 other locations - About 55 mins to fix
    src/HelperConfig.php on lines 148..156
    src/HelperConfig.php on lines 200..208

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

    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 preparePage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function preparePage()
        {
            $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
            $this->P->cb_pagetype = 'content';
    
    
    Severity: Minor
    Found in src/Controller/Customer/Forgotpassword.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 queryItem has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function queryItem($mItemIndex = '', $mItemno = '', $sOrderby = '')
        {
            $sql = 'SELECT '.DB_ITEMFIELDS.' FROM item_base';
            $sql .= ' LEFT OUTER JOIN item_lang ON item_base.itm_id = item_lang.itml_pid AND itml_lang = :lang';
            $sql .= $this->queryItemWhereClause($mItemIndex, $mItemno);
    Severity: Minor
    Found in src/Shop/Items.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 buildShoppingCartTable has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function buildShoppingCartTable(array $aCart, $bReadonly = false, $sCustomergroup = '', $aErr = [], $iVATfull = '', $iVATreduced = '')
    Severity: Minor
    Found in src/Shop/Helper.php - About 45 mins to fix

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

          protected function showPageselect() {
              $aGroups = [];
              $adminpagegroups = $this->config->getCore('admin_page_groups');
              foreach ($adminpagegroups as $sValue) {
                  $TMP = explode('|', $sValue);
      Severity: Minor
      Found in src/Controller/Admin/Pageadmin.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 getItemSuggestions has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              Items $oItem,
              $aPossibleSuggestions,
              $sSetSuggestions,
              $sCurrentitem,
              $mItemindex,
      Severity: Minor
      Found in src/Shop/Helper.php - About 45 mins to fix

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

            public function preparePage()
            {
                $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
                $this->P->cb_pagetype = 'content';
        
        
        Severity: Minor
        Found in src/Controller/Customer/Verifyemail.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 getShippingcost has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getShippingcost()
            {
                $fShippingcost = $this->shop['shippingcoststandardrate'];
        
                $sCountry = $this->helperCustomer->getDefaultCountryByConfig($this->config->getLang());
        Severity: Minor
        Found in src/Shop/Helper.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

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

                        $sTo = filter_input(INPUT_POST, 'toyear', FILTER_SANITIZE_NUMBER_INT).'-'
                            .Tools::dateAddLeadingZero(filter_input(INPUT_POST, 'tomonth', FILTER_SANITIZE_NUMBER_INT)).'-'
                            .Tools::dateAddLeadingZero(filter_input(INPUT_POST, 'today', FILTER_SANITIZE_NUMBER_INT));
        Severity: Minor
        Found in src/Controller/Admin/Shop/Shopadmin.php and 1 other location - About 40 mins to fix
        src/Controller/Admin/Shop/Shopadmin.php on lines 204..207

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

        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

                        $sFrom = filter_input(INPUT_POST, 'fromyear', FILTER_SANITIZE_NUMBER_INT).'-'
                            .Tools::dateAddLeadingZero(filter_input(INPUT_POST, 'frommonth', FILTER_SANITIZE_NUMBER_INT)).'-'
                            .Tools::dateAddLeadingZero(filter_input(INPUT_POST, 'fromday', FILTER_SANITIZE_NUMBER_INT))
                        ;
        Severity: Minor
        Found in src/Controller/Admin/Shop/Shopadmin.php and 1 other location - About 40 mins to fix
        src/Controller/Admin/Shop/Shopadmin.php on lines 208..210

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

        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 mailWrapper has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function mailWrapper($to, $subject = '(No subject)', $message = '', $aImagesToEmbed = [], $aFilesToAttach = []) {
        Severity: Minor
        Found in src/Helper.php - About 35 mins to fix

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

              public function refreshCartItems(ServiceManager $serviceManager) // bei login/logout ändern sich ggf die preise, shoppingcart neu berechnen
              {
                  if (isset($_SESSION['cart']) && is_array($_SESSION['cart'])) {
                      foreach ($_SESSION['cart'] as $sKey => $aValue) {
                          $sItemkey = $sKey;
          Severity: Minor
          Found in src/Shop/Helper.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 addAdditionalCostsToItems has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function addAdditionalCostsToItems($aSumme, $iVATfull, $iVATreduced)
              {
                  $fGesamtnetto = $aSumme['sumvoll'] + $aSumme['sumerm'];
                  $fSteuervoll = $aSumme['sumvoll'] * $iVATfull / 100;
                  $fSteuererm = $aSumme['sumerm'] * $iVATreduced / 100;
          Severity: Minor
          Found in src/Shop/Helper.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 getPurifier has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getPurifier($purpose)
              {
                  $purifier_config = \HTMLPurifier_Config::createDefault();
                  $purifier_config->set('Core.Encoding', 'UTF-8');
                  $purifier_config->set('Cache.SerializerPath', PATH_PURIFIERCACHE);
          Severity: Minor
          Found in src/Helper.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

          Severity
          Category
          Status
          Source
          Language