Skip to content

Commit

Permalink
fix php-cs comments ident and position
Browse files Browse the repository at this point in the history
  • Loading branch information
Razzo1987 committed Jan 11, 2024
1 parent 8d19ede commit 620d3e0
Show file tree
Hide file tree
Showing 25 changed files with 68 additions and 67 deletions.
Expand Up @@ -249,8 +249,8 @@ protected function getListQuery()
$categoryId = $categoryId ? [$categoryId] : [];
}

// Case: Using both categories filter and by level filter
if (\count($categoryId)) {
// Case: Using both categories filter and by level filter
$categoryTable = Table::getInstance('Category', 'JTable');
$subCatItemsWhere = [];

Expand All @@ -264,8 +264,8 @@ protected function getListQuery()

$query->where('(' . implode(' OR ', $subCatItemsWhere) . ')');

// Case: Using only the by level filter
} elseif ($level) {
// Case: Using only the by level filter
$query->where($db->quoteName('a.level') . ' <= :level')
->bind(':level', $level, ParameterType::INTEGER);
}
Expand Down
6 changes: 3 additions & 3 deletions administrator/components/com_finder/src/Indexer/Adapter.php
Expand Up @@ -922,20 +922,20 @@ protected function translateState($item, $category = null)

// Translate the state
switch ($item) {
// Published items should always show up in search results
case 1:
// Published items should always show up in search results
return 1;

// Archived items should only show up when option is enabled
case 2:
// Archived items should only show up when option is enabled
if ($this->params->get('search_archived', 1) == 0) {
return 0;
}

return 1;

// All other states should return an unpublished state
default:
// All other states should return an unpublished state
return 0;
}
}
Expand Down
Expand Up @@ -920,13 +920,13 @@ protected function translateState($item, $category = null)

// Translate the state
switch ($item) {
// Published and archived items only should return a published state
case 1:
case 2:
// Published and archived items only should return a published state
return 1;

// All other states should return an unpublished state
default:
// All other states should return an unpublished state
return 0;
}
}
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_finder/src/Indexer/Query.php
Expand Up @@ -794,9 +794,9 @@ protected function processString($input, $lang, $mode)

