Skip to content

Commit

Permalink
Apply fixes from StyleCI (#1041)
Browse files Browse the repository at this point in the history
[ci skip] [skip ci]

Co-authored-by: StyleCI Bot <[email protected]>
  • Loading branch information
sampoyigi and StyleCIBot authored Jun 19, 2023
1 parent 9167041 commit 2e5711b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions app/admin/dashboardwidgets/Statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ protected function getValue(string $cardCode): string

protected function getValueForDefaultCard(string $cardCode, $start, $end)
{
$contextMethod = 'getTotal' . studly_case($cardCode) . 'Sum';
$contextMethod = 'getTotal'.studly_case($cardCode).'Sum';

throw_unless($this->methodExists($contextMethod), new SystemException(sprintf(
'The card [%s] does must have a defined method in [%s]',
$cardCode, get_class($this) . '::' . $contextMethod
$cardCode, get_class($this).'::'.$contextMethod
)));

$count = $this->$contextMethod(function ($query) use ($start, $end) {
Expand Down
1 change: 0 additions & 1 deletion app/admin/traits/HasChartDatasets.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Carbon\Carbon;
use DateInterval;
use DatePeriod;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;

trait HasChartDatasets
Expand Down
24 changes: 12 additions & 12 deletions app/admin/widgets/DashboardContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ public function onRenderWidgets()

$this->vars['widgets'] = $this->dashboardWidgets;

return ['#' . $this->getId('container') => $this->makePartial('dashboardcontainer/widget_container')];
return ['#'.$this->getId('container') => $this->makePartial('dashboardcontainer/widget_container')];
}

public function onLoadAddPopup()
{
$this->vars['gridColumns'] = $this->getWidgetPropertyWidthOptions();
$this->vars['widgets'] = collect(Widgets::instance()->listDashboardWidgets())->pluck('label', 'code');

return ['#' . $this->getId('new-widget-modal-content') => $this->makePartial('new_widget_popup')];
return ['#'.$this->getId('new-widget-modal-content') => $this->makePartial('new_widget_popup')];
}

public function onLoadUpdatePopup()
Expand All @@ -156,7 +156,7 @@ public function onLoadUpdatePopup()
$this->vars['widget'] = $widget = $this->findWidgetByAlias($widgetAlias);
$this->vars['widgetForm'] = $this->getFormWidget($widgetAlias, $widget);

return ['#' . $widgetAlias . '-modal-content' => $this->makePartial('widget_form')];
return ['#'.$widgetAlias.'-modal-content' => $this->makePartial('widget_form')];
}

public function onAddWidget()
Expand All @@ -177,11 +177,11 @@ public function onAddWidget()
new ApplicationException(lang('admin::lang.dashboard.alert_invalid_widget'))
);

$widgetAlias = $widgetCode . '_' . str_random(5);
$widgetAlias = $widgetCode.'_'.str_random(5);
$this->addWidget($widgetAlias, $widget, array_get($validated, 'size'));

return [
'@#' . $this->getId('container-list') => $this->makePartial('widget_item', [
'@#'.$this->getId('container-list') => $this->makePartial('widget_item', [
'widget' => $widget,
'widgetAlias' => $widgetAlias,
]),
Expand All @@ -200,7 +200,7 @@ public function onResetWidgets()

flash()->success(lang('admin::lang.dashboard.alert_reset_layout_success'));

return ['#' . $this->getId('container-list') => $this->makePartial('widget_list')];
return ['#'.$this->getId('container-list') => $this->makePartial('widget_list')];
}

public function onSetAsDefault()
Expand All @@ -227,7 +227,7 @@ public function onUpdateWidget()

[$rules, $attributes] = $widget->getPropertyRules();

$validated = $this->validate(request()->post($alias . '_fields'), array_merge([
$validated = $this->validate(request()->post($alias.'_fields'), array_merge([
'width' => ['numeric'],
], $rules), $attributes);

Expand Down Expand Up @@ -409,8 +409,8 @@ protected function getFormWidget($alias, $widget)
$formConfig['model'] = User_preferences_model::onUser();
$formConfig['data'] = $this->getWidgetPropertyValues($widget);
$formConfig['previewMode'] = $this->previewMode;
$formConfig['alias'] = $this->alias . studly_case('Form_' . $alias);
$formConfig['arrayName'] = $alias . '_fields';
$formConfig['alias'] = $this->alias.studly_case('Form_'.$alias);
$formConfig['arrayName'] = $alias.'_fields';

$formWidget = $this->makeWidget('Admin\Widgets\Form', $formConfig);
$formWidget->bindToController();
Expand Down Expand Up @@ -570,20 +570,20 @@ protected function saveWidgetProperties($alias, $properties)

protected function getUserPreferencesKey()
{
return 'admin_dashboardwidgets_' . $this->context;
return 'admin_dashboardwidgets_'.$this->context;
}

protected function getSystemParametersKey()
{
return 'admin_dashboardwidgets_default_' . $this->context;
return 'admin_dashboardwidgets_default_'.$this->context;
}

protected function getUniqueAlias($widgets)
{
$num = count($widgets);
do {
$num++;
$alias = 'dashboard_container_' . $this->context . '_' . $num;
$alias = 'dashboard_container_'.$this->context.'_'.$num;
} while (array_key_exists($alias, $widgets));

return $alias;
Expand Down
4 changes: 2 additions & 2 deletions app/system/classes/ComponentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public function convertCodeToPath($alias)
return $alias;
}

return $alias . '/components/' . ucfirst($alias);
return $alias.'/components/'.ucfirst($alias);
}

//
Expand Down Expand Up @@ -326,7 +326,7 @@ public function getComponentPropertyConfig($component, $addAliasProperty = true)
];

if (!in_array($propertyType, ['text', 'number']) && !array_key_exists('options', $params)) {
$methodName = 'get' . studly_case($name) . 'Options';
$methodName = 'get'.studly_case($name).'Options';
$property['options'] = [get_class($component), $methodName];
}

Expand Down

0 comments on commit 2e5711b

Please sign in to comment.