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 ( 2ec89f...0b541d )
by Alexey
13:03
created

BFacetedSearchBehavior::afterSave()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 19
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3.0067

Importance

Changes 0
Metric Value
cc 3
eloc 9
nc 3
nop 1
dl 0
loc 19
ccs 10
cts 11
cp 0.9091
crap 3.0067
rs 9.4285
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 15 and the first side effect is on line 9.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * @author Sergey Glagolev <[email protected]>
4
 * @link https://github.com/shogodev/argilla/
5
 * @copyright Copyright &copy; 2003-2014 Shogo
6
 * @license http://argilla.ru/LICENSE
7
 * @package backend.modules.product.behaviors
8
 */
9 1
Yii::import('backend.modules.product.components.FacetIndexer');
10
/**
11
 * Class BFacetedSearchBehavior
12
 *
13
 * * @property BProduct $owner
14
 */
15
class BFacetedSearchBehavior extends SActiveRecordBehavior
16
{
17
  /**
18
   * @var FacetIndexer $facetIndexer
19
   */
20
  protected $facetIndexer;
21
22 24
  public function init()
23
  {
24 24
    parent::init();
25
26 24
    $this->facetIndexer = new FacetIndexer();
27 24
  }
28
29 24
  public function afterSave($event)
30
  {
31
    /**
32
     * BProduct $product
33
     */
34 4
    $product = $this->owner;
35
36 4
    if( $this->owner->asa('modificationBehavior') )
37 4
    {
38 24
      if( $parentId = $this->owner->getParentId() )
39 4
        $this->facetIndexer->clearIndexByProductIdList(array($parentId));
40
41 4
      $productIdList = $this->owner->getFacetProductIdList();
42 4
    }
43
    else
44
      $productIdList = array($product->id);
45
46 4
    $this->facetIndexer->reindexProducts($productIdList);
47
  }
48
}