d3yii2/yii2-d3acc

View on GitHub

Showing 41 of 47 total issues

Method accFilterAccPeriodBalanceByDays has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function accFilterAccPeriodBalanceByDays(AcRecAcc $acc,
                                                           $accFilter,
                                                           AcPeriod $period)
    {
        if (!is_array($accFilter)) {
Severity: Minor
Found in models/AcTran.php - About 1 hr to fix

    Method accByDaysFilter has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function accByDaysFilter($accountId, AcPeriod $period, $filter)
        {
    
            $join    = $where   = $broupBy = [];
            foreach (AcAccount::findOne($accountId)->getAcDefs()->all() as $acDef) {
    Severity: Minor
    Found in models/AcTran.php - About 1 hr to fix

      Method accPeriodBalanceByDays has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function accPeriodBalanceByDays(AcRecAcc $acc, AcPeriod $period, $addPrevToFirstDay = true)
          {
              $connection = Yii::$app->getDb();
              $command    = $connection->createCommand('
                  SELECT
      Severity: Minor
      Found in models/AcTran.php - About 1 hr to fix

        Method safeUp has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function safeUp() {
        
                $this->execute('
                    ALTER TABLE `ac_account`   
                      ADD COLUMN `sys_company_id` SMALLINT UNSIGNED DEFAULT 0  NOT NULL AFTER `id`;
        Severity: Minor
        Found in migrations/m200923_100707_add_sys_company_id.php - About 1 hr to fix

          Method testAcRecAccGetValidatedAccc has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function testAcRecAccGetValidatedAccc()
              {
                  /**
                   * get accounts
                   */
          Severity: Minor
          Found in unit_tests/AcAccountTest.php - About 1 hr to fix

            Method registre2 has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function registre2(
                    AcRecAcc $debitAcc,
                    AcRecAcc $creditAcc,
                    float $amt,
                    string $date,
            Severity: Minor
            Found in models/AcTran.php - About 1 hr to fix

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

                  private function recalculateLabel(int $recAccId): void
                  {
                      $ac_def_models = AcDef::findAll([
                          'account_id' => $this->account->id,
                          'sys_company_id' => $this->sysCompanyId,
              Severity: Minor
              Found in components/AccConstructor.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 accBalanceFilter has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function accBalanceFilter($accountId, AcPeriod $period,
                                                          $filter)
                  {
              
                      $select = $join   = [];
              Severity: Minor
              Found in models/AcPeriodBalance.php - About 1 hr to fix

                Method safeUp has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function safeUp()
                    {
                        $sql = "   
                            SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
                            SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
                Severity: Minor
                Found in migrations/m161018_184508_add_balance.php - About 1 hr to fix

                  Method addNewPeriod has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function addNewPeriod(int $periodType, int $sysCompanyId): AcPeriod
                      {
                          if (!$lastPeriod = AcPeriod::find()
                              ->where([
                                  'sys_company_id' => $sysCompanyId,
                  Severity: Minor
                  Found in components/PeriodBase.php - About 1 hr to fix

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

                        public function save()
                        {
                            $dimAmt = 0;
                            $dimGroup = false;
                    
                    
                    Severity: Minor
                    Found in components/Dim.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 accPeriodBalanceGroupedByCode has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function accPeriodBalanceGroupedByCode($accountId, AcPeriod $period)
                        {
                            $connection = Yii::$app->getDb();
                            $command    = $connection->createCommand('
                                SELECT
                    Severity: Minor
                    Found in models/AcTran.php - About 1 hr to fix

                      Method accPeriodBalance has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function accPeriodBalance(AcRecAcc $acc, AcPeriod $period,
                                                                  $addPrevBalance = true)
                          {
                              $connection = Yii::$app->getDb();
                              $command    = $connection->createCommand('
                      Severity: Minor
                      Found in models/AcTran.php - About 1 hr to fix

                        Method registre2 has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                AcRecAcc $debitAcc,
                                AcRecAcc $creditAcc,
                                float $amt,
                                string $date,
                                AcPeriod $period,
                        Severity: Major
                        Found in models/AcTran.php - About 1 hr to fix

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

                              public function deleteAcc($acc)
                              {
                                  if (!$acc) {
                                      return;
                                  }
                          Severity: Minor
                          Found in unit_tests/AcAccountTest.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 getValidatedAcc has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function getValidatedAcc($accId, $ref = false)
                              {
                          
                                  if(!$model = self::findOne($accId)){
                                      throw new Exception('Undefined accId: ' . $accId);
                          Severity: Minor
                          Found in models/AcAccount.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 registre2 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function registre2(
                                  AcRecAcc $debitAcc,
                                  AcRecAcc $creditAcc,
                                  float $amt,
                                  string $date,
                          Severity: Minor
                          Found in models/AcTran.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 close has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function close(int $periodType, int $sysCompanyId): AcPeriod
                              {
                          
                                  if (!$lastPeriod = AcPeriod::find()
                                      ->where([
                          Severity: Minor
                          Found in components/PeriodBase.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 periodBalanceTotal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function periodBalanceTotal(AcPeriod $period): array
                              {
                                  $connection = Yii::$app->getDb();
                          
                                  $command    = $connection->createCommand('
                          Severity: Minor
                          Found in models/AcTran.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 filter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function filter()
                              {
                          
                                  $query = self::find()
                                      ->select([
                          Severity: Minor
                          Found in models/AcTranSearch.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

                          Severity
                          Category
                          Status
                          Source
                          Language