diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index 453aedcca..278c99d70 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -1445,9 +1445,8 @@ class RelationController extends ControllerBehavior if ($this->eventTarget == 'button-link') { return 'backend::lang.relation.link_a_new'; } - else { - return 'backend::lang.relation.add_a_new'; - } + + return 'backend::lang.relation.add_a_new'; case 'form': if ($this->readOnly) { return 'backend::lang.relation.preview_name'; @@ -1508,9 +1507,8 @@ class RelationController extends ControllerBehavior if ($this->eventTarget == 'button-add') { return 'list'; } - else { - return 'form'; - } + + return 'form'; } } @@ -1600,9 +1598,8 @@ class RelationController extends ControllerBehavior if ($throwException) { throw new ApplicationException('Missing configuration for '.$mode.'.'.$type.' in RelationController definition '.$this->field); } - else { - return false; - } + + return false; } return $this->makeConfig($config); diff --git a/modules/backend/classes/FormField.php b/modules/backend/classes/FormField.php index 75ae62ac2..dc7109c1d 100644 --- a/modules/backend/classes/FormField.php +++ b/modules/backend/classes/FormField.php @@ -234,9 +234,8 @@ class FormField return []; } - else { - $this->options = $value; - } + + $this->options = $value; return $this; } @@ -567,9 +566,8 @@ class FormField if ($arrayName) { return $arrayName.'['.implode('][', HtmlHelper::nameToArray($this->fieldName)).']'; } - else { - return $this->fieldName; - } + + return $this->fieldName; } /** diff --git a/modules/backend/classes/Skin.php b/modules/backend/classes/Skin.php index 47facbaac..e46865c3f 100644 --- a/modules/backend/classes/Skin.php +++ b/modules/backend/classes/Skin.php @@ -80,11 +80,10 @@ abstract class Skin ? $this->publicSkinPath . $path : $this->skinPath . $path; } - else { - return $isPublic - ? $this->defaultPublicSkinPath . $path - : $this->defaultSkinPath . $path; - } + + return $isPublic + ? $this->defaultPublicSkinPath . $path + : $this->defaultSkinPath . $path; } /** diff --git a/modules/backend/controllers/Auth.php b/modules/backend/controllers/Auth.php index 4268d2b4e..849a2675f 100644 --- a/modules/backend/controllers/Auth.php +++ b/modules/backend/controllers/Auth.php @@ -54,9 +54,8 @@ class Auth extends Controller if (post('postback')) { return $this->signin_onSubmit(); } - else { - $this->bodyClass .= ' preload'; - } + + $this->bodyClass .= ' preload'; } catch (Exception $ex) { Flash::error($ex->getMessage()); diff --git a/modules/backend/models/User.php b/modules/backend/models/User.php index de8ab30fa..1ac926a03 100644 --- a/modules/backend/models/User.php +++ b/modules/backend/models/User.php @@ -96,12 +96,11 @@ class User extends UserBase if ($this->avatar) { return $this->avatar->getThumb($size, $size, $options); } - else { - return '//www.gravatar.com/avatar/' . - md5(strtolower(trim($this->email))) . - '?s='. $size . - '&d='. urlencode($default); - } + + return '//www.gravatar.com/avatar/' . + md5(strtolower(trim($this->email))) . + '?s='. $size . + '&d='. urlencode($default); } /** diff --git a/modules/backend/widgets/Form.php b/modules/backend/widgets/Form.php index 353390040..9762ff568 100644 --- a/modules/backend/widgets/Form.php +++ b/modules/backend/widgets/Form.php @@ -1163,9 +1163,9 @@ class Form extends WidgetBase $key = array_shift($parts); if (isset($array[$key])) { return $array[$key]; - } else { - return $default; } + + return $default; } foreach ($parts as $segment) { diff --git a/modules/backend/widgets/Lists.php b/modules/backend/widgets/Lists.php index b18d0391c..0c83abd16 100644 --- a/modules/backend/widgets/Lists.php +++ b/modules/backend/widgets/Lists.php @@ -1514,9 +1514,8 @@ class Lists extends WidgetBase if ($column === null) { return (count($this->getSortableColumns()) > 0); } - else { - return array_key_exists($column, $this->getSortableColumns()); - } + + return array_key_exists($column, $this->getSortableColumns()); } /** diff --git a/modules/backend/widgets/MediaManager.php b/modules/backend/widgets/MediaManager.php index 3910d2815..4457d1f4c 100644 --- a/modules/backend/widgets/MediaManager.php +++ b/modules/backend/widgets/MediaManager.php @@ -1303,31 +1303,29 @@ class MediaManager extends WidgetBase * If the target dimensions are provided, resize the original image and * return its URL and dimensions. */ - else { - $originalFilePath = $fullSessionDirectoryPath.'/'.$originalThumbFileName; - if (!File::isFile($originalFilePath)) { - throw new SystemException('The original image is not found in the cropping session directory.'); - } - - $resizedThumbFileName = 'resized-'.$params['width'].'-'.$params['height'].'.'.$extension; - $tempFilePath = $fullSessionDirectoryPath.'/'.$resizedThumbFileName; - - Resizer::open($originalFilePath) - ->resize($params['width'], $params['height'], [ - 'mode' => 'exact' - ]) - ->save($tempFilePath) - ; - - $url = $this->getThumbnailImageUrl($sessionDirectoryPath.'/'.$resizedThumbFileName); - $dimensions = getimagesize($tempFilePath); - - return [ - 'url' => $url, - 'dimensions' => $dimensions - ]; + $originalFilePath = $fullSessionDirectoryPath.'/'.$originalThumbFileName; + if (!File::isFile($originalFilePath)) { + throw new SystemException('The original image is not found in the cropping session directory.'); } + + $resizedThumbFileName = 'resized-'.$params['width'].'-'.$params['height'].'.'.$extension; + $tempFilePath = $fullSessionDirectoryPath.'/'.$resizedThumbFileName; + + Resizer::open($originalFilePath) + ->resize($params['width'], $params['height'], [ + 'mode' => 'exact' + ]) + ->save($tempFilePath) + ; + + $url = $this->getThumbnailImageUrl($sessionDirectoryPath.'/'.$resizedThumbFileName); + $dimensions = getimagesize($tempFilePath); + + return [ + 'url' => $url, + 'dimensions' => $dimensions + ]; } catch (Exception $ex) { if ($sessionDirectoryCreated) { diff --git a/modules/backend/widgets/Search.php b/modules/backend/widgets/Search.php index 8976313c2..2f5749abf 100644 --- a/modules/backend/widgets/Search.php +++ b/modules/backend/widgets/Search.php @@ -98,9 +98,9 @@ class Search extends WidgetBase if ($this->partial) { return $this->controller->makePartial($this->partial); - } else { - return $this->makePartial('search'); } + + return $this->makePartial('search'); } /** diff --git a/modules/cms/classes/Controller.php b/modules/cms/classes/Controller.php index ab73e1111..0b14c9561 100644 --- a/modules/cms/classes/Controller.php +++ b/modules/cms/classes/Controller.php @@ -820,9 +820,8 @@ class Controller if ($throwException) { throw new CmsException(Lang::get('cms::lang.partial.not_found_name', ['name'=>$partialName])); } - else { - return false; - } + + return false; } } /* @@ -857,9 +856,8 @@ class Controller if ($throwException) { throw new CmsException(Lang::get('cms::lang.partial.not_found_name', ['name'=>$name])); } - else { - return false; - } + + return false; } /* diff --git a/modules/system/classes/CombineAssets.php b/modules/system/classes/CombineAssets.php index 32d4e084c..34dceea32 100644 --- a/modules/system/classes/CombineAssets.php +++ b/modules/system/classes/CombineAssets.php @@ -487,9 +487,8 @@ class CombineAssets if ($actionExists) { return Url::action($combineAction, [$outputFilename], false); } - else { - return '/combine/'.$outputFilename; - } + + return '/combine/'.$outputFilename; } /** diff --git a/modules/system/classes/PluginBase.php b/modules/system/classes/PluginBase.php index 7a0507544..54fbf20a6 100644 --- a/modules/system/classes/PluginBase.php +++ b/modules/system/classes/PluginBase.php @@ -255,9 +255,8 @@ class PluginBase extends ServiceProviderBase if ($exceptionMessage) { throw new SystemException($exceptionMessage); } - else { - $this->loadedYamlConfiguration = []; - } + + $this->loadedYamlConfiguration = []; } else { $this->loadedYamlConfiguration = Yaml::parse(file_get_contents($yamlFilePath)); diff --git a/modules/system/console/OctoberUpdate.php b/modules/system/console/OctoberUpdate.php index ccfe1001b..f2404f862 100644 --- a/modules/system/console/OctoberUpdate.php +++ b/modules/system/console/OctoberUpdate.php @@ -63,9 +63,8 @@ class OctoberUpdate extends Command $this->output->writeln('No new updates found'); return; } - else { - $this->output->writeln(sprintf('Found %s new %s!', $updates, Str::plural('update', $updates))); - } + + $this->output->writeln(sprintf('Found %s new %s!', $updates, Str::plural('update', $updates))); $coreHash = $disableCore ? null : array_get($updateList, 'core.hash'); $coreBuild = array_get($updateList, 'core.build'); diff --git a/modules/system/models/File.php b/modules/system/models/File.php index b61f7d985..012342617 100644 --- a/modules/system/models/File.php +++ b/modules/system/models/File.php @@ -54,9 +54,8 @@ class File extends FileBase if ($this->isPublic()) { return $uploadsFolder . '/public/'; } - else { - return $uploadsFolder . '/protected/'; - } + + return $uploadsFolder . '/protected/'; } /** diff --git a/modules/system/traits/EventEmitter.php b/modules/system/traits/EventEmitter.php index 054668b4c..919b93cdc 100644 --- a/modules/system/traits/EventEmitter.php +++ b/modules/system/traits/EventEmitter.php @@ -48,9 +48,8 @@ trait EventEmitter if ($halt) { return $response; } - else { - $result = array_merge($result, $response); - } + + $result = array_merge($result, $response); } /* @@ -60,9 +59,8 @@ trait EventEmitter if ($halt) { return $response; } - else { - $result = array_merge($result, $response); - } + + $result = array_merge($result, $response); } return $result; diff --git a/modules/system/traits/ViewMaker.php b/modules/system/traits/ViewMaker.php index be2ef1fcc..36255383e 100644 --- a/modules/system/traits/ViewMaker.php +++ b/modules/system/traits/ViewMaker.php @@ -91,9 +91,8 @@ trait ViewMaker if ($throwException) { throw new SystemException(Lang::get('backend::lang.partial.not_found_name', ['name' => $partialPath])); } - else { - return false; - } + + return false; } return $this->makeFileContents($partialPath, $params); @@ -151,9 +150,8 @@ trait ViewMaker if ($throwException) { throw new SystemException(Lang::get('cms::lang.layout.not_found_name', ['name' => $layoutPath])); } - else { - return false; - } + + return false; } return $this->makeFileContents($layoutPath, $params);