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 ( 1ba1f4...ea41a5 )
by Alexey
05:37
created

OnFlyWidget   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 54
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 10 2
A run() 0 23 2
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
class OnFlyWidget extends CWidget
9
{
10
  /**
11
   * URL для AJAX запроса.
12
   *
13
   * @var string
14
   */
15
  public $ajaxUrl;
16
17
  public $items;
18
19
  public $attribute;
20
21
  public $primaryKey;
22
23
  public $value;
24
25
  public $htmlOptions = array();
26
27
  public function init()
28
  {
29
    if( !isset($this->ajaxUrl, $this->attribute, $this->primaryKey) )
30
      throw new RequiredPropertiesException(__CLASS__, array('ajaxUrl', 'attribute', 'primaryKey'));
31
32
    $scriptUrl = Yii::app()->assetManager->publish(dirname(__FILE__).'/js');
33
34
    Yii::app()->clientScript->registerScriptFile($scriptUrl.'/jquery.onFlyEdit.js', CClientScript::POS_END);
35
    Yii::app()->clientScript->registerScriptFile($scriptUrl.'/onFlyModule.js', CClientScript::POS_END);
36
  }
37
38
  public function run()
39
  {
40
    $htmlOptions = CMap::mergeArray($this->htmlOptions, array(
41
      'data-onflyedit' => implode('-', array($this->attribute, $this->primaryKey)),
42
      'data-ajax-url' => $this->ajaxUrl,
43
    ));
44
45
    if( empty($this->dropDown) )
46
    {
47
      $htmlOptions['class'] = 'onfly-edit';
48
49
      $result = CHtml::tag('span', $htmlOptions, $this->value);
50
    }
51
    else
52
    {
53
      $htmlOptions['class'] = 'onfly-edit-dropdown';
54
      $htmlOptions['style'] = 'margin-bottom: 0px; width: auto;';
55
56
      $result = CHtml::dropDownList('', $this->value, $this->items, $htmlOptions);
57
    }
58
59
    echo $result;
60
  }
61
}