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

BFacetedSearchBehavior::add()   B

Complexity

Conditions 4
Paths 4

Size

Total Lines 22
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 8.2515
Metric Value
dl 0
loc 22
ccs 5
cts 14
cp 0.357
rs 8.9197
cc 4
eloc 11
nc 4
nop 1
crap 8.2515
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 1
        $this->facetIndexer->clearIndexByProductIdList(array($parentId));
40
41
      $productIdList = $this->owner->getFacetProductIdList();
42
    }
43
    else
44 4
      $productIdList = array($product->id);
45
46 4
    $this->facetIndexer->reindexProducts($productIdList);
47
  }
48
}