Skip to content

Commit

Permalink
Fixed code style and indentations
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed May 3, 2016
1 parent aaf6c84 commit 030913e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
11 changes: 6 additions & 5 deletions framework/data/ArrayDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ class ArrayDataProvider extends BaseDataProvider
* The array elements must use zero-based integer keys.
*/
public $allModels;
/**
* @var string the name of the \yii\base\Model based class used to provide column labels.
* @since 2.0.9
*/
public $modelClass;
/**
* @var string the name of the [[yii\base\Model|Model]] class that will be represented.
* This property is used to get columns' names.
* @since 2.0.9
*/
public $modelClass;

/**
* @inheritdoc
Expand Down
8 changes: 4 additions & 4 deletions framework/grid/DataColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ protected function getHeaderCellLabel()
/* @var $model Model */
$model = new $provider->query->modelClass;
$label = $model->getAttributeLabel($this->attribute);
} else if($provider instanceof ArrayDataProvider && $provider->modelClass !== null) {
/* @var $model Model */
$model = new $provider->modelClass;
$label = $model->getAttributeLabel($this->attribute);
} else if ($provider instanceof ArrayDataProvider && $provider->modelClass !== null) {
/* @var $model Model */
$model = new $provider->modelClass;
$label = $model->getAttributeLabel($this->attribute);
} else {
$models = $provider->getModels();
if (($model = reset($models)) instanceof Model) {
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/data/ArrayDataProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ public function testGetKeys()
$dataProvider = new ArrayDataProvider(['allModels' => $mixedArray, 'pagination' => $pagination]);
$this->assertEquals(['key1', 9], $dataProvider->getKeys());
}
}
}

0 comments on commit 030913e

Please sign in to comment.