From a59d3b83ebeba501e092995be033943e9cfdcb21 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Thu, 18 Jul 2019 22:50:37 +0800 Subject: [PATCH] Code quality clean up (#4449) Credit to @bennothommo --- .github/CONTRIBUTING.md | 4 +- config/app.php | 2 +- config/cms.php | 4 +- modules/backend/behaviors/FormController.php | 4 +- .../backend/behaviors/RelationController.php | 14 ++---- modules/backend/classes/Controller.php | 1 - modules/backend/classes/FormField.php | 2 - modules/backend/classes/FormTabs.php | 19 +++---- modules/backend/classes/FormWidgetBase.php | 1 - modules/backend/classes/NavigationManager.php | 6 ++- modules/backend/classes/WidgetManager.php | 2 +- modules/backend/controllers/Files.php | 6 ++- modules/backend/controllers/UserRoles.php | 2 +- ...017_10_01_000010_Db_Backend_User_Roles.php | 9 ++-- modules/backend/formwidgets/CodeEditor.php | 1 - modules/backend/formwidgets/DataTable.php | 1 - modules/backend/formwidgets/DatePicker.php | 2 +- modules/backend/formwidgets/NestedForm.php | 8 +-- modules/backend/formwidgets/RichEditor.php | 2 +- modules/backend/formwidgets/TagList.php | 7 +-- modules/backend/helpers/Backend.php | 5 +- modules/backend/models/BrandSetting.php | 3 +- modules/backend/models/ImportModel.php | 4 +- modules/backend/models/Preference.php | 2 - modules/backend/traits/ErrorMaker.php | 12 ++--- modules/backend/traits/FormModelWidget.php | 1 - modules/backend/widgets/Form.php | 15 +++--- modules/backend/widgets/MediaManager.php | 14 ++++-- modules/backend/widgets/ReportContainer.php | 1 - modules/backend/widgets/Table.php | 13 ++--- modules/backend/widgets/Toolbar.php | 1 - modules/cms/classes/Asset.php | 8 +-- modules/cms/classes/AutoDatasource.php | 4 +- modules/cms/classes/CmsCompoundObject.php | 2 - modules/cms/classes/CmsObjectCollection.php | 4 -- modules/cms/classes/ComponentBase.php | 3 +- modules/cms/classes/ComponentHelpers.php | 3 +- modules/cms/classes/Content.php | 1 - modules/cms/classes/Controller.php | 2 - modules/cms/classes/MediaViewHelper.php | 1 - modules/cms/classes/Theme.php | 2 +- modules/cms/contracts/CmsObject.php | 2 - modules/cms/controllers/ThemeLogs.php | 5 +- modules/cms/controllers/Themes.php | 2 +- modules/cms/lang/ar/lang.php | 2 +- modules/cms/lang/es-ar/lang.php | 2 +- modules/cms/models/ThemeData.php | 8 +-- modules/cms/models/ThemeExport.php | 1 - modules/cms/models/ThemeImport.php | 4 +- modules/cms/models/ThemeLog.php | 3 +- modules/cms/twig/Extension.php | 3 +- modules/cms/twig/FlashNode.php | 2 +- modules/cms/twig/FrameworkNode.php | 8 +-- modules/cms/twig/Loader.php | 2 +- modules/cms/widgets/ComponentList.php | 8 +-- modules/system/ServiceProvider.php | 2 +- modules/system/classes/CombineAssets.php | 8 +-- modules/system/classes/ComposerManager.php | 12 +++-- modules/system/classes/MailManager.php | 1 - modules/system/classes/MarkupManager.php | 3 -- modules/system/classes/MediaLibrary.php | 3 +- modules/system/classes/PluginBase.php | 5 +- modules/system/classes/SettingsManager.php | 1 - modules/system/classes/UpdateManager.php | 5 +- modules/system/console/OctoberInstall.php | 3 +- modules/system/console/OctoberUtil.php | 19 ++++--- modules/system/console/PluginList.php | 2 +- modules/system/console/ThemeList.php | 1 - modules/system/console/ThemeSync.php | 2 +- modules/system/controllers/EventLogs.php | 5 +- modules/system/controllers/RequestLogs.php | 5 +- modules/system/controllers/Updates.php | 18 ++++--- ...01_000014_Db_System_Mail_Layout_Rename.php | 3 +- ..._System_Mail_Layouts_Add_Options_Field.php | 4 +- modules/system/helpers/DateTime.php | 4 +- modules/system/lang/en/client.php | 4 +- modules/system/lang/es-ar/lang.php | 4 +- modules/system/lang/fa/client.php | 2 +- modules/system/lang/fi/client.php | 4 +- modules/system/lang/sv/lang.php | 2 +- modules/system/lang/zh-tw/lang.php | 2 +- modules/system/models/EventLog.php | 3 +- modules/system/models/MailLayout.php | 1 - modules/system/models/MailSetting.php | 3 -- modules/system/traits/AssetMaker.php | 4 -- modules/system/traits/ConfigMaker.php | 3 +- modules/system/twig/Loader.php | 2 +- modules/system/views/exception.php | 2 +- phpcs.xml | 13 +++++ tests/UiTestCase.php | 50 +++++++++++++------ .../plugins/database/tester/Plugin.php | 2 - .../database/tester/models/EventLog.php | 1 - .../plugins/database/tester/models/Phone.php | 1 - .../plugins/database/tester/models/Post.php | 2 - .../plugins/database/tester/models/Role.php | 2 - .../plugins/database/tester/models/User.php | 1 - .../tester/updates/create_authors_table.php | 5 +- .../updates/create_categories_table.php | 7 +-- .../tester/updates/create_event_log_table.php | 4 +- .../tester/updates/create_meta_table.php | 4 +- .../tester/updates/create_phones_table.php | 4 +- .../tester/updates/create_posts_table.php | 4 +- .../tester/updates/create_roles_table.php | 7 +-- .../tester/updates/create_users_table.php | 4 +- .../plugins/october/noupdates/Plugin.php | 2 - .../plugins/october/sample/Plugin.php | 2 - .../plugins/october/tester/Plugin.php | 2 - .../october/tester/components/Archive.php | 2 - .../october/tester/components/Categories.php | 1 - .../october/tester/components/Comments.php | 3 +- .../tester/components/ContentBlock.php | 2 - .../october/tester/components/MainMenu.php | 2 - .../october/tester/components/Post.php | 2 - .../plugins/testvendor/goto/Plugin.php | 1 - .../plugins/testvendor/test/Plugin.php | 2 - tests/functional/backend/AuthTest.php | 4 -- tests/functional/cms/TemplateTest.php | 4 -- .../backend/classes/WidgetManagerTest.php | 1 - tests/unit/backend/models/ExportModelTest.php | 4 +- tests/unit/backend/models/ImportModelTest.php | 5 +- tests/unit/backend/traits/WidgetMakerTest.php | 1 - .../cms/classes/CmsCompoundObjectTest.php | 18 ++++--- tests/unit/cms/classes/CmsExceptionTest.php | 1 - tests/unit/cms/classes/CmsObjectTest.php | 18 ++++--- tests/unit/cms/classes/CodeParserTest.php | 1 - tests/unit/cms/classes/ContentTest.php | 1 - tests/unit/cms/classes/ControllerTest.php | 1 - tests/unit/cms/classes/PartialStackTest.php | 1 - tests/unit/cms/classes/ThemeTest.php | 7 ++- .../plugins/database/DeferredBindingTest.php | 1 - .../plugins/database/SoftDeleteModelTest.php | 1 - .../unit/system/classes/CombineAssetsTest.php | 11 ++-- tests/unit/system/classes/CoreLangTest.php | 4 +- .../unit/system/classes/MarkupManagerTest.php | 5 +- 134 files changed, 307 insertions(+), 306 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d8d3638a2d..37f674d10e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -69,10 +69,12 @@ Please ensure that your Pull Request satisfies the following coding standards: - [PSR 1 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) - [PSR 0 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) +To validate your changes against our coding standards, you may run `./vendor/bin/phpcs -nq --extensions="php"` in your development folder. + #### Team rules The October team follows the [developer guidelines](https://octobercms.com/docs/help/developer-guide) as much as possible. #### Escalation process -We do our best to attend to all reported issues. If you have an important issue that requires attention, consider submitting a bounty using the [OctoberCMS Bounty Program](https://www.bountysource.com/teams/october). \ No newline at end of file +We do our best to attend to all reported issues. If you have an important issue that requires attention, consider submitting a bounty using the [OctoberCMS Bounty Program](https://www.bountysource.com/teams/october). diff --git a/config/app.php b/config/app.php index d427deb119..7f84c9bdff 100644 --- a/config/app.php +++ b/config/app.php @@ -56,7 +56,7 @@ | -------- STOP! -------- | Before you change this value, consider carefully if that is actually | what you want to do. It is HIGHLY recommended that this is always set - | to UTC (as your server & DB timezone should be as well) and instead you + | to UTC (as your server & DB timezone should be as well) and instead you | use cms.backendTimezone to set the default timezone used in the backend | to display dates & times. | diff --git a/config/cms.php b/config/cms.php index a2b2fb5af9..1751f83f07 100644 --- a/config/cms.php +++ b/config/cms.php @@ -425,7 +425,7 @@ | this feature on can create a conflict if you have a frontend Service | Worker running. The 'scope' needs to be correctly set and not have a | duplicate subfolder structure on the frontend, otherwise it will run - | on both the frontend and backend of your website. + | on both the frontend and backend of your website. | | true - allow service workers to run in the backend | @@ -433,6 +433,6 @@ | */ - 'enableBackendServiceWorkers' => false, + 'enableBackendServiceWorkers' => false, ]; diff --git a/modules/backend/behaviors/FormController.php b/modules/backend/behaviors/FormController.php index e4f38f800a..ae34592356 100644 --- a/modules/backend/behaviors/FormController.php +++ b/modules/backend/behaviors/FormController.php @@ -159,7 +159,9 @@ public function initForm($model, $context = null) $this->formWidget->bindEvent('form.beforeRefresh', function ($holder) { $result = $this->controller->formExtendRefreshData($this->formWidget, $holder->data); - if (is_array($result)) $holder->data = $result; + if (is_array($result)) { + $holder->data = $result; + } }); $this->formWidget->bindEvent('form.refreshFields', function ($fields) { diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index 1dcfc3ef81..542e4c7cf5 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -886,7 +886,6 @@ protected function makeManageWidget() * Form */ elseif ($this->manageMode == 'form') { - if (!$config = $this->makeConfigForMode('manage', 'form', false)) { return null; } @@ -1205,7 +1204,6 @@ public function onRelationManageAdd() * Add */ if ($this->viewMode == 'multi') { - $checkedIds = $recordId ? [$recordId] : post('checked'); if (is_array($checkedIds)) { @@ -1221,14 +1219,12 @@ public function onRelationManageAdd() $this->relationObject->add($model, $sessionKey); } } - } /* * Link */ elseif ($this->viewMode == 'single') { if ($recordId && ($model = $this->relationModel->find($recordId))) { - $this->relationObject->add($model, $sessionKey); $this->viewWidget->setFormValues($model->attributes); @@ -1242,7 +1238,6 @@ public function onRelationManageAdd() $parentModel->save(); } } - } } @@ -1264,7 +1259,6 @@ public function onRelationManageRemove() * Remove */ if ($this->viewMode == 'multi') { - $checkedIds = $recordId ? [$recordId] : post('checked'); if (is_array($checkedIds)) { @@ -1707,7 +1701,8 @@ protected function makeConfigForMode($mode = 'view', $type = 'list', $throwExcep * * @return \Backend\Classes\WidgetBase */ - public function relationGetManageWidget() { + public function relationGetManageWidget() + { return $this->manageWidget; } @@ -1716,7 +1711,8 @@ public function relationGetManageWidget() { * * @return \Backend\Classes\WidgetBase */ - public function relationGetViewWidget() { + public function relationGetViewWidget() + { return $this->viewWidget; } -} \ No newline at end of file +} diff --git a/modules/backend/classes/Controller.php b/modules/backend/classes/Controller.php index f76eec54e8..f6916b4eff 100644 --- a/modules/backend/classes/Controller.php +++ b/modules/backend/classes/Controller.php @@ -231,7 +231,6 @@ public function run($action = null, $params = []) * Check that user is logged in and has permission to view this page */ if (!$isPublicAction) { - /* * Not logged in, redirect to login screen or show ajax error. */ diff --git a/modules/backend/classes/FormField.php b/modules/backend/classes/FormField.php index a59dbcaf3a..5f52b5c23b 100644 --- a/modules/backend/classes/FormField.php +++ b/modules/backend/classes/FormField.php @@ -688,7 +688,6 @@ protected function getFieldNameFromData($fieldName, $data, $default = null) * relation value, all others will look up the relation object as normal. */ foreach ($keyParts as $key) { - if ($result instanceof Model && $result->hasRelation($key)) { if ($key == $lastField) { $result = $result->getRelationValue($key) ?: $default; @@ -709,7 +708,6 @@ protected function getFieldNameFromData($fieldName, $data, $default = null) } $result = $result->{$key}; } - } return $result; diff --git a/modules/backend/classes/FormTabs.php b/modules/backend/classes/FormTabs.php index d4360c3b4f..709a0306ec 100644 --- a/modules/backend/classes/FormTabs.php +++ b/modules/backend/classes/FormTabs.php @@ -31,12 +31,12 @@ class FormTabs implements IteratorAggregate, ArrayAccess * @var string Default tab label to use when none is specified. */ public $defaultTab = 'backend::lang.form.undefined_tab'; - + /** * @var array List of icons for their corresponding tabs. */ public $icons = []; - + /** * @var bool Should these tabs stretch to the bottom of the page layout. */ @@ -86,11 +86,11 @@ protected function evalConfig($config) if (array_key_exists('defaultTab', $config)) { $this->defaultTab = $config['defaultTab']; } - + if (array_key_exists('icons', $config)) { $this->icons = $config['icons']; } - + if (array_key_exists('stretch', $config)) { $this->stretch = $config['stretch']; } @@ -182,7 +182,7 @@ public function getAllFields() return $tablessFields; } - + /** * Returns an icon for the tab based on the tab's name. * @param string $name @@ -194,7 +194,7 @@ public function getIcon($name) return $this->icons[$name]; } } - + /** * Returns a tab pane CSS class. * @param string $index @@ -222,9 +222,10 @@ public function getPaneCssClass($index = null, $label = null) */ public function getIterator() { - return new ArrayIterator($this->suppressTabs - ? $this->getAllFields() - : $this->getFields() + return new ArrayIterator( + $this->suppressTabs + ? $this->getAllFields() + : $this->getFields() ); } diff --git a/modules/backend/classes/FormWidgetBase.php b/modules/backend/classes/FormWidgetBase.php index 91bbf2be20..d505e770fd 100644 --- a/modules/backend/classes/FormWidgetBase.php +++ b/modules/backend/classes/FormWidgetBase.php @@ -149,5 +149,4 @@ public function getLoadValue() return $this->formField->getValueFromData($this->data ?: $this->model, $defaultValue); } - } diff --git a/modules/backend/classes/NavigationManager.php b/modules/backend/classes/NavigationManager.php index 4a3af1e186..1376a7891a 100644 --- a/modules/backend/classes/NavigationManager.php +++ b/modules/backend/classes/NavigationManager.php @@ -124,7 +124,9 @@ protected function loadItems() */ $orderCount = 0; foreach ($item->sideMenu as $sideMenuItem) { - if ($sideMenuItem->order !== -1) continue; + if ($sideMenuItem->order !== -1) { + continue; + } $sideMenuItem->order = ($orderCount += 100); } @@ -530,4 +532,4 @@ protected function makeItemKey($owner, $code) { return strtoupper($owner).'.'.strtoupper($code); } -} \ No newline at end of file +} diff --git a/modules/backend/classes/WidgetManager.php b/modules/backend/classes/WidgetManager.php index 35099a48dd..ea39becffa 100644 --- a/modules/backend/classes/WidgetManager.php +++ b/modules/backend/classes/WidgetManager.php @@ -257,4 +257,4 @@ public function removeReportWidget($className) unset($this->reportWidgets[$className]); } -} \ No newline at end of file +} diff --git a/modules/backend/controllers/Files.php b/modules/backend/controllers/Files.php index 51fcded78f..adc5bcf32f 100644 --- a/modules/backend/controllers/Files.php +++ b/modules/backend/controllers/Files.php @@ -30,7 +30,8 @@ public function get($code = null) try { return $this->findFileObject($code)->output('inline', true); } - catch (Exception $ex) {} + catch (Exception $ex) { + } return Response::make(View::make('backend::404'), 404); } @@ -48,7 +49,8 @@ public function thumb($code = null, $width = 100, $height = 100, $mode = 'auto', true ); } - catch (Exception $ex) {} + catch (Exception $ex) { + } return Response::make(View::make('backend::404'), 404); } diff --git a/modules/backend/controllers/UserRoles.php b/modules/backend/controllers/UserRoles.php index caca7b288b..bed79dbe94 100644 --- a/modules/backend/controllers/UserRoles.php +++ b/modules/backend/controllers/UserRoles.php @@ -51,7 +51,7 @@ public function __construct() /* * Only super users can access */ - $this->bindEvent('page.beforeDisplay', function() { + $this->bindEvent('page.beforeDisplay', function () { if (!$this->user->isSuperUser()) { return Response::make(View::make('backend::access_denied'), 403); } diff --git a/modules/backend/database/migrations/2017_10_01_000010_Db_Backend_User_Roles.php b/modules/backend/database/migrations/2017_10_01_000010_Db_Backend_User_Roles.php index 601893a453..5fad314c51 100644 --- a/modules/backend/database/migrations/2017_10_01_000010_Db_Backend_User_Roles.php +++ b/modules/backend/database/migrations/2017_10_01_000010_Db_Backend_User_Roles.php @@ -88,7 +88,8 @@ protected function migratePermissionsFromGroupsToRoles() 'permissions' => $group->permissions ?? null ]); } - catch (Exception $ex) {} + catch (Exception $ex) { + } $permissions[$group->id] = $group->permissions ?? null; } @@ -130,7 +131,8 @@ protected function migratePermissionsFromGroupsToRoles() $perms = json_decode($permString, true); $userPerms = array_merge($userPerms, $perms); } - catch (Exception $ex) {} + catch (Exception $ex) { + } } if (count($userPerms) > 0) { @@ -157,6 +159,7 @@ protected function splicePermissionsForUser($userId, $permissions) 'permissions' => json_encode($newPerms) ]); } - catch (Exception $ex) {} + catch (Exception $ex) { + } } } diff --git a/modules/backend/formwidgets/CodeEditor.php b/modules/backend/formwidgets/CodeEditor.php index e6dd6a1d5d..9572aa62d5 100644 --- a/modules/backend/formwidgets/CodeEditor.php +++ b/modules/backend/formwidgets/CodeEditor.php @@ -215,5 +215,4 @@ protected function applyEditorPreferences() $this->displayIndentGuides = $preferences->editor_display_indent_guides; $this->showPrintMargin = $preferences->editor_show_print_margin; } - } diff --git a/modules/backend/formwidgets/DataTable.php b/modules/backend/formwidgets/DataTable.php index 40a5609b0c..7c25256407 100644 --- a/modules/backend/formwidgets/DataTable.php +++ b/modules/backend/formwidgets/DataTable.php @@ -192,5 +192,4 @@ public function getDataTableOptions($field, $data) return $result; } - } diff --git a/modules/backend/formwidgets/DatePicker.php b/modules/backend/formwidgets/DatePicker.php index 9c53bfd433..569bb6208b 100644 --- a/modules/backend/formwidgets/DatePicker.php +++ b/modules/backend/formwidgets/DatePicker.php @@ -122,7 +122,7 @@ public function prepareVars() if ($this->mode === 'date' && !$this->ignoreTimezone) { $backendTimeZone = \Backend\Models\Preference::get('timezone'); $value->setTimezone($backendTimeZone); - $value->setTime(0,0,0); + $value->setTime(0, 0, 0); $value->setTimezone(Config::get('app.timezone')); } $value = $value->toDateTimeString(); diff --git a/modules/backend/formwidgets/NestedForm.php b/modules/backend/formwidgets/NestedForm.php index a71152d6ee..2eca428b0b 100644 --- a/modules/backend/formwidgets/NestedForm.php +++ b/modules/backend/formwidgets/NestedForm.php @@ -35,7 +35,8 @@ class NestedForm extends FormWidgetBase /** * @inheritDoc */ - public function init() { + public function init() + { $this->fillFromConfig([ 'form', 'usePanelStyles', @@ -62,13 +63,14 @@ protected function loadAssets() /** * @inheritdoc */ - function render() + public function render() { $this->prepareVars(); return $this->makePartial('nestedform'); } - function prepareVars() { + public function prepareVars() + { $this->formWidget->previewMode = $this->previewMode; } } diff --git a/modules/backend/formwidgets/RichEditor.php b/modules/backend/formwidgets/RichEditor.php index 9387e8d289..af905d6fcd 100644 --- a/modules/backend/formwidgets/RichEditor.php +++ b/modules/backend/formwidgets/RichEditor.php @@ -217,8 +217,8 @@ protected function getPageLinksArray() $iterator = function ($links, $level = 0) use (&$iterator) { $result = []; - foreach ($links as $linkUrl => $link) { + foreach ($links as $linkUrl => $link) { /* * Remove scheme and host from URL */ diff --git a/modules/backend/formwidgets/TagList.php b/modules/backend/formwidgets/TagList.php index 5d1e51b285..fa1d8fe517 100644 --- a/modules/backend/formwidgets/TagList.php +++ b/modules/backend/formwidgets/TagList.php @@ -198,9 +198,10 @@ protected function getCustomSeparators() protected function getSeparatorCharacter() { switch (strtolower($this->separator)) { - case 'comma': return ','; - case 'space': return ' '; + case 'comma': + return ','; + case 'space': + return ' '; } } - } diff --git a/modules/backend/helpers/Backend.php b/modules/backend/helpers/Backend.php index 095207d46a..9708c6b40a 100644 --- a/modules/backend/helpers/Backend.php +++ b/modules/backend/helpers/Backend.php @@ -118,8 +118,8 @@ public function dateTime($dateTime, $options = []) 'timeSince' => false, 'ignoreTimezone' => false, ], $options)); - - if(!$dateTime) { + + if (!$dateTime) { return ''; } @@ -156,5 +156,4 @@ public function dateTime($dateTime, $options = []) return ''.e($defaultValue).''.PHP_EOL; } - } diff --git a/modules/backend/models/BrandSetting.php b/modules/backend/models/BrandSetting.php index f7a99851b4..10821fd0e8 100644 --- a/modules/backend/models/BrandSetting.php +++ b/modules/backend/models/BrandSetting.php @@ -43,7 +43,7 @@ class BrandSetting extends Model 'favicon' => \System\Models\File::class, 'logo' => \System\Models\File::class ]; - + /** * @var string The key to store rendered CSS in the cache under */ @@ -181,5 +181,4 @@ public static function getDefaultLogo() return null; } - } diff --git a/modules/backend/models/ImportModel.php b/modules/backend/models/ImportModel.php index 2569955b74..34622b46bf 100644 --- a/modules/backend/models/ImportModel.php +++ b/modules/backend/models/ImportModel.php @@ -174,7 +174,9 @@ protected function processImportRow($rowData, $matches) */ protected function decodeArrayValue($value, $delimeter = '|') { - if (strpos($value, $delimeter) === false) return [$value]; + if (strpos($value, $delimeter) === false) { + return [$value]; + } $data = preg_split('~(?isDir() && substr($node->getFileName(), 0, 6) == 'theme-') { // Remove the theme- prefix and the .js suffix, create an user friendly and capitalized name @@ -287,7 +286,6 @@ public function getEditorThemeOptions() $themes[$themeId] = $themeName; } } - } // Sort the theme alphabetically, and push the default theme diff --git a/modules/backend/traits/ErrorMaker.php b/modules/backend/traits/ErrorMaker.php index 2c9505513b..3d807c7e64 100644 --- a/modules/backend/traits/ErrorMaker.php +++ b/modules/backend/traits/ErrorMaker.php @@ -19,19 +19,19 @@ trait ErrorMaker /** * @return boolean Whether a fatal error has been set or not. */ - public function hasFatalError() + public function hasFatalError() { - return !is_null($this->fatalError); + return !is_null($this->fatalError); } - + /** * @return string The fatal error message */ - public function getFatalError() + public function getFatalError() { - return $this->fatalError; + return $this->fatalError; } - + /** * Sets standard page variables in the case of a controller error. */ diff --git a/modules/backend/traits/FormModelWidget.php b/modules/backend/traits/FormModelWidget.php index 12a75c4568..0186301c78 100644 --- a/modules/backend/traits/FormModelWidget.php +++ b/modules/backend/traits/FormModelWidget.php @@ -98,5 +98,4 @@ protected function getRelationType() list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom); return $model->getRelationType($attribute); } - } diff --git a/modules/backend/widgets/Form.php b/modules/backend/widgets/Form.php index 741fc7d468..623af759b9 100644 --- a/modules/backend/widgets/Form.php +++ b/modules/backend/widgets/Form.php @@ -408,7 +408,6 @@ public function onRefresh() * If an array of fields is supplied, update specified fields individually. */ if (($updateFields = post('fields')) && is_array($updateFields)) { - foreach ($updateFields as $field) { if (!isset($this->allFields[$field])) { continue; @@ -452,7 +451,7 @@ public function onRefresh() if (!is_array($eventResult)) { continue; } - + $result = $eventResult + $result; } @@ -686,7 +685,6 @@ protected function processAutoSpan($fields) public function addFields(array $fields, $addToArea = null) { foreach ($fields as $name => $config) { - $fieldObj = $this->makeFormField($name, $config); $fieldTab = is_array($config) ? array_get($config, 'tab') : null; @@ -875,8 +873,8 @@ protected function makeFormField($name, $config = []) * Get field options from model */ $optionModelTypes = ['dropdown', 'radio', 'checkboxlist', 'balloon-selector']; - if (in_array($field->type, $optionModelTypes, false)) { + if (in_array($field->type, $optionModelTypes, false)) { /* * Defer the execution of option data collection */ @@ -961,7 +959,9 @@ protected function makeFormFieldWidget($field) if (isset($field->config['options'])) { $field->options(function () use ($field) { $fieldOptions = $field->config['options']; - if ($fieldOptions === true) $fieldOptions = null; + if ($fieldOptions === true) { + $fieldOptions = null; + } $fieldOptions = $this->getOptionsFromModel($field, $fieldOptions); return $fieldOptions; }); @@ -1092,7 +1092,8 @@ protected function getFieldValue($field) * Checks if default values should be taken from data. * This should be done when model exists or when explicitly configured */ - protected function shouldFetchDefaultValues() { + protected function shouldFetchDefaultValues() + { $enableDefaults = object_get($this->config, 'enableDefaults'); if ($enableDefaults === false) { return false; @@ -1171,7 +1172,6 @@ public function getSaveData() */ $parts = HtmlHelper::nameToArray($field->fieldName); if (($value = $this->dataArrayGet($data, $parts)) !== null) { - /* * Number fields should be converted to integers */ @@ -1261,7 +1261,6 @@ protected function getOptionsFromModel($field, $fieldOptions) * Refer to the model method or any of its behaviors */ if (!is_array($fieldOptions) && !$fieldOptions) { - try { list($model, $attribute) = $field->resolveModelAttribute($this->model, $field->fieldName); } diff --git a/modules/backend/widgets/MediaManager.php b/modules/backend/widgets/MediaManager.php index b4a6a679a5..3c517d8d2f 100644 --- a/modules/backend/widgets/MediaManager.php +++ b/modules/backend/widgets/MediaManager.php @@ -1091,10 +1091,14 @@ protected function itemTypeToIconClass($item, $itemType) } switch ($itemType) { - case MediaLibraryItem::FILE_TYPE_IMAGE: return "icon-picture-o"; - case MediaLibraryItem::FILE_TYPE_VIDEO: return "icon-video-camera"; - case MediaLibraryItem::FILE_TYPE_AUDIO: return "icon-volume-up"; - default: return "icon-file"; + case MediaLibraryItem::FILE_TYPE_IMAGE: + return "icon-picture-o"; + case MediaLibraryItem::FILE_TYPE_VIDEO: + return "icon-video-camera"; + case MediaLibraryItem::FILE_TYPE_AUDIO: + return "icon-volume-up"; + default: + return "icon-file"; } } @@ -1873,7 +1877,7 @@ protected function cropImage($imageSrcPath, $selectionData, $cropSessionKey, $pa 'title' => $targetImageName, 'folder' => $targetFolder ]; - } + } /** * Detect if image is vector graphic (SVG) diff --git a/modules/backend/widgets/ReportContainer.php b/modules/backend/widgets/ReportContainer.php index 834b50dd0c..add008ecfa 100644 --- a/modules/backend/widgets/ReportContainer.php +++ b/modules/backend/widgets/ReportContainer.php @@ -423,7 +423,6 @@ protected function getWidgetPropertyConfig($widget) $result[] = $property; foreach ($properties as $name => $params) { - $property = [ 'property' => $name, 'title' => isset($params['title']) ? Lang::get($params['title']) : $name, diff --git a/modules/backend/widgets/Table.php b/modules/backend/widgets/Table.php index 09c5c425e6..5cca8e1ca6 100644 --- a/modules/backend/widgets/Table.php +++ b/modules/backend/widgets/Table.php @@ -138,9 +138,8 @@ public function prepareVars() $isClientDataSource = $this->isClientDataSource(); $this->vars['clientDataSourceClass'] = $isClientDataSource ? 'client' : 'server'; - $this->vars['data'] = json_encode($isClientDataSource - ? $this->dataSource->getAllRecords() - : [] + $this->vars['data'] = json_encode( + $isClientDataSource ? $this->dataSource->getAllRecords() : [] ); } @@ -168,15 +167,17 @@ protected function prepareColumnsArray() { $result = []; - foreach ($this->columns as $key=>$data) { + foreach ($this->columns as $key => $data) { $data['key'] = $key; - if (isset($data['title'])) + if (isset($data['title'])) { $data['title'] = trans($data['title']); + } if (isset($data['options'])) { - foreach ($data['options'] as &$option) + foreach ($data['options'] as &$option) { $option = trans($option); + } } if (isset($data['validation'])) { diff --git a/modules/backend/widgets/Toolbar.php b/modules/backend/widgets/Toolbar.php index 4e7575dad9..7d028eefae 100644 --- a/modules/backend/widgets/Toolbar.php +++ b/modules/backend/widgets/Toolbar.php @@ -58,7 +58,6 @@ public function init() * Prepare the search widget (optional) */ if (isset($this->search)) { - if (is_string($this->search)) { $searchConfig = $this->makeConfig(['partial' => $this->search]); } diff --git a/modules/cms/classes/Asset.php b/modules/cms/classes/Asset.php index 57c64627c9..c0920752ff 100644 --- a/modules/cms/classes/Asset.php +++ b/modules/cms/classes/Asset.php @@ -208,12 +208,12 @@ public function save() $this->originalFileName = $this->fileName; $this->exists = true; } - + public function delete() { $fileName = Request::input('fileName'); $fullPath = $this->getFilePath($fileName); - + $this->validateFileName($fileName); if (File::exists($fullPath)) { @@ -222,9 +222,9 @@ public function delete() 'cms::lang.asset.error_deleting_file', ['name' => $fileName] )); - } + } } - } + } /** * Validate the supplied filename, extension and path. diff --git a/modules/cms/classes/AutoDatasource.php b/modules/cms/classes/AutoDatasource.php index dca84da582..c16625fded 100644 --- a/modules/cms/classes/AutoDatasource.php +++ b/modules/cms/classes/AutoDatasource.php @@ -255,7 +255,9 @@ protected function getValidPaths(string $dirName, array $options = []) } // Filter out 'deleted' paths: - $paths = array_filter($paths, function ($value) { return (bool) $value; }); + $paths = array_filter($paths, function ($value) { + return (bool) $value; + }); // Return just an array of paths return array_keys($paths); diff --git a/modules/cms/classes/CmsCompoundObject.php b/modules/cms/classes/CmsCompoundObject.php index 6b5346198b..856d7d2588 100644 --- a/modules/cms/classes/CmsCompoundObject.php +++ b/modules/cms/classes/CmsCompoundObject.php @@ -237,7 +237,6 @@ public function hasComponent($componentName) $componentName = $componentManager->resolve($componentName); foreach ($this->settings['components'] as $sectionName => $values) { - $result = $sectionName; if ($sectionName == $componentName) { @@ -257,7 +256,6 @@ public function hasComponent($componentName) if ($sectionName == $componentName) { return $result; } - } return false; diff --git a/modules/cms/classes/CmsObjectCollection.php b/modules/cms/classes/CmsObjectCollection.php index dc53211067..ffc7afc73a 100644 --- a/modules/cms/classes/CmsObjectCollection.php +++ b/modules/cms/classes/CmsObjectCollection.php @@ -19,11 +19,9 @@ class CmsObjectCollection extends CollectionBase public function withComponent($components, $callback = null) { return $this->filter(function ($object) use ($components, $callback) { - $hasComponent = false; foreach ((array) $components as $componentName) { - if (!$callback && $object->hasComponent($componentName)) { $hasComponent = true; } @@ -73,7 +71,6 @@ public function whereComponent($components, $property, $value, $strict = false) $hasComponent = false; foreach ((array) $components as $componentName) { - if (!$componentAlias = $object->hasComponent($componentName)) { continue; } @@ -101,5 +98,4 @@ public function whereComponent($components, $property, $value, $strict = false) return $hasComponent; }); } - } diff --git a/modules/cms/classes/ComponentBase.php b/modules/cms/classes/ComponentBase.php index 337a9b6b7a..5014ab1d80 100644 --- a/modules/cms/classes/ComponentBase.php +++ b/modules/cms/classes/ComponentBase.php @@ -306,7 +306,8 @@ public function __call($method, $parameters) try { return parent::__call($method, $parameters); } - catch (BadMethodCallException $ex) {} + catch (BadMethodCallException $ex) { + } if (method_exists($this->controller, $method)) { return call_user_func_array([$this->controller, $method], $parameters); diff --git a/modules/cms/classes/ComponentHelpers.php b/modules/cms/classes/ComponentHelpers.php index 15f0607a8d..682c4208eb 100644 --- a/modules/cms/classes/ComponentHelpers.php +++ b/modules/cms/classes/ComponentHelpers.php @@ -75,8 +75,9 @@ public static function getComponentsPropertyConfig($component, $addAliasProperty } } - if ($returnArray) + if ($returnArray) { return $result; + } return json_encode($result); } diff --git a/modules/cms/classes/Content.php b/modules/cms/classes/Content.php index 220da69071..a2ba639b86 100644 --- a/modules/cms/classes/Content.php +++ b/modules/cms/classes/Content.php @@ -70,5 +70,4 @@ public function parseMarkup() return $result; } - } diff --git a/modules/cms/classes/Controller.php b/modules/cms/classes/Controller.php index 92a11db2e0..77e2fa6dfe 100644 --- a/modules/cms/classes/Controller.php +++ b/modules/cms/classes/Controller.php @@ -841,7 +841,6 @@ protected function runAjaxHandler($handler) * Process Component handler */ if (strpos($handler, '::')) { - list($componentName, $handlerName) = explode('::', $handler); $componentObj = $this->findComponentByName($componentName); @@ -965,7 +964,6 @@ public function renderPartial($name, $parameters = [], $throwException = true) * Process Component partial */ elseif (strpos($name, '::') !== false) { - list($componentAlias, $partialName) = explode('::', $name); /* diff --git a/modules/cms/classes/MediaViewHelper.php b/modules/cms/classes/MediaViewHelper.php index be11ce15c9..2d743dbacd 100644 --- a/modules/cms/classes/MediaViewHelper.php +++ b/modules/cms/classes/MediaViewHelper.php @@ -102,5 +102,4 @@ protected function getDefaultPlayerMarkup($type, $src) break; } } - } diff --git a/modules/cms/classes/Theme.php b/modules/cms/classes/Theme.php index eb36938ee6..110d47dfe0 100644 --- a/modules/cms/classes/Theme.php +++ b/modules/cms/classes/Theme.php @@ -344,7 +344,7 @@ public function getConfig() $config = Yaml::parseFile($path); } else { $cacheKey = self::CONFIG_KEY.'::'.$this->getDirName(); - $config = Cache::rememberForever($cacheKey, function() use ($path) { + $config = Cache::rememberForever($cacheKey, function () use ($path) { return Yaml::parseFile($path); }); } diff --git a/modules/cms/contracts/CmsObject.php b/modules/cms/contracts/CmsObject.php index 8b79a81741..c6b9b67e6b 100644 --- a/modules/cms/contracts/CmsObject.php +++ b/modules/cms/contracts/CmsObject.php @@ -2,7 +2,6 @@ interface CmsObject { - /** * Loads the template. * @@ -59,5 +58,4 @@ public function getTwigContent(); * @return string */ public function getTwigCacheKey(); - } diff --git a/modules/cms/controllers/ThemeLogs.php b/modules/cms/controllers/ThemeLogs.php index 4e508fd6c3..a229aef23f 100644 --- a/modules/cms/controllers/ThemeLogs.php +++ b/modules/cms/controllers/ThemeLogs.php @@ -64,9 +64,10 @@ public function index_onEmptyLog() public function index_onDelete() { if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) { - foreach ($checkedIds as $recordId) { - if (!$record = ThemeLog::find($recordId)) continue; + if (!$record = ThemeLog::find($recordId)) { + continue; + } $record->delete(); } diff --git a/modules/cms/controllers/Themes.php b/modules/cms/controllers/Themes.php index 55058f8cf4..5bdf1625d2 100644 --- a/modules/cms/controllers/Themes.php +++ b/modules/cms/controllers/Themes.php @@ -49,7 +49,7 @@ public function __construct() /* * Custom redirect for unauthorized request */ - $this->bindEvent('page.beforeDisplay', function() { + $this->bindEvent('page.beforeDisplay', function () { if (!$this->user->hasAccess('cms.manage_themes')) { return Backend::redirect('cms/themeoptions/update'); } diff --git a/modules/cms/lang/ar/lang.php b/modules/cms/lang/ar/lang.php index 295a5218f1..aca084296f 100644 --- a/modules/cms/lang/ar/lang.php +++ b/modules/cms/lang/ar/lang.php @@ -27,7 +27,7 @@ ], 'editor' => [ 'settings' => 'الإعدادات', - ], + ], 'asset' => [ 'menu_label' => 'الأصول', ], diff --git a/modules/cms/lang/es-ar/lang.php b/modules/cms/lang/es-ar/lang.php index ff24128f5a..4c5d62fe20 100644 --- a/modules/cms/lang/es-ar/lang.php +++ b/modules/cms/lang/es-ar/lang.php @@ -154,7 +154,7 @@ 'not_found' => "El componente ':name' no se encuentra.", 'method_not_found' => "El componente ':name' no contiene un método ':method'.", ], - 'template' => [ + 'template' => [ 'invalid_type' => "Tipo de plantilla Desconocido.", 'not_found' => "No se encontró la plantilla solicitada.", 'saved'=> "La plantilla se ha guardado correctamente." diff --git a/modules/cms/models/ThemeData.php b/modules/cms/models/ThemeData.php index e06f1a8592..49b7e4c01a 100644 --- a/modules/cms/models/ThemeData.php +++ b/modules/cms/models/ThemeData.php @@ -69,7 +69,7 @@ public function beforeSave() } /** - * Clear asset cache after saving to ensure `assetVar` form fields take + * Clear asset cache after saving to ensure `assetVar` form fields take * immediate effect. */ public function afterSave() @@ -77,7 +77,8 @@ public function afterSave() try { CombineAssets::resetCache(); } - catch (Exception $ex) {} + catch (Exception $ex) { + } } /** @@ -151,7 +152,6 @@ public function beforeValidate() */ public function initFormFields() { - } /** @@ -227,7 +227,7 @@ public static function applyAssetVariablesToCombinerFilters($filters) { $theme = CmsTheme::getActiveTheme(); - if (!$theme){ + if (!$theme) { return; } diff --git a/modules/cms/models/ThemeExport.php b/modules/cms/models/ThemeExport.php index c568a7736d..0152fa3d70 100644 --- a/modules/cms/models/ThemeExport.php +++ b/modules/cms/models/ThemeExport.php @@ -110,7 +110,6 @@ public function export($theme, $data = []) File::deleteDirectory($tempPath); } catch (Exception $ex) { - if (strlen($tempPath) && File::isDirectory($tempPath)) { File::deleteDirectory($tempPath); } diff --git a/modules/cms/models/ThemeImport.php b/modules/cms/models/ThemeImport.php index d9e6f92744..9ebebf8b0d 100644 --- a/modules/cms/models/ThemeImport.php +++ b/modules/cms/models/ThemeImport.php @@ -88,8 +88,7 @@ public function import($theme, $data = [], $sessionKey = null) $this->theme = $theme; $this->fill($data); - try - { + try { $file = $this->uploaded_file()->withDeferred($sessionKey)->first(); if (!$file) { throw new ApplicationException('There is no file attached to import!'); @@ -125,7 +124,6 @@ public function import($theme, $data = [], $sessionKey = null) $file->delete(); } catch (Exception $ex) { - if (!empty($tempPath) && File::isDirectory($tempPath)) { File::deleteDirectory($tempPath); } diff --git a/modules/cms/models/ThemeLog.php b/modules/cms/models/ThemeLog.php index 343f2fe05e..6105e3150b 100644 --- a/modules/cms/models/ThemeLog.php +++ b/modules/cms/models/ThemeLog.php @@ -94,7 +94,8 @@ public static function add(HalcyonModel $template, $type = null) try { $record->save(); } - catch (Exception $ex) {} + catch (Exception $ex) { + } return $record; } diff --git a/modules/cms/twig/Extension.php b/modules/cms/twig/Extension.php index ed07dfb95e..8dfc67de5d 100644 --- a/modules/cms/twig/Extension.php +++ b/modules/cms/twig/Extension.php @@ -193,8 +193,9 @@ public function displayBlock($name, $default = null) return $default; } - if ($event = Event::fire('cms.block.render', [$name, $result], true)) + if ($event = Event::fire('cms.block.render', [$name, $result], true)) { $result = $event; + } $result = str_replace('', trim($default), $result); return $result; diff --git a/modules/cms/twig/FlashNode.php b/modules/cms/twig/FlashNode.php index cf0f4ac7c0..462a5382f0 100644 --- a/modules/cms/twig/FlashNode.php +++ b/modules/cms/twig/FlashNode.php @@ -31,7 +31,7 @@ public function compile(TwigCompiler $compiler) ; if ($attrib == 'all') { - $compiler + $compiler ->addDebugInfo($this) ->write('foreach (Flash::getMessages() as $type => $messages) {'.PHP_EOL) ->indent() diff --git a/modules/cms/twig/FrameworkNode.php b/modules/cms/twig/FrameworkNode.php index ae75e18175..5c01fa3bba 100644 --- a/modules/cms/twig/FrameworkNode.php +++ b/modules/cms/twig/FrameworkNode.php @@ -38,7 +38,8 @@ public function compile(TwigCompiler $compiler) ->write("echo ''.PHP_EOL;" . PHP_EOL) ->write("echo ''.PHP_EOL;" . PHP_EOL) + .'/modules/system/assets/js/framework.combined-min.js\" as=\"script\" importance=\"low\">'.PHP_EOL;" . PHP_EOL) + ->outdent() ->write("}" . PHP_EOL) ->write("else {" . PHP_EOL) @@ -50,13 +51,14 @@ public function compile(TwigCompiler $compiler) ->write("echo ''.PHP_EOL;" . PHP_EOL) ->write("echo ''.PHP_EOL;" . PHP_EOL) + .'/modules/system/assets/js/framework.extras.js\" as=\"script\" importance=\"low\">'.PHP_EOL;" . PHP_EOL) + ->outdent() ->write("}" . PHP_EOL) ->write("echo ''.PHP_EOL;" . PHP_EOL) ->write("echo ''.PHP_EOL;" . PHP_EOL) + .'/modules/system/assets/css/framework.extras'.(\$_minify ? '-min' : '').'.css\" as=\"style\" importance=\"low\">'.PHP_EOL;" . PHP_EOL) ; } else { diff --git a/modules/cms/twig/Loader.php b/modules/cms/twig/Loader.php index 88670f0e82..8550a96e6b 100644 --- a/modules/cms/twig/Loader.php +++ b/modules/cms/twig/Loader.php @@ -1,7 +1,7 @@ getId('component-list') => $this->makePartial('items', [ - 'items' => $this->getData()] - )]; + return [ + '#' . $this->getId('component-list') => $this->makePartial('items', [ + 'items' => $this->getData() + ]) + ]; } protected function itemMatchesSearch(&$words, $item) diff --git a/modules/system/ServiceProvider.php b/modules/system/ServiceProvider.php index 7933df3efc..af2b86bb67 100644 --- a/modules/system/ServiceProvider.php +++ b/modules/system/ServiceProvider.php @@ -536,7 +536,7 @@ protected function registerAssetBundles() */ protected function registerValidator() { - $this->app->resolving('validator', function($validator) { + $this->app->resolving('validator', function ($validator) { /* * Allowed file extensions, as opposed to mime types. * - extensions: png,jpg,txt diff --git a/modules/system/classes/CombineAssets.php b/modules/system/classes/CombineAssets.php index 5cd13c815b..8b4dacd4dc 100644 --- a/modules/system/classes/CombineAssets.php +++ b/modules/system/classes/CombineAssets.php @@ -202,7 +202,7 @@ public static function combine($assets = [], $localPath = null) * @param string $localPath Prefix all assets with this path (optional) * @return void */ - public function combineToFile($assets = [], $destination, $localPath = null) + public function combineToFile($assets, $destination, $localPath = null) { // Disable cache always $this->storagePath = null; @@ -212,8 +212,10 @@ public function combineToFile($assets = [], $destination, $localPath = null) if (substr($localPath, -1) !== '/') { $localPath = $localPath.'/'; } - $assets = array_map(function($asset) use ($localPath) { - if (substr($asset, 0, 1) === '@') return $asset; + $assets = array_map(function ($asset) use ($localPath) { + if (substr($asset, 0, 1) === '@') { + return $asset; + } return $localPath.$asset; }, $assets); } diff --git a/modules/system/classes/ComposerManager.php b/modules/system/classes/ComposerManager.php index 350e2f1282..f731c35938 100644 --- a/modules/system/classes/ComposerManager.php +++ b/modules/system/classes/ComposerManager.php @@ -70,7 +70,9 @@ public function autoload($vendorPath) if (file_exists($file = $dir . '/autoload_namespaces.php')) { $map = require $file; foreach ($map as $namespace => $path) { - if (isset($this->namespacePool[$namespace])) continue; + if (isset($this->namespacePool[$namespace])) { + continue; + } $this->loader->set($namespace, $path); $this->namespacePool[$namespace] = true; } @@ -79,7 +81,9 @@ public function autoload($vendorPath) if (file_exists($file = $dir . '/autoload_psr4.php')) { $map = require $file; foreach ($map as $namespace => $path) { - if (isset($this->psr4Pool[$namespace])) continue; + if (isset($this->psr4Pool[$namespace])) { + continue; + } $this->loader->setPsr4($namespace, $path); $this->psr4Pool[$namespace] = true; } @@ -98,7 +102,9 @@ public function autoload($vendorPath) $includeFiles = require $file; foreach ($includeFiles as $includeFile) { $relativeFile = $this->stripVendorDir($includeFile, $vendorPath); - if (isset($this->includeFilesPool[$relativeFile])) continue; + if (isset($this->includeFilesPool[$relativeFile])) { + continue; + } require $includeFile; $this->includeFilesPool[$relativeFile] = true; } diff --git a/modules/system/classes/MailManager.php b/modules/system/classes/MailManager.php index ed707b29b0..33e9dc0032 100644 --- a/modules/system/classes/MailManager.php +++ b/modules/system/classes/MailManager.php @@ -192,7 +192,6 @@ public function renderTemplate($template, $data = []) $disableAutoInlineCss = false; if ($template->layout) { - $disableAutoInlineCss = array_get($template->layout->options, 'disable_auto_inline_css', $disableAutoInlineCss); $html = $this->renderTwig($template->layout->content_html, [ diff --git a/modules/system/classes/MarkupManager.php b/modules/system/classes/MarkupManager.php index 64a3e0526f..c621b66caa 100644 --- a/modules/system/classes/MarkupManager.php +++ b/modules/system/classes/MarkupManager.php @@ -124,7 +124,6 @@ public function registerExtensions($type, array $definitions) } foreach ($definitions as $name => $definition) { - switch ($type) { case self::EXTENSION_TOKEN_PARSER: $this->$items[$type][] = $definition; @@ -227,7 +226,6 @@ public function makeTwigFunctions($functions = []) } foreach ($this->listFunctions() as $name => $callable) { - /* * Handle a wildcard function */ @@ -261,7 +259,6 @@ public function makeTwigFilters($filters = []) } foreach ($this->listFilters() as $name => $callable) { - /* * Handle a wildcard function */ diff --git a/modules/system/classes/MediaLibrary.php b/modules/system/classes/MediaLibrary.php index 859fa056d5..6458257508 100644 --- a/modules/system/classes/MediaLibrary.php +++ b/modules/system/classes/MediaLibrary.php @@ -735,8 +735,9 @@ protected function sortItemList(&$itemList, $sortSettings) */ protected function filterItemList(&$itemList, $filter) { - if (!$filter) + if (!$filter) { return; + } $result = []; foreach ($itemList as $item) { diff --git a/modules/system/classes/PluginBase.php b/modules/system/classes/PluginBase.php index 18df4541f6..4ad6afbe55 100644 --- a/modules/system/classes/PluginBase.php +++ b/modules/system/classes/PluginBase.php @@ -50,8 +50,9 @@ public function pluginDetails() if (!array_key_exists('plugin', $configuration)) { throw new SystemException(sprintf( - 'The plugin configuration file plugin.yaml should contain the "plugin" section: %s.', $thisClass) - ); + 'The plugin configuration file plugin.yaml should contain the "plugin" section: %s.', + $thisClass + )); } return $configuration['plugin']; diff --git a/modules/system/classes/SettingsManager.php b/modules/system/classes/SettingsManager.php index e6c6791220..82bb0f7318 100644 --- a/modules/system/classes/SettingsManager.php +++ b/modules/system/classes/SettingsManager.php @@ -171,7 +171,6 @@ protected function filterByContext($items, $context) { $filteredItems = []; foreach ($items as $categoryName => $category) { - $filteredCategory = []; foreach ($category as $item) { $itemContext = is_array($item->context) ? $item->context : [$item->context]; diff --git a/modules/system/classes/UpdateManager.php b/modules/system/classes/UpdateManager.php index 8d4b434190..0f82641996 100644 --- a/modules/system/classes/UpdateManager.php +++ b/modules/system/classes/UpdateManager.php @@ -523,7 +523,6 @@ public function updatePlugin($name) $this->versionManager->resetNotes()->setNotesOutput($this->notesOutput); if ($this->versionManager->updatePlugin($plugin) !== false) { - foreach ($this->versionManager->getNotes() as $note) { $this->note($note); } @@ -680,7 +679,9 @@ public function requestProductDetails($codes, $type = null) $requestedDetails = array_intersect_key($this->productCache[$type], array_flip($codes)); foreach ($requestedDetails as $detail) { - if ($detail === -1) continue; + if ($detail === -1) { + continue; + } $result[] = $detail; } diff --git a/modules/system/console/OctoberInstall.php b/modules/system/console/OctoberInstall.php index 204b71d4e4..3033b8f13b 100644 --- a/modules/system/console/OctoberInstall.php +++ b/modules/system/console/OctoberInstall.php @@ -130,7 +130,8 @@ protected function setupAdvancedValues() $this->writeToConfig('app', ['debug' => $debug]); } - protected function askToInstallPlugins() { + protected function askToInstallPlugins() + { $chosenToInstall = []; if ($this->confirm('Install the October.Drivers plugin?', false)) { $chosenToInstall[] = 'October.Drivers'; diff --git a/modules/system/console/OctoberUtil.php b/modules/system/console/OctoberUtil.php index 7121a0bc5c..398893d0d6 100644 --- a/modules/system/console/OctoberUtil.php +++ b/modules/system/console/OctoberUtil.php @@ -160,7 +160,7 @@ protected function utilCompileAssets($type = null) $combiner = CombineAssets::instance(); $bundles = $combiner->getBundles($type); - if (!$bundles){ + if (!$bundles) { $this->comment('Nothing to compile!'); return; } @@ -198,7 +198,6 @@ protected function utilCompileLang() $stub = base_path() . '/modules/system/assets/js/lang/lang.stub'; foreach ($locales as $locale) { - /* * Generate messages */ @@ -209,7 +208,7 @@ protected function utilCompileLang() if (File::isFile($srcPath) && $fallbackPath != $srcPath) { $messages = array_replace_recursive($messages, require $srcPath); } - + /* * Load possible replacements from /lang */ @@ -314,7 +313,10 @@ protected function utilGitPull() { foreach (File::directories(plugins_path()) as $authorDir) { foreach (File::directories($authorDir) as $pluginDir) { - if (!File::isDirectory($pluginDir.'/.git')) continue; + if (!File::isDirectory($pluginDir.'/.git')) { + continue; + } + $exec = 'cd ' . $pluginDir . ' && '; $exec .= 'git pull 2>&1'; echo 'Updating plugin: '. basename(dirname($pluginDir)) .'.'. basename($pluginDir) . PHP_EOL; @@ -323,7 +325,10 @@ protected function utilGitPull() } foreach (File::directories(themes_path()) as $themeDir) { - if (!File::isDirectory($themeDir.'/.git')) continue; + if (!File::isDirectory($themeDir.'/.git')) { + continue; + } + $exec = 'cd ' . $themeDir . ' && '; $exec .= 'git pull 2>&1'; echo 'Updating theme: '. basename($themeDir) . PHP_EOL; @@ -335,7 +340,7 @@ protected function utilSetProject() { $projectId = $this->option('projectId'); - if (empty($projectId)){ + if (empty($projectId)) { $this->error("No projectId defined, use --projectId= to set a projectId"); return; } @@ -348,7 +353,5 @@ protected function utilSetProject() 'system::project.name' => $result['name'], 'system::project.owner' => $result['owner'], ]); - } - } diff --git a/modules/system/console/PluginList.php b/modules/system/console/PluginList.php index e0bf4072ca..9f5dbe5a52 100644 --- a/modules/system/console/PluginList.php +++ b/modules/system/console/PluginList.php @@ -34,7 +34,7 @@ public function handle() $allPlugins = PluginVersion::all(); $pluginsCount = count($allPlugins); - if ($pluginsCount <= 0 ) { + if ($pluginsCount <= 0) { $this->info('No plugin found'); return; } diff --git a/modules/system/console/ThemeList.php b/modules/system/console/ThemeList.php index 9547475c18..53287d1c6f 100644 --- a/modules/system/console/ThemeList.php +++ b/modules/system/console/ThemeList.php @@ -42,7 +42,6 @@ public function handle() } if ($this->option('include-marketplace')) { - // @todo List everything in the marketplace - not just popular. $popularThemes = $updateManager->requestPopularProducts('theme'); diff --git a/modules/system/console/ThemeSync.php b/modules/system/console/ThemeSync.php index 35f4666149..b74eac6112 100644 --- a/modules/system/console/ThemeSync.php +++ b/modules/system/console/ThemeSync.php @@ -181,7 +181,7 @@ public function handle() } // Confirm with the user - if (!$this->confirmToProceed(sprintf('This will OVERWRITE the %s provided paths in "themes/%s" on the %s with content from the %s', count($validPaths), $themeName, $target, $source), function () { return true; })) { + if (!$this->confirmToProceed(sprintf('This will OVERWRITE the %s provided paths in "themes/%s" on the %s with content from the %s', count($validPaths), $themeName, $target, $source), true)) { return; } diff --git a/modules/system/controllers/EventLogs.php b/modules/system/controllers/EventLogs.php index b03c624722..7d7f474f27 100644 --- a/modules/system/controllers/EventLogs.php +++ b/modules/system/controllers/EventLogs.php @@ -65,9 +65,10 @@ public function index_onEmptyLog() public function index_onDelete() { if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) { - foreach ($checkedIds as $recordId) { - if (!$record = EventLog::find($recordId)) continue; + if (!$record = EventLog::find($recordId)) { + continue; + } $record->delete(); } diff --git a/modules/system/controllers/RequestLogs.php b/modules/system/controllers/RequestLogs.php index 435f6f9681..23d0ceaaf7 100644 --- a/modules/system/controllers/RequestLogs.php +++ b/modules/system/controllers/RequestLogs.php @@ -63,9 +63,10 @@ public function index_onEmptyLog() public function index_onDelete() { if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) { - foreach ($checkedIds as $recordId) { - if (!$record = RequestLog::find($recordId)) continue; + if (!$record = RequestLog::find($recordId)) { + continue; + } $record->delete(); } diff --git a/modules/system/controllers/Updates.php b/modules/system/controllers/Updates.php index 3cc7985b79..bbf461aadc 100644 --- a/modules/system/controllers/Updates.php +++ b/modules/system/controllers/Updates.php @@ -189,14 +189,15 @@ protected function getPluginVersionFile($path, $filename) } //Filter out update scripts - $details = array_filter($details, function($string) use ($path) { + $details = array_filter($details, function ($string) use ($path) { return !preg_match('/^[a-z_\-0-9]*\.php$/i', $string) || !File::exists($path . '/updates/' . $string); }); $contents[$version] = $details; } } - catch (Exception $ex) {} + catch (Exception $ex) { + } uksort($contents, function ($a, $b) { return version_compare($b, $a); @@ -209,7 +210,9 @@ protected function getPluginMarkdownFile($path, $filenames) { $contents = null; foreach ($filenames as $file) { - if (!File::exists($path . '/'.$file)) continue; + if (!File::exists($path . '/'.$file)) { + continue; + } $contents = File::get($path . '/'.$file); @@ -369,7 +372,9 @@ protected function processImportantUpdates($result) $coreImportant = false; foreach (array_get($result, 'core.updates', []) as $build => $description) { - if (strpos($description, '!!!') === false) continue; + if (strpos($description, '!!!') === false) { + continue; + } $detailsUrl = '//octobercms.com/support/articles/release-notes'; $description = str_replace('!!!', '', $description); @@ -387,7 +392,9 @@ protected function processImportantUpdates($result) $isImportant = false; foreach (array_get($plugin, 'updates', []) as $version => $description) { - if (strpos($description, '!!!') === false) continue; + if (strpos($description, '!!!') === false) { + continue; + } $isImportant = $hasImportantUpdates = true; $detailsUrl = Backend::url('system/updates/details/'.PluginVersion::makeSlug($code).'/upgrades').'?fetch=1'; @@ -910,7 +917,6 @@ public function onInstallTheme() public function onRemoveTheme() { if ($themeCode = post('code')) { - ThemeManager::instance()->deleteTheme($themeCode); Flash::success(trans('cms::lang.theme.delete_theme_success')); diff --git a/modules/system/database/migrations/2015_10_01_000014_Db_System_Mail_Layout_Rename.php b/modules/system/database/migrations/2015_10_01_000014_Db_System_Mail_Layout_Rename.php index 7102c02c82..1b28ca53b0 100644 --- a/modules/system/database/migrations/2015_10_01_000014_Db_System_Mail_Layout_Rename.php +++ b/modules/system/database/migrations/2015_10_01_000014_Db_System_Mail_Layout_Rename.php @@ -13,7 +13,8 @@ public function up() $layout->content_text = preg_replace("/({{\s*message\s*[|]raw\s*}})/i", "{{ content|raw }}", $layout->content_text); $layout->forceSave(); } - catch (Exception $ex) {} + catch (Exception $ex) { + } } } diff --git a/modules/system/database/migrations/2017_10_23_000024_Db_System_Mail_Layouts_Add_Options_Field.php b/modules/system/database/migrations/2017_10_23_000024_Db_System_Mail_Layouts_Add_Options_Field.php index 0cac68edbd..cc907699e5 100644 --- a/modules/system/database/migrations/2017_10_23_000024_Db_System_Mail_Layouts_Add_Options_Field.php +++ b/modules/system/database/migrations/2017_10_23_000024_Db_System_Mail_Layouts_Add_Options_Field.php @@ -11,11 +11,11 @@ public function up() $table->text('options')->nullable()->after('is_locked'); }); } - + public function down() { Schema::table('system_mail_layouts', function (Blueprint $table) { - $table->dropColumn('options'); + $table->dropColumn('options'); }); } } diff --git a/modules/system/helpers/DateTime.php b/modules/system/helpers/DateTime.php index 4aaa80eb5f..9401dfb5b1 100644 --- a/modules/system/helpers/DateTime.php +++ b/modules/system/helpers/DateTime.php @@ -68,7 +68,8 @@ public static function makeCarbon($value, $throwException = true) else { try { $value = Carbon::parse($value); - } catch (Exception $ex) {} + } catch (Exception $ex) { + } } if (!$value instanceof Carbon && $throwException) { @@ -131,5 +132,4 @@ public static function momentFormat($format) return strtr($format, $replacements); } - } diff --git a/modules/system/lang/en/client.php b/modules/system/lang/en/client.php index fdca0db164..32baa88872 100644 --- a/modules/system/lang/en/client.php +++ b/modules/system/lang/en/client.php @@ -65,8 +65,8 @@ ], 'scopes' => [ 'apply_button_text' => 'Apply', - 'clear_button_text' => 'Clear' - ], + 'clear_button_text' => 'Clear' + ], 'dates' => [ 'all' => 'all', 'filter_button_text' => 'Filter', diff --git a/modules/system/lang/es-ar/lang.php b/modules/system/lang/es-ar/lang.php index ba45104d6d..5989370eed 100644 --- a/modules/system/lang/es-ar/lang.php +++ b/modules/system/lang/es-ar/lang.php @@ -128,7 +128,7 @@ 'install_completing' => 'Finalizó el proceso de instalación', 'install_success' => 'El plugin se ha instalado correctamente.', ], - 'updates' => [ + 'updates' => [ 'title' => 'Administrar actualizaciones', 'name' => 'Actualizaciones de software', 'menu_label' => 'Actualizaciones', @@ -174,7 +174,7 @@ 'file_error' => 'El servidor no pudo entregar el paquete.', 'file_corrupt' => 'El archivo se encuentra dañado.', ], - 'behavior' => [ + 'behavior' => [ 'missing_property' => 'Clase :class debe definir la propiedad $:property utilizada por :behavior comportamiento.', ], 'config' => [ diff --git a/modules/system/lang/fa/client.php b/modules/system/lang/fa/client.php index 3598aa7c88..52f2a18f9c 100644 --- a/modules/system/lang/fa/client.php +++ b/modules/system/lang/fa/client.php @@ -49,7 +49,7 @@ 'cancel_button_text' => 'انصراف', 'widget_remove_confirm' => 'این ابزارک حذف شود؟' ], -'datepicker' => [ + 'datepicker' => [ 'previousMonth' => 'ماه قبل', 'nextMonth' => 'ماه بعد', 'months' => ['فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'], diff --git a/modules/system/lang/fi/client.php b/modules/system/lang/fi/client.php index 46cece1fa3..18f86a0629 100644 --- a/modules/system/lang/fi/client.php +++ b/modules/system/lang/fi/client.php @@ -64,8 +64,8 @@ ], 'scopes' => [ 'apply_button_text' => 'Ota käyttöön', - 'clear_button_text' => 'Tyhjennä' - ], + 'clear_button_text' => 'Tyhjennä' + ], 'dates' => [ 'all' => 'kaikki', 'filter_button_text' => 'Suodata', diff --git a/modules/system/lang/sv/lang.php b/modules/system/lang/sv/lang.php index 616273c7dd..bbf60c5fcd 100644 --- a/modules/system/lang/sv/lang.php +++ b/modules/system/lang/sv/lang.php @@ -218,7 +218,7 @@ 'none' => [ 'label' => 'Inga uppdateringar', 'help' => 'Inga nya uppdateringar hittades.' - ], + ], 'important_action' => [ 'empty' => 'Välj åtgärd', 'confirm' => 'Bekräfta uppdatering', diff --git a/modules/system/lang/zh-tw/lang.php b/modules/system/lang/zh-tw/lang.php index 4769515aa4..7dadf2f197 100644 --- a/modules/system/lang/zh-tw/lang.php +++ b/modules/system/lang/zh-tw/lang.php @@ -261,7 +261,7 @@ 'view_the_dashboard' => '查看儀表板', 'manage_branding' => '自訂後台' ], - 'media' => [ + 'media' => [ 'invalid_path' => "不合法的路徑: ':path'.", 'folder_size_items' => '個數', ], diff --git a/modules/system/models/EventLog.php b/modules/system/models/EventLog.php index bba8648a93..a4b53795dd 100644 --- a/modules/system/models/EventLog.php +++ b/modules/system/models/EventLog.php @@ -58,7 +58,8 @@ public static function add($message, $level = 'info', $details = null) try { $record->save(); } - catch (Exception $ex) {} + catch (Exception $ex) { + } return $record; } diff --git a/modules/system/models/MailLayout.php b/modules/system/models/MailLayout.php index 01273ad68e..30e46601a8 100644 --- a/modules/system/models/MailLayout.php +++ b/modules/system/models/MailLayout.php @@ -141,5 +141,4 @@ protected static function getTemplateSections($code) { return MailParser::parse(FileHelper::get(View::make($code)->getPath())); } - } diff --git a/modules/system/models/MailSetting.php b/modules/system/models/MailSetting.php index 348ca9be8d..deca9d4e15 100644 --- a/modules/system/models/MailSetting.php +++ b/modules/system/models/MailSetting.php @@ -88,7 +88,6 @@ public static function applyConfigValues() $config->set('mail.from.address', $settings->sender_email); switch ($settings->send_mode) { - case self::MODE_SMTP: $config->set('mail.host', $settings->smtp_address); $config->set('mail.port', $settings->smtp_port); @@ -127,10 +126,8 @@ public static function applyConfigValues() $config->set('services.ses.region', $settings->ses_region); break; } - } - /** * @return array smtp_encryption options values */ diff --git a/modules/system/traits/AssetMaker.php b/modules/system/traits/AssetMaker.php index 9954689b93..673e535967 100644 --- a/modules/system/traits/AssetMaker.php +++ b/modules/system/traits/AssetMaker.php @@ -55,7 +55,6 @@ public function makeAssets($type = null) if ($type == null || $type == 'css') { foreach ($this->assets['css'] as $asset) { - /* * Prevent duplicates */ @@ -314,10 +313,8 @@ protected function getAssetScheme($asset) protected function removeDuplicates() { foreach ($this->assets as $type => &$collection) { - $pathCache = []; foreach ($collection as $key => $asset) { - if (!$path = array_get($asset, 'path')) { continue; } @@ -329,7 +326,6 @@ protected function removeDuplicates() $pathCache[$path] = true; } - } } diff --git a/modules/system/traits/ConfigMaker.php b/modules/system/traits/ConfigMaker.php index 449aede8cf..92245ab831 100644 --- a/modules/system/traits/ConfigMaker.php +++ b/modules/system/traits/ConfigMaker.php @@ -51,7 +51,6 @@ public function makeConfig($configFile = [], $requiredConfig = []) * Process config from file contents */ else { - if (isset($this->controller) && method_exists($this->controller, 'getConfigPath')) { $configFile = $this->controller->getConfigPath($configFile); } @@ -101,7 +100,7 @@ public function makeConfig($configFile = [], $requiredConfig = []) /** * Makes a config object from an array, making the first level keys properties of a new object. - * + * * @param array $configArray Config array. * @return stdClass The config object */ diff --git a/modules/system/twig/Loader.php b/modules/system/twig/Loader.php index 6be4985880..341d089593 100644 --- a/modules/system/twig/Loader.php +++ b/modules/system/twig/Loader.php @@ -2,7 +2,7 @@ use App; use File; -use Twig\Source as TwigSource;; +use Twig\Source as TwigSource; use Twig\Loader\LoaderInterface as TwigLoaderInterface; use Exception; diff --git a/modules/system/views/exception.php b/modules/system/views/exception.php index 4ec127dc16..4879c907db 100644 --- a/modules/system/views/exception.php +++ b/modules/system/views/exception.php @@ -69,4 +69,4 @@ SyntaxHighlighter.all() - \ No newline at end of file + diff --git a/phpcs.xml b/phpcs.xml index d4beffb1e8..fb9d971f86 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -19,11 +19,24 @@ */tests/* + + + */tests/* + + bootstrap/ config/ modules/ plugins/october/demo/ tests/ + */vendor/* + + modules/system/views/exception.php + + tests/fixtures/plugins/testvendor/goto/Plugin.php diff --git a/tests/UiTestCase.php b/tests/UiTestCase.php index f29b4fb4f1..66354672c0 100644 --- a/tests/UiTestCase.php +++ b/tests/UiTestCase.php @@ -2,24 +2,31 @@ class UiTestCase extends PHPUnit_Extensions_SeleniumTestCase { - protected function setUp() { /* * Look for selenium configuration */ - if (file_exists($seleniumEnv = __DIR__.'/../selenium.php')) + if (file_exists($seleniumEnv = __DIR__.'/../selenium.php')) { require_once $seleniumEnv; + } /* * Configure selenium */ - if (!defined('TEST_SELENIUM_URL')) + if (!defined('TEST_SELENIUM_URL')) { return $this->markTestSkipped('Selenium skipped'); + } - if (defined('TEST_SELENIUM_HOST')) $this->setHost(TEST_SELENIUM_HOST); - if (defined('TEST_SELENIUM_PORT')) $this->setPort(TEST_SELENIUM_PORT); - if (defined('TEST_SELENIUM_BROWSER')) $this->setBrowser(TEST_SELENIUM_BROWSER); + if (defined('TEST_SELENIUM_HOST')) { + $this->setHost(TEST_SELENIUM_HOST); + } + if (defined('TEST_SELENIUM_PORT')) { + $this->setPort(TEST_SELENIUM_PORT); + } + if (defined('TEST_SELENIUM_BROWSER')) { + $this->setBrowser(TEST_SELENIUM_BROWSER); + } $this->setBrowserUrl(TEST_SELENIUM_URL); } @@ -60,32 +67,45 @@ protected function getSweetConfirmation($expectedText = null, $clickOk = true) protected function waitForElementPresent($target, $timeout = 60) { - for ($second = 0; ; $second++) { - if ($second >= $timeout) + $second = 0; + + while (true) { + if ($second >= $timeout) { $this->fail('timeout'); + } try { - if ($this->isElementPresent($target)) break; + if ($this->isElementPresent($target)) { + break; + } + } + catch (Exception $e) { } - catch (Exception $e) {} sleep(1); + ++$second; } } protected function waitForElementNotPresent($target, $timeout = 60) { - for ($second = 0; ; $second++) { - if ($second >= $timeout) + $second = 0; + + while (true) { + if ($second >= $timeout) { $this->fail('timeout'); + } try { - if (!$this->isElementPresent($target)) break; + if (!$this->isElementPresent($target)) { + break; + } + } + catch (Exception $e) { } - catch (Exception $e) {} sleep(1); + ++$second; } } - } diff --git a/tests/fixtures/plugins/database/tester/Plugin.php b/tests/fixtures/plugins/database/tester/Plugin.php index ad118519f6..bd3796d288 100644 --- a/tests/fixtures/plugins/database/tester/Plugin.php +++ b/tests/fixtures/plugins/database/tester/Plugin.php @@ -4,7 +4,6 @@ class Plugin extends PluginBase { - public function pluginDetails() { return [ @@ -13,5 +12,4 @@ public function pluginDetails() 'author' => 'Alexey Bobkov, Samuel Georges' ]; } - } diff --git a/tests/fixtures/plugins/database/tester/models/EventLog.php b/tests/fixtures/plugins/database/tester/models/EventLog.php index 6e093a2498..33a361b41f 100644 --- a/tests/fixtures/plugins/database/tester/models/EventLog.php +++ b/tests/fixtures/plugins/database/tester/models/EventLog.php @@ -27,5 +27,4 @@ class EventLog extends Model public $morphTo = [ 'related' => [] ]; - } diff --git a/tests/fixtures/plugins/database/tester/models/Phone.php b/tests/fixtures/plugins/database/tester/models/Phone.php index ffbd8e8cf3..54035a5c59 100644 --- a/tests/fixtures/plugins/database/tester/models/Phone.php +++ b/tests/fixtures/plugins/database/tester/models/Phone.php @@ -26,5 +26,4 @@ class Phone extends Model public $belongsTo = [ 'author' => 'Database\Tester\Models\Author', ]; - } diff --git a/tests/fixtures/plugins/database/tester/models/Post.php b/tests/fixtures/plugins/database/tester/models/Post.php index e20410923f..421768d9b3 100644 --- a/tests/fixtures/plugins/database/tester/models/Post.php +++ b/tests/fixtures/plugins/database/tester/models/Post.php @@ -68,7 +68,6 @@ class SluggablePost extends Post 'slug' => 'title', 'long_slug' => ['title', 'description'] ]; - } class RevisionablePost extends Post @@ -117,7 +116,6 @@ public function getRevisionableUser() { return 7; } - } class ValidationPost extends Post diff --git a/tests/fixtures/plugins/database/tester/models/Role.php b/tests/fixtures/plugins/database/tester/models/Role.php index 6a2fdd44b8..8d561319d1 100644 --- a/tests/fixtures/plugins/database/tester/models/Role.php +++ b/tests/fixtures/plugins/database/tester/models/Role.php @@ -7,7 +7,6 @@ */ class Role extends Model { - /** * @var string The database table used by the model. */ @@ -32,5 +31,4 @@ class Role extends Model 'table' => 'database_tester_authors_roles' ], ]; - } diff --git a/tests/fixtures/plugins/database/tester/models/User.php b/tests/fixtures/plugins/database/tester/models/User.php index 6c4e42b8cb..867992c2ca 100644 --- a/tests/fixtures/plugins/database/tester/models/User.php +++ b/tests/fixtures/plugins/database/tester/models/User.php @@ -24,7 +24,6 @@ class User extends Model public $attachMany = [ 'photos' => 'System\Models\File' ]; - } class SoftDeleteUser extends User diff --git a/tests/fixtures/plugins/database/tester/updates/create_authors_table.php b/tests/fixtures/plugins/database/tester/updates/create_authors_table.php index 2e542580a9..6466e4e13b 100644 --- a/tests/fixtures/plugins/database/tester/updates/create_authors_table.php +++ b/tests/fixtures/plugins/database/tester/updates/create_authors_table.php @@ -5,11 +5,9 @@ class CreateAuthorsTable extends Migration { - public function up() { - Schema::create('database_tester_authors', function ($table) - { + Schema::create('database_tester_authors', function ($table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->integer('user_id')->unsigned()->index()->nullable(); @@ -24,5 +22,4 @@ public function down() { Schema::dropIfExists('database_tester_authors'); } - } diff --git a/tests/fixtures/plugins/database/tester/updates/create_categories_table.php b/tests/fixtures/plugins/database/tester/updates/create_categories_table.php index 49cf8a1c12..39e21890b6 100644 --- a/tests/fixtures/plugins/database/tester/updates/create_categories_table.php +++ b/tests/fixtures/plugins/database/tester/updates/create_categories_table.php @@ -8,8 +8,7 @@ class CreateCategoriesTable extends Migration public function up() { - Schema::create('database_tester_categories', function ($table) - { + Schema::create('database_tester_categories', function ($table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->integer('parent_id')->nullable(); @@ -22,8 +21,7 @@ public function up() $table->softDeletes(); }); - Schema::create('database_tester_categories_nested', function ($table) - { + Schema::create('database_tester_categories_nested', function ($table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->integer('parent_id')->nullable(); @@ -45,5 +43,4 @@ public function down() Schema::dropIfExists('database_tester_categories'); Schema::dropIfExists('database_tester_categories_nested'); } - } diff --git a/tests/fixtures/plugins/database/tester/updates/create_event_log_table.php b/tests/fixtures/plugins/database/tester/updates/create_event_log_table.php index 8539d85d8d..90c0c74795 100644 --- a/tests/fixtures/plugins/database/tester/updates/create_event_log_table.php +++ b/tests/fixtures/plugins/database/tester/updates/create_event_log_table.php @@ -8,8 +8,7 @@ class CreateEventLogTable extends Migration public function up() { - Schema::create('database_tester_event_log', function ($table) - { + Schema::create('database_tester_event_log', function ($table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->string('action', 30)->nullable(); @@ -24,5 +23,4 @@ public function down() { Schema::dropIfExists('database_tester_event_log'); } - } diff --git a/tests/fixtures/plugins/database/tester/updates/create_meta_table.php b/tests/fixtures/plugins/database/tester/updates/create_meta_table.php index 3add13d2c7..f0e456259a 100644 --- a/tests/fixtures/plugins/database/tester/updates/create_meta_table.php +++ b/tests/fixtures/plugins/database/tester/updates/create_meta_table.php @@ -8,8 +8,7 @@ class CreateMetaTable extends Migration public function up() { - Schema::create('database_tester_meta', function ($table) - { + Schema::create('database_tester_meta', function ($table) { $table->engine = 'InnoDB'; $table->increments('id')->unsigned(); $table->integer('taggable_id')->unsigned()->index()->nullable(); @@ -28,5 +27,4 @@ public function down() { Schema::dropIfExists('database_tester_meta'); } - } diff --git a/tests/fixtures/plugins/database/tester/updates/create_phones_table.php b/tests/fixtures/plugins/database/tester/updates/create_phones_table.php index 891344c27a..61e02d3f81 100644 --- a/tests/fixtures/plugins/database/tester/updates/create_phones_table.php +++ b/tests/fixtures/plugins/database/tester/updates/create_phones_table.php @@ -8,8 +8,7 @@ class CreatePhonesTable extends Migration public function up() { - Schema::create('database_tester_phones', function ($table) - { + Schema::create('database_tester_phones', function ($table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->string('number')->nullable(); @@ -22,5 +21,4 @@ public function down() { Schema::dropIfExists('database_tester_phones'); } - } diff --git a/tests/fixtures/plugins/database/tester/updates/create_posts_table.php b/tests/fixtures/plugins/database/tester/updates/create_posts_table.php index 139ea288fb..de4b28e4e4 100644 --- a/tests/fixtures/plugins/database/tester/updates/create_posts_table.php +++ b/tests/fixtures/plugins/database/tester/updates/create_posts_table.php @@ -8,8 +8,7 @@ class CreatePostsTable extends Migration public function up() { - Schema::create('database_tester_posts', function ($table) - { + Schema::create('database_tester_posts', function ($table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->string('title')->nullable(); @@ -29,5 +28,4 @@ public function down() { Schema::dropIfExists('database_tester_posts'); } - } diff --git a/tests/fixtures/plugins/database/tester/updates/create_roles_table.php b/tests/fixtures/plugins/database/tester/updates/create_roles_table.php index 6ed84b4c90..8a3ae0a697 100644 --- a/tests/fixtures/plugins/database/tester/updates/create_roles_table.php +++ b/tests/fixtures/plugins/database/tester/updates/create_roles_table.php @@ -8,8 +8,7 @@ class CreateRolesTable extends Migration public function up() { - Schema::create('database_tester_roles', function ($table) - { + Schema::create('database_tester_roles', function ($table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->string('name')->nullable(); @@ -17,8 +16,7 @@ public function up() $table->timestamps(); }); - Schema::create('database_tester_authors_roles', function ($table) - { + Schema::create('database_tester_authors_roles', function ($table) { $table->engine = 'InnoDB'; $table->integer('author_id')->unsigned(); $table->integer('role_id')->unsigned(); @@ -33,5 +31,4 @@ public function down() Schema::dropIfExists('database_tester_roles'); Schema::dropIfExists('database_tester_authors_roles'); } - } diff --git a/tests/fixtures/plugins/database/tester/updates/create_users_table.php b/tests/fixtures/plugins/database/tester/updates/create_users_table.php index 13838f4746..4551004609 100644 --- a/tests/fixtures/plugins/database/tester/updates/create_users_table.php +++ b/tests/fixtures/plugins/database/tester/updates/create_users_table.php @@ -8,8 +8,7 @@ class CreateUsersTable extends Migration public function up() { - Schema::create('database_tester_users', function ($table) - { + Schema::create('database_tester_users', function ($table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->string('name')->nullable(); @@ -23,5 +22,4 @@ public function down() { Schema::dropIfExists('database_tester_users'); } - } diff --git a/tests/fixtures/plugins/october/noupdates/Plugin.php b/tests/fixtures/plugins/october/noupdates/Plugin.php index 5486e2251a..9a64814989 100644 --- a/tests/fixtures/plugins/october/noupdates/Plugin.php +++ b/tests/fixtures/plugins/october/noupdates/Plugin.php @@ -4,7 +4,6 @@ class Plugin extends PluginBase { - public function pluginDetails() { return [ @@ -13,5 +12,4 @@ public function pluginDetails() 'author' => 'Alexey Bobkov, Samuel Georges' ]; } - } diff --git a/tests/fixtures/plugins/october/sample/Plugin.php b/tests/fixtures/plugins/october/sample/Plugin.php index 9d934d1cb4..218c89a044 100644 --- a/tests/fixtures/plugins/october/sample/Plugin.php +++ b/tests/fixtures/plugins/october/sample/Plugin.php @@ -4,7 +4,6 @@ class Plugin extends PluginBase { - public function pluginDetails() { return [ @@ -13,5 +12,4 @@ public function pluginDetails() 'author' => 'Alexey Bobkov, Samuel Georges' ]; } - } diff --git a/tests/fixtures/plugins/october/tester/Plugin.php b/tests/fixtures/plugins/october/tester/Plugin.php index 7a4c8035cc..edfee8bf93 100644 --- a/tests/fixtures/plugins/october/tester/Plugin.php +++ b/tests/fixtures/plugins/october/tester/Plugin.php @@ -4,7 +4,6 @@ class Plugin extends PluginBase { - public function pluginDetails() { return [ @@ -62,5 +61,4 @@ public function registerNavigation() ] ]; } - } diff --git a/tests/fixtures/plugins/october/tester/components/Archive.php b/tests/fixtures/plugins/october/tester/components/Archive.php index 97ec581bda..37b005e02f 100644 --- a/tests/fixtures/plugins/october/tester/components/Archive.php +++ b/tests/fixtures/plugins/october/tester/components/Archive.php @@ -4,7 +4,6 @@ class Archive extends ComponentBase { - public function componentDetails() { return [ @@ -39,5 +38,4 @@ public function onTestAjax() { $this->page['var'] = 'page'; } - } diff --git a/tests/fixtures/plugins/october/tester/components/Categories.php b/tests/fixtures/plugins/october/tester/components/Categories.php index dd2ab1be56..3e02414964 100644 --- a/tests/fixtures/plugins/october/tester/components/Categories.php +++ b/tests/fixtures/plugins/october/tester/components/Categories.php @@ -30,5 +30,4 @@ public function onTestAjax() { $this->page['var'] = 'page'; } - } diff --git a/tests/fixtures/plugins/october/tester/components/Comments.php b/tests/fixtures/plugins/october/tester/components/Comments.php index 227b028635..96658280e6 100644 --- a/tests/fixtures/plugins/october/tester/components/Comments.php +++ b/tests/fixtures/plugins/october/tester/components/Comments.php @@ -8,7 +8,7 @@ class Comments extends ComponentBase { private $users; - public function __construct(CodeBase $cmsObject = null, $properties = [], Users $users) + public function __construct(CodeBase $cmsObject = null, $properties = [], Users $users = null) { parent::__construct($cmsObject, $properties); $this->users = $users; @@ -39,5 +39,4 @@ public function getUsers() { return $this->users; } - } diff --git a/tests/fixtures/plugins/october/tester/components/ContentBlock.php b/tests/fixtures/plugins/october/tester/components/ContentBlock.php index ea02f1c8aa..024ac55c24 100644 --- a/tests/fixtures/plugins/october/tester/components/ContentBlock.php +++ b/tests/fixtures/plugins/october/tester/components/ContentBlock.php @@ -4,7 +4,6 @@ class ContentBlock extends ComponentBase { - public function componentDetails() { return [ @@ -21,5 +20,4 @@ public function onRender() return 'Pass'; } - } diff --git a/tests/fixtures/plugins/october/tester/components/MainMenu.php b/tests/fixtures/plugins/october/tester/components/MainMenu.php index 131cd2f5ab..74b8d41b41 100644 --- a/tests/fixtures/plugins/october/tester/components/MainMenu.php +++ b/tests/fixtures/plugins/october/tester/components/MainMenu.php @@ -4,7 +4,6 @@ class MainMenu extends ComponentBase { - public function componentDetails() { return [ @@ -17,5 +16,4 @@ public function menuItems() { return ['Home', 'Blog', 'About', 'Contact']; } - } diff --git a/tests/fixtures/plugins/october/tester/components/Post.php b/tests/fixtures/plugins/october/tester/components/Post.php index 571d99f4ba..bab86b037e 100644 --- a/tests/fixtures/plugins/october/tester/components/Post.php +++ b/tests/fixtures/plugins/october/tester/components/Post.php @@ -4,7 +4,6 @@ class Post extends ComponentBase { - public function componentDetails() { return [ @@ -22,5 +21,4 @@ public function defineProperties() ] ]; } - } diff --git a/tests/fixtures/plugins/testvendor/goto/Plugin.php b/tests/fixtures/plugins/testvendor/goto/Plugin.php index 829c564351..3d1b816a66 100644 --- a/tests/fixtures/plugins/testvendor/goto/Plugin.php +++ b/tests/fixtures/plugins/testvendor/goto/Plugin.php @@ -4,7 +4,6 @@ class Plugin extends PluginBase { - public function pluginDetails() { return [ diff --git a/tests/fixtures/plugins/testvendor/test/Plugin.php b/tests/fixtures/plugins/testvendor/test/Plugin.php index d2b78734e6..cb9921a567 100644 --- a/tests/fixtures/plugins/testvendor/test/Plugin.php +++ b/tests/fixtures/plugins/testvendor/test/Plugin.php @@ -4,7 +4,6 @@ class Plugin extends PluginBase { - public function pluginDetails() { return [ @@ -23,5 +22,4 @@ public function registerFormWidgets() ] ]; } - } diff --git a/tests/functional/backend/AuthTest.php b/tests/functional/backend/AuthTest.php index 4332847f14..4c1fe925df 100644 --- a/tests/functional/backend/AuthTest.php +++ b/tests/functional/backend/AuthTest.php @@ -1,8 +1,6 @@ open('backend'); @@ -88,7 +86,5 @@ public function testPasswordReset() catch (PHPUnit_Framework_AssertionFailedError $e) { array_push($this->verificationErrors, $e->toString()); } - } - } diff --git a/tests/functional/cms/TemplateTest.php b/tests/functional/cms/TemplateTest.php index b59b851a7c..5ff2a0a9ed 100644 --- a/tests/functional/cms/TemplateTest.php +++ b/tests/functional/cms/TemplateTest.php @@ -1,8 +1,6 @@ signInToBackend(); @@ -141,7 +139,5 @@ public function testOpenTemplates() $this->click("xpath=(//button[@data-request='onDelete'])[1]"); $this->getSweetConfirmation('Do you really want delete this content file?'); $this->waitForElementNotPresent("name=fileName"); - } - } diff --git a/tests/unit/backend/classes/WidgetManagerTest.php b/tests/unit/backend/classes/WidgetManagerTest.php index 5e88096ae3..8199973850 100644 --- a/tests/unit/backend/classes/WidgetManagerTest.php +++ b/tests/unit/backend/classes/WidgetManagerTest.php @@ -44,5 +44,4 @@ public function testIfWidgetsCanBeRemoved() $this->assertCount(1, $widgets); } - } diff --git a/tests/unit/backend/models/ExportModelTest.php b/tests/unit/backend/models/ExportModelTest.php index 367bc1e9d9..4fd55b6f01 100644 --- a/tests/unit/backend/models/ExportModelTest.php +++ b/tests/unit/backend/models/ExportModelTest.php @@ -2,7 +2,9 @@ use Backend\Models\ExportModel; -if (!class_exists('Model')) class_alias('October\Rain\Database\Model', 'Model'); +if (!class_exists('Model')) { + class_alias('October\Rain\Database\Model', 'Model'); +} class ExampleExportModel extends ExportModel { diff --git a/tests/unit/backend/models/ImportModelTest.php b/tests/unit/backend/models/ImportModelTest.php index 0512e82e9a..1f803bd06b 100644 --- a/tests/unit/backend/models/ImportModelTest.php +++ b/tests/unit/backend/models/ImportModelTest.php @@ -2,7 +2,9 @@ use Backend\Models\ImportModel; -if (!class_exists('Model')) class_alias('October\Rain\Database\Model', 'Model'); +if (!class_exists('Model')) { + class_alias('October\Rain\Database\Model', 'Model'); +} class ExampleImportModel extends ImportModel { @@ -36,5 +38,4 @@ public function testDecodeArrayValue() $result = self::callProtectedMethod($model, 'decodeArrayValue', [$data, '-']); $this->assertEquals(['art direction', 'roman empire', 'sci-fi'], $result); } - } diff --git a/tests/unit/backend/traits/WidgetMakerTest.php b/tests/unit/backend/traits/WidgetMakerTest.php index 6573842219..1369a34d15 100644 --- a/tests/unit/backend/traits/WidgetMakerTest.php +++ b/tests/unit/backend/traits/WidgetMakerTest.php @@ -58,5 +58,4 @@ public function testMakeWidget() $this->assertInstanceOf('Backend\Widgets\Search', $widget); $this->assertEquals('config', $widget->getConfig('test')); } - } diff --git a/tests/unit/cms/classes/CmsCompoundObjectTest.php b/tests/unit/cms/classes/CmsCompoundObjectTest.php index 5d47553b35..c66d31ee5f 100644 --- a/tests/unit/cms/classes/CmsCompoundObjectTest.php +++ b/tests/unit/cms/classes/CmsCompoundObjectTest.php @@ -9,7 +9,9 @@ class TestCmsCompoundObject extends CmsCompoundObject { protected $dirName = 'testobjects'; - protected function parseSettings() {} + protected function parseSettings() + { + } } class TestParsedCmsCompoundObject extends CmsCompoundObject @@ -21,7 +23,9 @@ class TestTemporaryCmsCompoundObject extends CmsCompoundObject { protected $dirName = 'temporary'; - protected function parseSettings() {} + protected function parseSettings() + { + } } class CmsCompoundObjectTest extends TestCase @@ -128,8 +132,9 @@ public function testCache() $this->assertNotEmpty($testContent); $filePath = $themePath .= '/temporary/testcompound.htm'; - if (file_exists($filePath)) + if (file_exists($filePath)) { @unlink($filePath); + } $this->assertFileNotExists($filePath); file_put_contents($filePath, $testContent); @@ -195,8 +200,9 @@ public function testSaveMarkup() $theme = Theme::load('apitest'); $destFilePath = $theme->getPath().'/testobjects/compound-markup.htm'; - if (file_exists($destFilePath)) + if (file_exists($destFilePath)) { unlink($destFilePath); + } $this->assertFileNotExists($destFilePath); @@ -219,8 +225,9 @@ public function testSaveMarkupAndSettings() $theme = Theme::load('apitest'); $destFilePath = $theme->getPath().'/testobjects/compound-markup-settings.htm'; - if (file_exists($destFilePath)) + if (file_exists($destFilePath)) { unlink($destFilePath); + } $this->assertFileNotExists($destFilePath); @@ -320,5 +327,4 @@ protected function assertFileEqualsNormalized($expected, $actual) $this->assertEquals($expected, $actual); } - } diff --git a/tests/unit/cms/classes/CmsExceptionTest.php b/tests/unit/cms/classes/CmsExceptionTest.php index fbe493b98d..6e270fb7ac 100644 --- a/tests/unit/cms/classes/CmsExceptionTest.php +++ b/tests/unit/cms/classes/CmsExceptionTest.php @@ -40,5 +40,4 @@ public function testCmsExceptionPhp() $this->assertEquals('PHP Content', $exception->getErrorType()); $this->assertEquals('This is a general error', $exception->getMessage()); } - } diff --git a/tests/unit/cms/classes/CmsObjectTest.php b/tests/unit/cms/classes/CmsObjectTest.php index 81ca292018..95d4f50d99 100644 --- a/tests/unit/cms/classes/CmsObjectTest.php +++ b/tests/unit/cms/classes/CmsObjectTest.php @@ -61,8 +61,9 @@ public function testCache() $themePath = $theme->getPath(); $filePath = $themePath .= '/temporary/test.htm'; - if (file_exists($filePath)) + if (file_exists($filePath)) { @unlink($filePath); + } $this->assertFileNotExists($filePath); @@ -216,8 +217,9 @@ public function testSave() $theme = Theme::load('apitest'); $destFilePath = $theme->getPath().'/testobjects/mytestobj.htm'; - if (file_exists($destFilePath)) + if (file_exists($destFilePath)) { unlink($destFilePath); + } $this->assertFileNotExists($destFilePath); @@ -244,8 +246,9 @@ public function testRename() $this->assertFileExists($srcFilePath); $destFilePath = $theme->getPath().'/testobjects/anotherobj.htm'; - if (file_exists($destFilePath)) + if (file_exists($destFilePath)) { unlink($destFilePath); + } $testContents = 'mytestcontent'; $obj = TestCmsObject::load($theme, 'mytestobj.htm'); @@ -274,8 +277,9 @@ public function testRenameToExistingFile() $this->assertFileExists($srcFilePath); $destFilePath = $theme->getPath().'/testobjects/existingobj.htm'; - if (!file_exists($destFilePath)) + if (!file_exists($destFilePath)) { file_put_contents($destFilePath, 'str'); + } $this->assertFileExists($destFilePath); $obj = TestCmsObject::load($theme, 'anotherobj.htm'); @@ -311,12 +315,14 @@ public function testSaveNewDir() $theme = Theme::load('apitest'); $destFilePath = $theme->getPath().'/testobjects/testsubdir/mytestobj.htm'; - if (file_exists($destFilePath)) + if (file_exists($destFilePath)) { unlink($destFilePath); + } $destDirPath = dirname($destFilePath); - if (file_exists($destDirPath) && is_dir($destDirPath)) + if (file_exists($destDirPath) && is_dir($destDirPath)) { rmdir($destDirPath); + } $this->assertFileNotExists($destFilePath); $this->assertFileNotExists($destDirPath); diff --git a/tests/unit/cms/classes/CodeParserTest.php b/tests/unit/cms/classes/CodeParserTest.php index 95ddc90958..43eb34a84d 100644 --- a/tests/unit/cms/classes/CodeParserTest.php +++ b/tests/unit/cms/classes/CodeParserTest.php @@ -313,5 +313,4 @@ protected function getContents($path) $content = preg_replace('~\R~u', PHP_EOL, $content); // Normalize EOL return $content; } - } diff --git a/tests/unit/cms/classes/ContentTest.php b/tests/unit/cms/classes/ContentTest.php index 2c0de68882..790501c6f8 100644 --- a/tests/unit/cms/classes/ContentTest.php +++ b/tests/unit/cms/classes/ContentTest.php @@ -32,5 +32,4 @@ public function testHtmlContent() $this->assertEquals('Stephen Saucier changed his profile picture — 7 hrs ago', $content->markup); $this->assertEquals('Stephen Saucier changed his profile picture — 7 hrs ago', $content->parsedMarkup); } - } diff --git a/tests/unit/cms/classes/ControllerTest.php b/tests/unit/cms/classes/ControllerTest.php index 5ba8999951..cb1a1e4333 100644 --- a/tests/unit/cms/classes/ControllerTest.php +++ b/tests/unit/cms/classes/ControllerTest.php @@ -485,5 +485,4 @@ public function testComponentWithOnRender() ESC; $this->assertEquals($content, $response); } - } diff --git a/tests/unit/cms/classes/PartialStackTest.php b/tests/unit/cms/classes/PartialStackTest.php index 58bd05d669..f9371a3b6e 100644 --- a/tests/unit/cms/classes/PartialStackTest.php +++ b/tests/unit/cms/classes/PartialStackTest.php @@ -55,5 +55,4 @@ public function testEmptyStack() $stack = new PartialStack; $this->assertNull($stack->getComponent('xxx')); } - } diff --git a/tests/unit/cms/classes/ThemeTest.php b/tests/unit/cms/classes/ThemeTest.php index e7410bbc3c..a45087ede9 100644 --- a/tests/unit/cms/classes/ThemeTest.php +++ b/tests/unit/cms/classes/ThemeTest.php @@ -21,8 +21,9 @@ protected function countThemePages($path) $it->rewind(); while ($it->valid()) { - if (!$it->isDot() && !$it->isDir() && $it->getExtension() == 'htm') + if (!$it->isDot() && !$it->isDir() && $it->getExtension() == 'htm') { $result++; + } $it->next(); } @@ -75,7 +76,9 @@ public function testNoActiveTheme() public function testApiTheme() { Event::flush('cms.theme.getActiveTheme'); - Event::listen('cms.theme.getActiveTheme', function () { return 'apitest'; }); + Event::listen('cms.theme.getActiveTheme', function () { + return 'apitest'; + }); $activeTheme = Theme::getActiveTheme(); $this->assertNotNull($activeTheme); diff --git a/tests/unit/plugins/database/DeferredBindingTest.php b/tests/unit/plugins/database/DeferredBindingTest.php index b97f4fa99a..a8f354a659 100644 --- a/tests/unit/plugins/database/DeferredBindingTest.php +++ b/tests/unit/plugins/database/DeferredBindingTest.php @@ -105,5 +105,4 @@ public function testCommitBinding() $author->commitDeferred($sessionKey); $this->assertEquals(0, DeferredBinding::count()); } - } diff --git a/tests/unit/plugins/database/SoftDeleteModelTest.php b/tests/unit/plugins/database/SoftDeleteModelTest.php index 1e96b8ce45..23a0ef436d 100644 --- a/tests/unit/plugins/database/SoftDeleteModelTest.php +++ b/tests/unit/plugins/database/SoftDeleteModelTest.php @@ -94,5 +94,4 @@ public function testRestoreSoftDeleteRelation() $this->assertNotNull(SoftDeleteAuthor::find($authorId)); } - } diff --git a/tests/unit/system/classes/CombineAssetsTest.php b/tests/unit/system/classes/CombineAssetsTest.php index 60e639c949..c9fed4a043 100644 --- a/tests/unit/system/classes/CombineAssetsTest.php +++ b/tests/unit/system/classes/CombineAssetsTest.php @@ -40,7 +40,8 @@ public function testCombine() { $combiner = CombineAssets::instance(); - $url = $combiner->combine([ + $url = $combiner->combine( + [ 'assets/css/style1.css', 'assets/css/style2.css' ], @@ -49,9 +50,10 @@ public function testCombine() $this->assertNotNull($url); $this->assertRegExp('/\w+[-]\d+/i', $url); // Must contain hash-number - $url = $combiner->combine([ - 'assets/js/script1.js', - 'assets/js/script2.js' + $url = $combiner->combine( + [ + 'assets/js/script1.js', + 'assets/js/script2.js' ], base_path().'/tests/fixtures/themes/test' ); @@ -99,5 +101,4 @@ public function testResetCache() $combiner = CombineAssets::instance(); $this->assertNull($combiner->resetCache()); } - } diff --git a/tests/unit/system/classes/CoreLangTest.php b/tests/unit/system/classes/CoreLangTest.php index f3600edc16..4b9c442b10 100644 --- a/tests/unit/system/classes/CoreLangTest.php +++ b/tests/unit/system/classes/CoreLangTest.php @@ -35,7 +35,9 @@ public function testValidCoreLanguageFiles() foreach ($locales as $locale) { foreach ($files as $file) { $srcPath = base_path() . '/modules/'.$module.'/lang/'.$locale.'/'.$file; - if (!file_exists($srcPath)) continue; + if (!file_exists($srcPath)) { + continue; + } $messages = require $srcPath; $this->assertNotEmpty($messages); $this->assertNotCount(0, $messages); diff --git a/tests/unit/system/classes/MarkupManagerTest.php b/tests/unit/system/classes/MarkupManagerTest.php index 405c933d8b..48a82ba3eb 100644 --- a/tests/unit/system/classes/MarkupManagerTest.php +++ b/tests/unit/system/classes/MarkupManagerTest.php @@ -31,7 +31,9 @@ public function testIsWildCallable() $result = self::callProtectedMethod($manager, 'isWildCallable', [$callable]); $this->assertFalse($result); - $callable = function () { return 'O, Hai!'; }; + $callable = function () { + return 'O, Hai!'; + }; $result = self::callProtectedMethod($manager, 'isWildCallable', [$callable]); $this->assertFalse($result); @@ -78,5 +80,4 @@ public function testIsWildCallable() $this->assertEquals('MyFood', $result[0]); $this->assertEquals('myFood', $result[1]); } - }