// Now we have to handle the filter string.
switch ($modifier) {
// Handle a before and after date filters.
case 'before':
case 'after':
// Handle a before and after date filters.
// Get the time offset.
$offset = Factory::getApplication()->get('offset');

Expand All @@ -820,8 +820,8 @@ protected function processString($input, $lang, $mode)

break;

// Handle a taxonomy branch filter.
default:
// Handle a taxonomy branch filter.
// Try to find the node id.
$return = Taxonomy::getNodeByTitle($modifier, $value);

Expand Down
Expand Up @@ -552,8 +552,8 @@ protected function loadFormData()
protected function preparePreUpdate($update, $table)
{
switch ($table->type) {
// Components could have a helper which adds additional data
case 'component':
// Components could have a helper which adds additional data
$ename = str_replace('com_', '', $table->element);
$fname = $ename . '.php';
$cname = ucfirst($ename) . 'Helper';
Expand All @@ -570,8 +570,8 @@ protected function preparePreUpdate($update, $table)

break;

// Modules could have a helper which adds additional data
case 'module':
// Modules could have a helper which adds additional data
$cname = str_replace('_', '', $table->element) . 'Helper';
$path = ($table->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE) . '/modules/' . $table->element . '/helper.php';

Expand All @@ -585,9 +585,9 @@ protected function preparePreUpdate($update, $table)

break;

case 'plugin':
// If we have a plugin, we can use the plugin trigger "onInstallerBeforePackageDownload"
// But we should make sure, that our plugin is loaded, so we don't need a second "installer" plugin
case 'plugin':
$cname = str_replace('plg_', '', $table->element);
PluginHelper::importPlugin($table->folder, $cname);
break;
Expand Down
Expand Up @@ -88,19 +88,19 @@ public function applyUpdateSite()
$params = ComponentHelper::getParams('com_joomlaupdate');

switch ($params->get('updatesource', 'nochange')) {
// "Minor & Patch Release for Current version AND Next Major Release".
case 'next':
// "Minor & Patch Release for Current version AND Next Major Release".
$updateURL = 'https://update.joomla.org/core/sts/list_sts.xml';
break;

// "Testing"
case 'testing':
// "Testing"
$updateURL = 'https://update.joomla.org/core/test/list_test.xml';
break;

case 'custom':
// "Custom"
// @todo: check if the customurl is valid and not just "not empty".
case 'custom':
if (trim($params->get('customurl', '')) != '') {
$updateURL = trim($params->get('customurl', ''));
} else {
Expand All @@ -110,6 +110,7 @@ public function applyUpdateSite()
}
break;

default:
/**
* "Minor & Patch Release for Current version (recommended and default)".
* The commented "case" below are for documenting where 'default' and legacy options falls
Expand All @@ -118,7 +119,6 @@ public function applyUpdateSite()
* case 'sts': (It's shown as "Default" because that option does not exist any more)
* case 'nochange':
*/
default:
$updateURL = 'https://update.joomla.org/core/list.xml';
}

Expand Down
Expand Up @@ -233,24 +233,25 @@ public function display($tpl = null)
$params = ComponentHelper::getParams('com_joomlaupdate');

switch ($params->get('updatesource', 'default')) {
// "Minor & Patch Release for Current version AND Next Major Release".
case 'next':
// "Minor & Patch Release for Current version AND Next Major Release".
$this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_NEXT';
$this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT');
break;

// "Testing"
case 'testing':
// "Testing"
$this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_TESTING';
$this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_TESTING');
break;

// "Custom"
case 'custom':
// "Custom"
$this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_CUSTOM';
$this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_CUSTOM');
break;

default:
/**
* "Minor & Patch Release for Current version (recommended and default)".
* The commented "case" below are for documenting where 'default' and legacy options falls
Expand All @@ -259,7 +260,6 @@ public function display($tpl = null)
* case 'lts':
* case 'nochange':
*/
default:
$this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_DEFAULT';
$this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT');
}
Expand Down
Expand Up @@ -94,31 +94,31 @@ public function oauthcallback()
* - control-panel : Redirect to Control Panel
*/
switch ($action) {
/**
* Close a window opened by developer
* Use this for close New Windows opened for OAuth Process
*/
case 'close':
/**
* Close a window opened by developer
* Use this for close New Windows opened for OAuth Process
*/
$this->setRedirect(Route::_('index.php?option=com_media&view=plugin&action=close', false));
break;

// Redirect browser to any page specified by the user
case 'redirect':
// Redirect browser to any page specified by the user
if (!isset($eventResults['redirect_uri'])) {
throw new \Exception("Redirect URI must be set in the plugin");
}

$this->setRedirect($eventResults['redirect_uri']);
break;

// Redirect browser to Control Panel
case 'control-panel':
// Redirect browser to Control Panel
$this->setRedirect(Route::_('index.php', false));
break;

// Redirect browser to Media Manager
case 'media-manager':
default:
// Redirect browser to Media Manager
$this->setRedirect(Route::_('index.php?option=com_media&view=media', false));
}
} catch (\Exception $e) {
Expand Down
Expand Up @@ -393,10 +393,10 @@ private function canTransition($item, $newStatus)
// A confirmed item can be marked completed or invalid
return \in_array($newStatus, ['-1', '2'], true);

// An item which is already in an invalid or complete state cannot transition, likewise if we don't know the state don't change anything
case '-1':
case '2':
default:
// An item which is already in an invalid or complete state cannot transition, likewise if we don't know the state don't change anything
return false;
}
}
Expand Down
Expand Up @@ -173,8 +173,8 @@ protected function addToolbar()

break;

// Item is in a "locked" state and cannot transition
default:
// Item is in a "locked" state and cannot transition
break;
}

