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.

FActiveDataProvider::afterFetchData()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
ccs 4
cts 4
cp 1
crap 2
1
<?php
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 frontend.components
8
 */
9
class FActiveDataProvider extends CActiveDataProvider
10
{
11
  /**
12
   * @param mixed $modelClass
13
   * @param array $config
14
   */
15 2 View Code Duplication
  public function __construct($modelClass, $config = array())
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...
16
  {
17 2
    if( !isset($config['pagination']) )
18 2
      $config['pagination'] = new FPagination();
19
20 2
    $controller = Yii::app()->controller;
21 2
    if( isset($controller->pageSize) && $config['pagination'] )
22 2
      $config['pagination']->pageSize = $controller->pageSize;
23
24 2
    parent::__construct($modelClass, $config);
25 2
  }
26
27 2
  public function fetchData()
28
  {
29 2
    $data = parent::fetchData();
30 2
    $this->setData($data);
31 2
    $this->afterFetchData();
32 2
    return $data;
33
  }
34
35 2
  public function afterFetchData()
36
  {
37 2
    if( $this->hasEventHandler('onAfterFetchData') )
38 2
      $this->onAfterFetchData(new CEvent($this));
39 2
  }
40
41 2
  public function onAfterFetchData($event)
42
  {
43 2
    $this->raiseEvent('onAfterFetchData', $event);
44 2
  }
45
46
  public function getDataRandom($refresh = false)
47
  {
48
    $data = parent::getData($refresh);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (getData() instead of getDataRandom()). Are you sure this is correct? If so, you might want to change this to $this->getData().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
49
    shuffle($data);
50
51
    return $data;
52
  }
53
}