Skip to content

Commit d768bea

Browse files
author
igor-chepurnoi
committed
fix code style
1 parent 422403f commit d768bea

9 files changed

+76
-45
lines changed

.php_cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
$finder = Symfony\CS\Finder::create()
4+
->exclude('vendor')
5+
->in([__DIR__]);
6+
7+
$config = Symfony\CS\Config::create()
8+
->fixers([
9+
'-phpdoc_params',
10+
'-phpdoc_short_description',
11+
'-phpdoc_inline_tag',
12+
'-pre_increment',
13+
'-heredoc_to_nowdoc',
14+
'-spaces_cast',
15+
'-include',
16+
'-phpdoc_no_package',
17+
'concat_with_spaces',
18+
'ordered_use',
19+
'short_array_syntax',
20+
])
21+
->finder($finder);
22+
23+
return $config;

Editable.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,36 @@
1818

1919
/**
2020
* Class Editable
21+
*
2122
* @package yii2mod\editable
2223
*/
2324
class Editable extends InputWidget
2425
{
2526
/**
26-
* @var string the type of input. Type of input.
27+
* @var string the type of input. Type of input
2728
*/
2829
public $type = 'text';
2930

3031
/**
31-
* @var string the Mode of editable, can be popup or inline.
32+
* @var string the Mode of editable, can be popup or inline
3233
*/
3334
public $mode = 'inline';
3435

3536
/**
36-
* @var string|array Url for submit, e.g. '/post'.
37+
* @var string|array Url for submit, e.g. '/post'
3738
*/
3839
public $url;
3940

4041
/**
41-
* @var array the options for the X-editable.js plugin.
42+
* @var array the options for the X-editable.js plugin
4243
*/
4344
public $pluginOptions = [];
4445

4546
/**
46-
* @var array the event handlers for the X-editable.js plugin.
47+
* @var array the event handlers for the X-editable.js plugin
4748
*/
4849
public $clientEvents = [];
4950

50-
5151
/**
5252
* Initializes the widget.
5353
*/
@@ -56,7 +56,7 @@ public function init()
5656
if ($this->url === null) {
5757
throw new InvalidConfigException("You must setup the 'Url' property.");
5858
}
59-
59+
6060
if (!isset($this->options['id'])) {
6161
$this->options['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
6262
}
@@ -112,7 +112,7 @@ protected function registerClientScript()
112112

113113
/**
114114
* Return plugin options in json format
115-
*
115+
*
116116
* @return string
117117
*/
118118
public function getPluginOptions()
@@ -132,7 +132,7 @@ public function getPluginOptions()
132132

133133
/**
134134
* Register client events
135-
*
135+
*
136136
* @param $id
137137
*/
138138
public function registerClientEvents($id)
@@ -147,7 +147,7 @@ public function registerClientEvents($id)
147147

148148
/**
149149
* Return link text
150-
*
150+
*
151151
* @return mixed|string
152152
*/
153153
protected function getLinkText()
@@ -173,7 +173,7 @@ protected function getLinkText()
173173

174174
/**
175175
* To ensure that `getPrimaryKey()` and `getIsNewRecord()` methods are implemented in model.
176-
*
176+
*
177177
* @return bool
178178
*/
179179
protected function hasActiveRecord()

EditableAction.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
/**
1111
* Class EditableAction
12+
*
1213
* @package yii2mod\editable
1314
*/
1415
class EditableAction extends Action
@@ -25,12 +26,12 @@ class EditableAction extends Action
2526

2627
/**
2728
* @var \Closure a function to be called previous saving model. The anonymous function is preferable to have the
28-
* model passed by reference. This is useful when we need to set model with extra data previous update.
29+
* model passed by reference. This is useful when we need to set model with extra data previous update
2930
*/
3031
public $preProcess;
3132

3233
/**
33-
* @var bool whether to create a model if a primary key parameter was not found.
34+
* @var bool whether to create a model if a primary key parameter was not found
3435
*/
3536
public $forceCreate = true;
3637

@@ -41,19 +42,21 @@ class EditableAction extends Action
4142

4243
/**
4344
* @inheritdoc
45+
*
4446
* @throws \yii\base\InvalidConfigException
4547
*/
4648
public function init()
4749
{
4850
if ($this->modelClass === null) {
49-
throw new InvalidConfigException("ModelClass cannot be empty.");
51+
throw new InvalidConfigException('ModelClass cannot be empty.');
5052
}
5153
}
5254

5355
/**
5456
* Runs the action
55-
*
57+
*
5658
* @return bool
59+
*
5760
* @throws BadRequestHttpException
5861
*/
5962
public function run()
@@ -69,18 +72,18 @@ public function run()
6972
$value = Yii::$app->request->post('value');
7073

7174
if ($attribute === null) {
72-
throw new BadRequestHttpException("Attribute cannot be empty.");
75+
throw new BadRequestHttpException('Attribute cannot be empty.');
7376
}
7477

7578
if ($value === null) {
76-
throw new BadRequestHttpException("Value cannot be empty.");
79+
throw new BadRequestHttpException('Value cannot be empty.');
7780
}
7881

7982
/** @var \Yii\db\ActiveRecord $model */
8083
$model = $class::findOne(is_array($pk) ? $pk : [$this->pkColumn => $pk]);
8184
if (!$model) {
8285
if ($this->forceCreate) { // only useful for models with one editable attribute or no validations
83-
$model = new $class;
86+
$model = new $class();
8487
} else {
8588
throw new BadRequestHttpException('Entity not found by primary key ' . $pk);
8689
}
@@ -104,4 +107,4 @@ public function run()
104107
throw new BadRequestHttpException($model->getFirstError($attribute));
105108
}
106109
}
107-
}
110+
}

