From cbd5fcc1dc31dbb4c926149ab332419b11e45365 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sun, 22 Feb 2015 19:07:05 -0500 Subject: [PATCH] Less else --- .../PatchTester/Model/PullsModel.php | 10 ++-- .../PatchTester/View/DefaultHtmlView.php | 46 +++++++++---------- 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php index 68d094a..7b5a1c8 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php @@ -425,13 +425,11 @@ class PullsModel extends \JModelDatabase return (int) $this->getDb()->loadResult(); } - // Otherwise fall back to inefficient way of counting all results. - else - { - $this->getDb()->setQuery($query)->execute(); - return (int) $this->getDb()->getNumRows(); - } + // Otherwise fall back to inefficient way of counting all results. + $this->getDb()->setQuery($query)->execute(); + + return (int) $this->getDb()->getNumRows(); } /** diff --git a/administrator/components/com_patchtester/PatchTester/View/DefaultHtmlView.php b/administrator/components/com_patchtester/PatchTester/View/DefaultHtmlView.php index 13268df..761a7b4 100644 --- a/administrator/components/com_patchtester/PatchTester/View/DefaultHtmlView.php +++ b/administrator/components/com_patchtester/PatchTester/View/DefaultHtmlView.php @@ -31,32 +31,30 @@ class DefaultHtmlView extends \JViewHtml $file = isset($tpl) ? $this->getLayout() . '_' . $tpl : $this->getLayout(); $path = $this->getPath($file); - if ($path) - { - // Unset so as not to introduce into template scope - unset($tpl); - unset($file); - - // Never allow a 'this' property - if (isset($this->this)) - { - unset($this->this); - } - - // Start an output buffer. - ob_start(); - - // Load the template. - include $path; - - // Get the layout contents. - $output = ob_get_clean(); - - return $output; - } - else + if (!$path) { throw new \RuntimeException(\JText::sprintf('JLIB_APPLICATION_ERROR_LAYOUTFILE_NOT_FOUND', $file), 500); } + + // Unset so as not to introduce into template scope + unset($tpl); + unset($file); + + // Never allow a 'this' property + if (isset($this->this)) + { + unset($this->this); + } + + // Start an output buffer. + ob_start(); + + // Load the template. + include $path; + + // Get the layout contents. + $output = ob_get_clean(); + + return $output; } }