Expand Down
Expand Up @@ -49,15 +49,15 @@ protected function canView($view)
$canDo = ContentHelper::getActions('com_users');

switch ($view) {
// Special permissions.
case 'groups':
case 'group':
case 'levels':
case 'level':
// Special permissions.
return $canDo->get('core.admin');

// Default permissions.
default:
// Default permissions.
return true;
}
}
Expand Down
6 changes: 3 additions & 3 deletions administrator/components/com_users/src/Model/UserModel.php
Expand Up @@ -703,20 +703,20 @@ public function batchUser($groupId, $userIds, $action)
$db = $this->getDatabase();

switch ($action) {
// Sets users to a selected group
case 'set':
// Sets users to a selected group
$doDelete = 'all';
$doAssign = true;
break;

// Remove users from a selected group
case 'del':
// Remove users from a selected group
$doDelete = 'group';
break;

// Add users to a selected group
case 'add':
default:
// Add users to a selected group
$doAssign = true;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions build/build.php
Expand Up @@ -512,14 +512,14 @@ function clean_composer(string $dir)

break;

// Deleted files
case 'D':
// Deleted files
$deletedFiles[] = $fileName;

break;

// Regular additions and modifications
default:
// Regular additions and modifications
$filesArray[$fileName] = true;

break;
Expand Down
4 changes: 2 additions & 2 deletions components/com_ajax/ajax.php
Expand Up @@ -204,14 +204,14 @@

// Return the results in the desired format
switch ($format) {
// JSONinzed
case 'json':
// JSONinzed
echo new JsonResponse($results, null, false, $input->get('ignoreMessages', true, 'bool'));

break;

// Handle as raw format
default:
// Handle as raw format
// Output exception
if ($results instanceof Exception) {
// Log an error
Expand Down
4 changes: 2 additions & 2 deletions components/com_users/src/Controller/DisplayController.php
Expand Up @@ -73,8 +73,8 @@ public function display($cachable = false, $urlparams = false)
$model = $this->getModel('Registration');
break;

// Handle view specific models.
case 'profile':
// Handle view specific models.
// If the user is a guest, redirect to the login page.
$user = $this->app->getIdentity();

Expand All @@ -88,8 +88,8 @@ public function display($cachable = false, $urlparams = false)
$model = $this->getModel($vName);
break;

// Handle the default views.
case 'login':
// Handle the default views.
$model = $this->getModel($vName);
break;

Expand Down
6 changes: 3 additions & 3 deletions libraries/src/Filesystem/Stream.php
Expand Up @@ -259,19 +259,19 @@ public function open(

// Decide which context to use:
switch ($this->processingmethod) {
// Gzip doesn't support contexts or streams
case 'gz':
// Gzip doesn't support contexts or streams
$this->fh = gzopen($filename, $mode, $useIncludePath);
break;

// Bzip2 is much like gzip except it doesn't use the include path
case 'bz':
// Bzip2 is much like gzip except it doesn't use the include path
$this->fh = bzopen($filename, $mode);
break;

// Fopen can handle streams
case 'f':
default:
// Fopen can handle streams
// One supplied at open; overrides everything
if ($context) {
$this->fh = fopen($filename, $mode, $useIncludePath, $context);
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Form/Field/CalendarField.php
Expand Up @@ -415,8 +415,8 @@ public function filter($value, $group = null, Registry $input = null)
$return = Factory::getDate($value, $app->get('offset'))->toSql();
break;

// Convert a date to UTC based on the user timezone offset.
case 'USER_UTC':
// Convert a date to UTC based on the user timezone offset.
// Get the user timezone setting defaulting to the server timezone setting.
$offset = $app->getIdentity()->getParam('timezone', $app->get('offset'));

Expand Down

0 comments on commit 620d3e0

Please sign in to comment.