EditableColumn.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
/**
1616
* Class EditableColumn
17+
*
1718
* @package yii2mod\editable
1819
*/
1920
class EditableColumn extends DataColumn
@@ -22,30 +23,31 @@ class EditableColumn extends DataColumn
2223
* Editable options
2324
*/
2425
public $editableOptions = [];
25-
26+
2627
/**
2728
* @var string suffix substituted to a name class of the tag <a>
2829
*/
2930
public $classSuffix;
30-
31+
3132
/**
3233
* @var string the url to post
3334
*/
3435
public $url;
35-
36+
3637
/**
3738
* @var string the type of editor
3839
*/
3940
public $type = 'text';
4041

4142
/**
4243
* @inheritdoc
44+
*
4345
* @throws \yii\base\InvalidConfigException
4446
*/
4547
public function init()
4648
{
4749
if ($this->url === null) {
48-
throw new InvalidConfigException("Url can not be empty.");
50+
throw new InvalidConfigException('Url can not be empty.');
4951
}
5052
parent::init();
5153

@@ -62,10 +64,11 @@ public function init()
6264

6365
/**
6466
* Renders the data cell content.
65-
*
67+
*
6668
* @param mixed $model the data model
6769
* @param mixed $key the key associated with the data model
68-
* @param integer $index the zero-based index of the data model among the models array returned by [[GridView::dataProvider]].
70+
* @param int $index the zero-based index of the data model among the models array returned by [[GridView::dataProvider]]
71+
*
6972
* @return string the rendering result
7073
*/
7174
protected function renderDataCellContent($model, $key, $index)
@@ -76,7 +79,7 @@ protected function renderDataCellContent($model, $key, $index)
7679
$this->options['data-pk'] = $key;
7780
$this->options['data-name'] = $this->attribute;
7881
$this->options['data-type'] = $this->type;
79-
82+
8083
if (is_callable($this->editableOptions)) {
8184
$opts = call_user_func($this->editableOptions, $model, $key, $index);
8285
foreach ($opts as $prop => $v) {
@@ -119,4 +122,4 @@ protected function registerClientScript()
119122
$js[] = ";jQuery('$selector').editable();";
120123
$view->registerJs(implode("\n", $js));
121124
}
122-
}
125+
}

bundles/EditableAddressAsset.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
/**
88
* Class EditableAddressAsset
9+
*
910
* @package yii2mod\editable\bundles
1011
*/
1112
class EditableAddressAsset extends AssetBundle
@@ -19,21 +20,20 @@ class EditableAddressAsset extends AssetBundle
1920
* @var array
2021
*/
2122
public $css = [
22-
'bootstrap-editable-address.css'
23+
'bootstrap-editable-address.css',
2324
];
2425

2526
/**
2627
* @var array
2728
*/
2829
public $js = [
29-
'bootstrap-editable-address.js'
30+
'bootstrap-editable-address.js',
3031
];
3132

3233
/**
3334
* @var array
3435
*/
3536
public $depends = [
36-
'yii2mod\editable\bundles\EditableBootstrapAsset'
37+
'yii2mod\editable\bundles\EditableBootstrapAsset',
3738
];
38-
39-
}
39+
}

bundles/EditableBootstrapAsset.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
/**
88
* Class EditableBootstrapAsset
9+
*
910
* @package yii2mod\editable\bundles
1011
*/
1112
class EditableBootstrapAsset extends AssetBundle
@@ -19,7 +20,7 @@ class EditableBootstrapAsset extends AssetBundle
1920
* @var array
2021
*/
2122
public $css = [
22-
'css/bootstrap-editable.css'
23+
'css/bootstrap-editable.css',
2324
];
2425

2526
/**
@@ -37,4 +38,4 @@ public function init()
3738
{
3839
$this->js[] = YII_DEBUG ? 'js/bootstrap-editable.js' : 'js/bootstrap-editable.min.js';
3940
}
40-
}
41+
}

bundles/EditableComboDateAsset.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
/**
88
* Class EditableComboDateAsset
9+
*
910
* @package yii2mod\editable\bundles
1011
*/
1112
class EditableComboDateAsset extends AssetBundle
@@ -21,13 +22,13 @@ class EditableComboDateAsset extends AssetBundle
2122
public $js = [
2223
'vendor/moment-with-langs.min.js',
2324
'vendor/combodate.js',
24-
'bootstrap-editable-combodate.js'
25+
'bootstrap-editable-combodate.js',
2526
];
2627

2728
/**
2829
* @var array
2930
*/
3031
public $depends = [
31-
'yii2mod\editable\bundles\EditableBootstrapAsset'
32+
'yii2mod\editable\bundles\EditableBootstrapAsset',
3233
];
33-
}
34+
}

bundles/EditableDatePickerAsset.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
/**
88
* Class EditableDatePickerAsset
9+
*
910
* @package yii2mod\editable\bundles
1011
*/
1112
class EditableDatePickerAsset extends AssetBundle
@@ -19,22 +20,21 @@ class EditableDatePickerAsset extends AssetBundle
1920
* @var array
2021
*/
2122
public $css = [
22-
'vendor/css/datepicker3.css'
23+
'vendor/css/datepicker3.css',
2324
];
2425

2526
/**
2627
* @var array
2728
*/
2829
public $js = [
2930
'vendor/js/bootstrap-datepicker.js',
30-
'bootstrap-editable-datepicker.js'
31+
'bootstrap-editable-datepicker.js',
3132
];
3233

3334
/**
3435
* @var array
3536
*/
3637
public $depends = [
37-
'yii2mod\editable\bundles\EditableBootstrapAsset'
38+
'yii2mod\editable\bundles\EditableBootstrapAsset',
3839
];
39-
40-
}
40+
}

0 commit comments

Comments
 (0)