CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/CoreWarehouse/models/MemberSummaryModel.php

Summary

Maintainability
D
2 days
Test Coverage

Method refresh_data has 223 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function refresh_data($trans_db, $month, $year, $day=False)
    {
        $config = FannieConfig::factory();
        $settings = $config->get('PLUGIN_SETTINGS');
        $dbc = FannieDB::get($settings['WarehouseDatabase']);
Severity: Major
Found in fannie/modules/plugins2.0/CoreWarehouse/models/MemberSummaryModel.php - About 1 day to fix

    File MemberSummaryModel.php has 429 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2015 Whole Foods Co-op
    
    
    Severity: Minor
    Found in fannie/modules/plugins2.0/CoreWarehouse/models/MemberSummaryModel.php - About 6 hrs to fix

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

          private function lastYearStats($dbc)
          {
              $year_ago = mktime(0, 0, 0, date('n'), date('j'), date('Y')-1);
              $yesterday = strtotime('yesterday');
              $year_args = array(

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

            public function refresh_data($trans_db, $month, $year, $day=False)
            {
                $config = FannieConfig::factory();
                $settings = $config->get('PLUGIN_SETTINGS');
                $dbc = FannieDB::get($settings['WarehouseDatabase']);

        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 storePreference has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function storePreference($dbc)
            {
                $year_ago = mktime(0, 0, 0, date('n'), date('j'), date('Y')-1);
                $yesterday = strtotime('yesterday');
                $year_args = array(

          There are no issues that match your filters.

          Category
          Status