d3yii2/yii2-d3acc

View on GitHub

Showing 41 of 47 total issues

File AcTran.php has 907 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * registre transactions and get data of transactions
 * 
 * @author Uldis Nelsons
Severity: Major
Found in models/AcTran.php - About 2 days to fix

    Method filter has 106 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function filter()
        {
    
            $query = self::find()
                ->select([
    Severity: Major
    Found in models/AcTranSearch.php - About 4 hrs to fix

      Function getAcc has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getAcc(int $accId, int $sysCompanyId, $ref = false)
          {
              $acc = AcAccount::getValidatedAcc($accId,  $ref);
      
              /**
      Severity: Minor
      Found in models/AcRecAcc.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

      Method periodBalanceTotal has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function periodBalanceTotal(AcPeriod $period): array
          {
              $connection = Yii::$app->getDb();
      
              $command    = $connection->createCommand('
      Severity: Major
      Found in models/AcTran.php - About 3 hrs to fix

        Method accBalanceFilter has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function accBalanceFilter(
                int $accountId,
                AcPeriod $period,
                array $filter,
                bool $addPrevBalance = false
        Severity: Major
        Found in models/AcTran.php - About 2 hrs to fix

          Method safeUp has 71 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: Major
          Found in migrations/m161009_181508_init.php - About 2 hrs to fix

            Method accFilterExtPeriodBalanceByDays has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function accFilterExtPeriodBalanceByDays($accList,
                                                                       AcPeriod $period)
                {
            
                    if (!$accList) {
            Severity: Major
            Found in models/AcTran.php - About 2 hrs to fix

              Method saveDimPeriodBalance has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function saveDimPeriodBalance(AcPeriod $period)
                  {
                      $connection = Yii::$app->getDb();
                      $command    = $connection->createCommand('
                          INSERT INTO ac_period_balance_dim (
              Severity: Major
              Found in models/AcPeriodBalanceDim.php - About 2 hrs to fix

                Method periodBalanceDimTotal has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function periodBalanceDimTotal(AcPeriod $period, array $accList,int $accDimGroupId): array
                    {
                        $connection = Yii::$app->getDb();
                
                        $command    = $connection->createCommand('
                Severity: Major
                Found in models/AcTran.php - About 2 hrs to fix

                  Method periodBalanceWithDimByCodeTotal has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function periodBalanceWithDimByCodeTotal(AcPeriod $period,int $accountId): array
                      {
                          $connection = Yii::$app->getDb();
                  
                          $command    = $connection->createCommand('
                  Severity: Major
                  Found in models/AcTran.php - About 2 hrs to fix

                    Method getAcc has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function getAcc(int $accId, int $sysCompanyId, $ref = false)
                        {
                            $acc = AcAccount::getValidatedAcc($accId,  $ref);
                    
                            /**
                    Severity: Major
                    Found in models/AcRecAcc.php - About 2 hrs to fix

                      Method accBalanceFilterOld has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function accBalanceFilterOld($accountId, AcPeriod $period,
                                                                  $filter, $addPrevPalance = false)
                          {
                              $selectSql = '   
                                  IFNULL(SUM(
                      Severity: Major
                      Found in models/AcTran.php - About 2 hrs to fix

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

                            public static function periodBalanceTotal1x(AcPeriod $period)
                            {
                        
                                $connection = Yii::$app->getDb();
                                $command    = $connection->createCommand('
                        Severity: Major
                        Found in models/AcTran.php - About 2 hrs to fix

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

                              public static function accPeriodTran(AcRecAcc $acc, AcPeriod $period, $startBalance = true)
                              {
                                  $connection = Yii::$app->getDb();
                                  $command    = $connection->createCommand('
                                      SELECT
                          Severity: Major
                          Found in models/AcTran.php - About 2 hrs to fix

                            Method periodBalanceByCodeTotal has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public static function periodBalanceByCodeTotal(AcPeriod $period,int $accountId): array
                                {
                                    $connection = Yii::$app->getDb();
                            
                                    $command    = $connection->createCommand('
                            Severity: Major
                            Found in models/AcTran.php - About 2 hrs to fix

                              Method periodBalance has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public static function periodBalance(AcPeriod $period, $addPrevBalance = true)
                                  {
                                      $unionPrevBalanceSql = '';
                                      if($addPrevBalance){
                                          $unionPrevBalanceSql = '
                              Severity: Minor
                              Found in models/AcTran.php - About 2 hrs to fix

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

                                    public function setUp()
                                    {
                                
                                        if ($accs = AcAccount::findAll(['code' => 'Test'])) {
                                            foreach ($accs as $acc) {
                                Severity: Minor
                                Found in unit_tests/AcAccountTest.php - About 1 hr to fix

                                  Method close has 46 lines of code (exceeds 25 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 1 hr to fix

                                    Method recalculateLabel has 45 lines of code (exceeds 25 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

                                      Method savePeriodBalance has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public static function savePeriodBalance(AcPeriod $period)
                                          {
                                              $connection = Yii::$app->getDb();
                                              $command    = $connection->createCommand('
                                                  INSERT INTO ac_period_balance (
                                      Severity: Minor
                                      Found in models/AcPeriodBalance.php - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language