CORE-POS/IS4C

View on GitHub
fannie/classlib2.0/member/MemberREST.php

Summary

Maintainability
F
1 wk
Test Coverage
D
60%

File MemberREST.php has 1138 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*******************************************************************************

    Copyright 2010 Whole Foods Co-op, Duluth, MN

Severity: Major
Found in fannie/classlib2.0/member/MemberREST.php - About 2 days to fix

    Function postCustdata has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function postCustdata($dbc, $id, $json)
        {
            $config = FannieConfig::factory();
            $ret = array('errors' => 0, 'error-msg' => '');
    
    
    Severity: Minor
    Found in fannie/classlib2.0/member/MemberREST.php - About 1 day 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 postAccount has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function postAccount($dbc, $id, $json)
        {
            $ret = array('errors' => 0, 'error-msg' => '');
            $config = FannieConfig::factory();
            $account = self::getModel($dbc, 'CustomerAccountsModel');
    Severity: Minor
    Found in fannie/classlib2.0/member/MemberREST.php - About 1 day 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 postCustdata has 136 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static function postCustdata($dbc, $id, $json)
        {
            $config = FannieConfig::factory();
            $ret = array('errors' => 0, 'error-msg' => '');
    
    
    Severity: Major
    Found in fannie/classlib2.0/member/MemberREST.php - About 5 hrs to fix

      MemberREST has 37 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class MemberREST
      {
          private static $FIELD_INFO = array(
              'cardNo' => array('map'=>'CardNo', 'match'=>'strict'),
              'memberStatus' => array('map'=>'Type', 'match'=>'strict'),
      Severity: Minor
      Found in fannie/classlib2.0/member/MemberREST.php - About 4 hrs to fix

        Method getAllCustdata has 114 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static function getAllCustdata($dbc)
            {
                // grab supplementary data from new tables if present
                $new_available = false;
                if ($dbc->tableExists('CustomerAccounts') && $dbc->tableExists('Customers')) {
        Severity: Major
        Found in fannie/classlib2.0/member/MemberREST.php - About 4 hrs to fix

          Method getCustdata has 83 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function getCustdata($dbc, $id)
              {
                  if ($id == 0) {
                      return self::getAllCustdata($dbc);
                  }
          Severity: Major
          Found in fannie/classlib2.0/member/MemberREST.php - About 3 hrs to fix

            Function getAllCustdata has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function getAllCustdata($dbc)
                {
                    // grab supplementary data from new tables if present
                    $new_available = false;
                    if ($dbc->tableExists('CustomerAccounts') && $dbc->tableExists('Customers')) {
            Severity: Minor
            Found in fannie/classlib2.0/member/MemberREST.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 postAccount has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function postAccount($dbc, $id, $json)
                {
                    $ret = array('errors' => 0, 'error-msg' => '');
                    $config = FannieConfig::factory();
                    $account = self::getModel($dbc, 'CustomerAccountsModel');
            Severity: Major
            Found in fannie/classlib2.0/member/MemberREST.php - About 2 hrs to fix

              Function searchCustdata has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static function searchCustdata($dbc, $json, $limit=0, $minimal=false)
                  {
                      $query = '
                          SELECT c.CardNo AS cardNo,
                              ' . ($minimal ? 'c.FirstName' : 'MAX(c.FirstName)') . ' AS firstName,
              Severity: Minor
              Found in fannie/classlib2.0/member/MemberREST.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 getCustdataCustomers has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function getCustdataCustomers($dbc, $id)
                  {
                      $query = '
                          SELECT c.personNum,
                              c.FirstName,
              Severity: Major
              Found in fannie/classlib2.0/member/MemberREST.php - About 2 hrs to fix

                Method fastSearchResults has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private static function fastSearchResults($dbc, $ids)
                    {
                        list($inStr, $args) = $dbc->safeInClause($ids);
                        $config = FannieConfig::factory();
                        if ($config->get('CUST_SCHEMA') == 1 && $dbc->tableExists('CustomerAccounts') && $dbc->tableExists('Customers')) {
                Severity: Major
                Found in fannie/classlib2.0/member/MemberREST.php - About 2 hrs to fix

                  Method searchCustdata has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static function searchCustdata($dbc, $json, $limit=0, $minimal=false)
                      {
                          $query = '
                              SELECT c.CardNo AS cardNo,
                                  ' . ($minimal ? 'c.FirstName' : 'MAX(c.FirstName)') . ' AS firstName,
                  Severity: Minor
                  Found in fannie/classlib2.0/member/MemberREST.php - About 1 hr to fix

                    Function getCustdata has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function getCustdata($dbc, $id)
                        {
                            if ($id == 0) {
                                return self::getAllCustdata($dbc);
                            }
                    Severity: Minor
                    Found in fannie/classlib2.0/member/MemberREST.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 postMemDates has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function postMemDates($dbc, $id, $json, $ret)
                        {
                            if (isset($json['startDate']) || isset($json['endDate'])) {
                                $dates = self::getModel($dbc, 'MemDatesModel');
                                if (isset($json['startDate'])) {
                    Severity: Minor
                    Found in fannie/classlib2.0/member/MemberREST.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 addAccountIDs has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function addAccountIDs($dbc, $id, $ret)
                        {
                            $account = new CustomerAccountsModel($dbc);
                            $account->cardNo($id);
                            if ($account->load()) {
                    Severity: Minor
                    Found in fannie/classlib2.0/member/MemberREST.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 autoComplete has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function autoComplete($field, $val, $convertToID=false)
                        {
                            $config = FannieConfig::factory();
                            $dbc = FannieDB::getReadOnly($config->get('OP_DB'));
                            if (strtolower($field) == 'mfirstname') {
                    Severity: Minor
                    Found in fannie/classlib2.0/member/MemberREST.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 searchAccount has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static function searchAccount($dbc, $json, $limit=0, $minimal=false)
                        {
                            $query = '
                                SELECT a.cardNo,
                                    ' . ($minimal ? 'c.firstName' : 'MAX(c.firstName)') . ' AS firstName,
                    Severity: Minor
                    Found in fannie/classlib2.0/member/MemberREST.php - About 1 hr to fix

                      Method autoComplete has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function autoComplete($field, $val, $convertToID=false)
                          {
                              $config = FannieConfig::factory();
                              $dbc = FannieDB::getReadOnly($config->get('OP_DB'));
                              if (strtolower($field) == 'mfirstname') {
                      Severity: Minor
                      Found in fannie/classlib2.0/member/MemberREST.php - About 1 hr to fix

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

                            private static function getSearchResults($dbc, $query, $params, $minimal, $limit)
                            {
                                if (count($params) == 0) {
                                    return array();
                                }
                        Severity: Minor
                        Found in fannie/classlib2.0/member/MemberREST.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 setBlueLines has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function setBlueLines($id)
                            {
                                $config = FannieConfig::factory();
                                $template = $config->get('BLUELINE_TEMPLATE');
                                if ($template == '') {
                        Severity: Minor
                        Found in fannie/classlib2.0/member/MemberREST.php - About 1 hr to fix

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

                              private static function addAccountIDs($dbc, $id, $ret)
                              {
                                  $account = new CustomerAccountsModel($dbc);
                                  $account->cardNo($id);
                                  if ($account->load()) {
                          Severity: Minor
                          Found in fannie/classlib2.0/member/MemberREST.php - About 1 hr to fix

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

                                private static function searchAccount($dbc, $json, $limit=0, $minimal=false)
                                {
                                    $query = '
                                        SELECT a.cardNo,
                                            ' . ($minimal ? 'c.firstName' : 'MAX(c.firstName)') . ' AS firstName,
                            Severity: Minor
                            Found in fannie/classlib2.0/member/MemberREST.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 createAccount has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private static function createAccount($dbc, $config)
                                {
                                    $max = 1;
                                    if ($config->get('CUST_SCHEMA') == 1 && $dbc->tableExists('CustomerAccounts')) {
                                        $query = 'SELECT MAX(cardNo) FROM customerAccounts';
                            Severity: Minor
                            Found in fannie/classlib2.0/member/MemberREST.php - About 1 hr to fix

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

                                  private static function postMemContact($dbc, $id, $json, $ret)
                                  {
                                      if (isset($json['contactMethod'])) {
                                          $contact = new MemContactModel($dbc);
                                          $contact = self::getModel($dbc, 'MemContactModel');
                              Severity: Minor
                              Found in fannie/classlib2.0/member/MemberREST.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 setBlueLines has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function setBlueLines($id)
                                  {
                                      $config = FannieConfig::factory();
                                      $template = $config->get('BLUELINE_TEMPLATE');
                                      if ($template == '') {
                              Severity: Minor
                              Found in fannie/classlib2.0/member/MemberREST.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 buildSearchClause has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  private static function buildSearchClause($query, $params, $json, $field_name, $use_map)
                              Severity: Minor
                              Found in fannie/classlib2.0/member/MemberREST.php - About 35 mins to fix

                                Method getSearchResults has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    private static function getSearchResults($dbc, $query, $params, $minimal, $limit)
                                Severity: Minor
                                Found in fannie/classlib2.0/member/MemberREST.php - About 35 mins to fix

                                  Function fastSearchResults has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private static function fastSearchResults($dbc, $ids)
                                      {
                                          list($inStr, $args) = $dbc->safeInClause($ids);
                                          $config = FannieConfig::factory();
                                          if ($config->get('CUST_SCHEMA') == 1 && $dbc->tableExists('CustomerAccounts') && $dbc->tableExists('Customers')) {
                                  Severity: Minor
                                  Found in fannie/classlib2.0/member/MemberREST.php - About 25 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 getCustdataCustomers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private static function getCustdataCustomers($dbc, $id)
                                      {
                                          $query = '
                                              SELECT c.personNum,
                                                  c.FirstName,
                                  Severity: Minor
                                  Found in fannie/classlib2.0/member/MemberREST.php - About 25 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 postMemberCards has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private static function postMemberCards($dbc, $id, $json, $ret)
                                      {
                                          if (isset($json['idCardUPC'])) {
                                              $cards = self::getModel($dbc, 'MemberCardsModel');
                                              $cards->card_no($id);
                                  Severity: Minor
                                  Found in fannie/classlib2.0/member/MemberREST.php - About 25 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 getAllAccounts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private static function getAllAccounts($dbc)
                                      {
                                          $account = new CustomerAccountsModel($dbc);
                                          $customers = new CustomersModel($dbc);
                                          $accounts = array();
                                  Severity: Minor
                                  Found in fannie/classlib2.0/member/MemberREST.php - About 25 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

                                              $ret[$row['cardNo']]['customers'][] = array(
                                                  'accountHolder' => $row['accountHolder'],
                                                  'firstName' => $row['firstName'],
                                                  'lastName' => $row['lastName'],
                                                  'chargeAllowed' => $row['chargeAllowed'],
                                  Severity: Major
                                  Found in fannie/classlib2.0/member/MemberREST.php and 1 other location - About 1 hr to fix
                                  fannie/admin/labels/genLabels.php on lines 121..133

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

                                  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

                                          foreach (self::$FIELD_INFO as $field_name => $info) {
                                              list($query, $params) = self::buildSearchClause($query, $params, $json, $field_name, false);
                                              foreach ($json['customers'] as $j) {
                                                  list($query, $params) = self::buildSearchClause($query, $params, $j, $field_name, false);
                                              }
                                  Severity: Minor
                                  Found in fannie/classlib2.0/member/MemberREST.php and 1 other location - About 40 mins to fix
                                  fannie/classlib2.0/member/MemberREST.php on lines 1043..1048

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

                                  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

                                          foreach (self::$FIELD_INFO as $field_name => $info) {
                                              list($query, $params) = self::buildSearchClause($query, $params, $json, $field_name, true);
                                              foreach ($json['customers'] as $j) {
                                                  list($query, $params) = self::buildSearchClause($query, $params, $j, $field_name, true);
                                              }
                                  Severity: Minor
                                  Found in fannie/classlib2.0/member/MemberREST.php and 1 other location - About 40 mins to fix
                                  fannie/classlib2.0/member/MemberREST.php on lines 953..958

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

                                  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

                                  There are no issues that match your filters.

                                  Category
                                  Status