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::init()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 10
rs 9.4285
cc 2
eloc 6
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
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
}