Convert strings to ::class

This commit is contained in:
Samuel Georges 2018-01-13 14:40:44 +11:00
parent df96c65b3c
commit 6ff6ab2996
1 changed files with 18 additions and 7 deletions

View File

@ -115,8 +115,12 @@ class ReorderController extends ControllerBehavior
* Simple
*/
if ($this->sortMode == 'simple') {
if (!$ids = post('record_ids')) return;
if (!$orders = post('sort_orders')) return;
if (
(!$ids = post('record_ids')) ||
(!$orders = post('sort_orders'))
) {
return;
}
$model->setSortableOrder($ids, $orders);
}
@ -127,7 +131,9 @@ class ReorderController extends ControllerBehavior
$sourceNode = $model->find(post('sourceNode'));
$targetNode = post('targetNode') ? $model->find(post('targetNode')) : null;
if ($sourceNode == $targetNode) return;
if ($sourceNode == $targetNode) {
return;
}
switch (post('position')) {
case 'before':
@ -177,6 +183,7 @@ class ReorderController extends ControllerBehavior
}
$modelClass = $this->getConfig('modelClass');
if (!$modelClass) {
throw new ApplicationException('Please specify the modelClass property for reordering');
}
@ -202,10 +209,10 @@ class ReorderController extends ControllerBehavior
$model = $this->controller->reorderGetModel();
$modelTraits = class_uses($model);
if (isset($modelTraits['October\Rain\Database\Traits\Sortable'])) {
if (isset($modelTraits[\October\Rain\Database\Traits\Sortable::class])) {
$this->sortMode = 'simple';
}
elseif (isset($modelTraits['October\Rain\Database\Traits\NestedTree'])) {
elseif (isset($modelTraits[\October\Rain\Database\Traits\NestedTree::class])) {
$this->sortMode = 'nested';
$this->showTree = true;
}
@ -280,12 +287,16 @@ class ReorderController extends ControllerBehavior
*/
public function reorderMakePartial($partial, $params = [])
{
$contents = $this->controller->makePartial('reorder_'.$partial, $params + $this->vars, false);
$contents = $this->controller->makePartial(
'reorder_' . $partial,
$params + $this->vars,
false
);
if (!$contents) {
$contents = $this->makePartial($partial, $params);
}
return $contents;
}
}