GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 951ad1...29ba67 )
by Alexey
08:55
created

AbstractImportCommand::rollbackTransaction()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
/**
3
 * @author Alexey Tatarinov <[email protected]>
4
 * @link https://github.com/shogodev/argilla/
5
 * @copyright Copyright &copy; 2003-2015 Shogo
6
 * @license http://argilla.ru/LICENSE
7
 */
8
9
/**
10
 * Class AbstractImportCommand
11
 * @mixin CurrentTransactionBehavior
12
 */
13
class AbstractImportCommand extends LoggingCommand
14
{
15
  public $logFileName = 'import.log';
16
17
  protected $useCurrentTransaction;
18
19
  public function behaviors()
20
  {
21
    return CMap::mergeArray(
22
      parent::behaviors(),
23
      array(
24
        'currentTransactionBehavior' => array('class' => 'fronted.share.behaviors.CurrentTransactionBehavior')
25
      )
26
    );
27
  }
28
29 View Code Duplication
  public function beginTransaction()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
  {
31
    if( Yii::app()->db->getCurrentTransaction() && is_null($this->useCurrentTransaction) )
32
    {
33
      $this->useCurrentTransaction = false;
34
      return;
35
    }
36
37
    if( is_null($this->useCurrentTransaction) )
38
    {
39
      Yii::app()->db->beginTransaction();
40
      $this->useCurrentTransaction = true;
41
    }
42
  }
43
44
  public function commitTransaction()
45
  {
46
    if( $this->useCurrentTransaction )
47
    {
48
      Yii::app()->db->currentTransaction->commit();
49
      $this->useCurrentTransaction = null;
50
    }
51
  }
52
53
  public function rollbackTransaction()
54
  {
55
    if( $this->useCurrentTransaction )
56
    {
57
      Yii::app()->db->currentTransaction->rollback();
58
      $this->useCurrentTransaction = null;
59
    }
60
  }
61
}