Skip to content

Commit

Permalink
Removed unreachable code (#2775)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel committed Dec 4, 2022
1 parent 96682f7 commit c7547af
Show file tree
Hide file tree
Showing 25 changed files with 16 additions and 224 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ public function getSubtotalWithDiscount()
if ($this->displayTotalsIncludeTax()) {
return $address->getSubtotal() + $address->getTaxAmount()
+ $address->getHiddenTaxAmount() + $this->getDiscountAmount();
return $subtotalInclTax;
}

return $address->getSubtotal() + $this->getDiscountAmount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,15 @@ public function getCarriers()
return $carriers;
}

/**
* @param $code
* @return false|string
*/
public function getCarrierTitle($code)
{
if ($carrier = Mage::getSingleton('shipping/config')->getCarrierInstance($code)) {
return $carrier->getConfigData('title');
} else {
return Mage::helper('sales')->__('Custom Value');
}
return false;
return Mage::helper('sales')->__('Custom Value');
}
}
3 changes: 0 additions & 3 deletions app/code/core/Mage/Adminhtml/Model/Config/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,10 @@ protected function _isValidField($field)
switch ($this->getScope()) {
case self::SCOPE_DEFAULT:
return (bool)(int)$field->show_in_default;
break;
case self::SCOPE_WEBSITES:
return (bool)(int)$field->show_in_website;
break;
case self::SCOPE_STORES:
return (bool)(int)$field->show_in_store;
break;
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ protected function _beforeSave()
$result = $uploader->save($uploadDir);
} catch (Exception $e) {
Mage::throwException($e->getMessage());
return $this;
}

$filename = $result['file'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ protected function _deleteUserFromRole($userId, $roleId)
->deleteFromRole();
} catch (Exception $e) {
throw $e;
return false;
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public function editrolegridAction()
*
* @param int $userId
* @param int $roleId
* @return bool
* @return true
*/
protected function _deleteUserFromRole($userId, $roleId)
{
Expand All @@ -283,7 +283,6 @@ protected function _deleteUserFromRole($userId, $roleId)
->deleteFromRole();
} catch (Exception $e) {
throw $e;
return false;
}
return true;
}
Expand Down
1 change: 0 additions & 1 deletion app/code/core/Mage/Api2/Model/Acl/Global/Rule/Tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ public function __construct($options)

default:
throw new Exception(sprintf('Unknown tree type "%s".', $this->_type));
break;
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Api2/Model/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ public function dispatch()
case self::ACTION_TYPE_ENTITY . self::OPERATION_CREATE:
// Creation of objects is possible only when working with collection
$this->_critical(self::RESOURCE_METHOD_NOT_IMPLEMENTED);
break;
// exception thrown
// no break
case self::ACTION_TYPE_COLLECTION . self::OPERATION_CREATE:
// If no of the methods(multi or single) is implemented, request body is not checked
if (!$this->_checkMethodExist('_create') && !$this->_checkMethodExist('_multiCreate')) {
Expand Down Expand Up @@ -282,7 +283,6 @@ public function dispatch()
break;
default:
$this->_critical(self::RESOURCE_METHOD_NOT_IMPLEMENTED);
break;
}
}

Expand Down
2 changes: 0 additions & 2 deletions app/code/core/Mage/Catalog/Helper/Product/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,8 @@ public function getOptions(Mage_Catalog_Model_Product_Configuration_Item_Interfa
switch ($typeId) {
case Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE:
return $this->getConfigurableOptions($item);
break;
case Mage_Catalog_Model_Product_Type_Grouped::TYPE_CODE:
return $this->getGroupedOptions($item);
break;
}
return $this->getCustomOptions($item);
}
Expand Down
6 changes: 2 additions & 4 deletions app/code/core/Mage/Catalog/Model/Product/Api/V2.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function update($productId, $productData, $store = null, $identifierType
* @param array $productData
* @param string|int $store
* @param string $identifierType
* @return bool
* @return true|void
*/
public function multiUpdate($productIds, $productData, $store = null, $identifierType = null)
{
Expand All @@ -225,11 +225,9 @@ public function multiUpdate($productIds, $productData, $store = null, $identifie

if (empty($failMessages)) {
return true;
} else {
$this->_fault('partially_updated', implode("\n", $failMessages));
}

return false;
$this->_fault('partially_updated', implode("\n", $failMessages));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ protected function _validateUploadedFile()
switch ($this->getProcessMode()) {
case Mage_Catalog_Model_Product_Type_Abstract::PROCESS_MODE_FULL:
Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option <em>%s</em>.', $option->getTitle()));
break;
// exception thrown
// no break
default:
$this->setUserValue(null);
break;
Expand Down
1 change: 0 additions & 1 deletion app/code/core/Mage/CatalogIndex/Model/Aggregation.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ public function clearProductData($productIds)
protected function _processKey($key)
{
return $key;
return md5($key);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions app/code/core/Mage/CatalogInventory/Model/Stock/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public function getCanBackInStock()
* Check quantity
*
* @param float $qty
* @exception Mage_Core_Exception
* @throws Mage_Core_Exception
* @return bool
*/
public function checkQty($qty)
Expand All @@ -477,7 +477,6 @@ public function checkQty($qty)
break;
default:
return false;
break;
}
}
return true;
Expand Down
4 changes: 0 additions & 4 deletions app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,6 @@ public function getCurrencyCount()
public function getCurrency($attribute)
{
return Mage::app()->getStore()->getCurrentCurrencyCode();

$baseCurrency = Mage::app()->getStore()->getBaseCurrency()->getCurrencyCode();
return $this->getAttributeValue($attribute, 'currency') ?
$this->getAttributeValue($attribute, 'currency') : $baseCurrency;
}

/**
Expand Down
2 changes: 0 additions & 2 deletions app/code/core/Mage/Core/Model/File/Storage/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ public function saveFile($file, $overwrite = true)
} else {
Mage::throwException(Mage::helper('core')->__('Wrong file info format'));
}

return false;
}

/**
Expand Down
1 change: 0 additions & 1 deletion app/code/core/Mage/Core/Model/Resource/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ public function applyUpdates()
break;
default:
return true;
break;
}
} elseif ($configVer) {
$this->_installResourceDb($configVer);
Expand Down
10 changes: 0 additions & 10 deletions app/code/core/Mage/Core/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,11 @@ function mageDebugBacktrace($return = false, $html = true, $showFirst = false)
function mageSendErrorHeader()
{
return;
if (!isset($_SERVER['SCRIPT_NAME'])) {
return;
}
$action = Mage::app()->getRequest()->getBasePath() . "bugreport.php";
echo '<form id="error_report" method="post" style="display:none" action="' . $action . '"><textarea name="error">';
}

function mageSendErrorFooter()
{
return;
if (!isset($_SERVER['SCRIPT_NAME'])) {
return;
}
echo '</textarea></form><script type="text/javascript">document.getElementById("error_report").submit()</script>';
exit;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ public function getOptionText($value)
$values[] = $this->_options[$val];
}
return $values;
} else {
return $this->_options[$value];
}
return false;
return $this->_options[$value];
}
}
1 change: 0 additions & 1 deletion app/code/core/Mage/Dataflow/Model/Convert/Adapter/Io.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public function getResource($forWrite = false)
if (!$validator->isValid($path)) {
foreach ($validator->getMessages() as $message) {
Mage::throwException($message);
return false;
}
}

Expand Down
69 changes: 0 additions & 69 deletions app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,75 +154,6 @@ public function parse()
->save();

return $this;

$dom = new DOMDocument();
if (Mage::app()->getRequest()->getParam('files')) {
$path = Mage::app()->getConfig()->getTempVarDir() . '/import/';
$file = $path . urldecode(Mage::app()->getRequest()->getParam('files'));
if (file_exists($file)) {
$dom->load($file);
}
} else {
$this->validateDataString();
$dom->loadXML($this->getData());
}

$worksheets = $dom->getElementsByTagName('Worksheet');
if ($this->getVar('adapter') && $this->getVar('method')) {
$adapter = Mage::getModel($this->getVar('adapter'));
}
foreach ($worksheets as $worksheet) {
$wsName = $worksheet->getAttribute('ss:Name');
$rows = $worksheet->getElementsByTagName('Row');
$firstRow = true;
$fieldNames = [];
$wsData = [];
$i = 0;
foreach ($rows as $rowSet) {
$index = 1;
$cells = $rowSet->getElementsByTagName('Cell');
$rowData = [];
foreach ($cells as $cell) {
$value = $cell->getElementsByTagName('Data')->item(0)->nodeValue;
$ind = $cell->getAttribute('ss:Index');
if (!is_null($ind) && $ind > 0) {
$index = $ind;
}
if ($firstRow && !$this->getVar('fieldnames')) {
$fieldNames[$index] = 'column' . $index;
}
if ($firstRow && $this->getVar('fieldnames')) {
$fieldNames[$index] = $value;
} else {
$rowData[$fieldNames[$index]] = $value;
}
$index++;
}
$row = $rowData;
if ($row) {
$loadMethod = $this->getVar('method');
$adapter->$loadMethod(compact('i', 'row'));
}
$i++;

$firstRow = false;
if (!empty($rowData)) {
$wsData[] = $rowData;
}
}
$data[$wsName] = $wsData;
$this->addException('Found worksheet "' . $wsName . '" with ' . count($wsData) . ' row(s)');
}
if ($wsName = $this->getVar('single_sheet')) {
if (isset($data[$wsName])) {
$data = $data[$wsName];
} else {
reset($data);
$data = current($data);
}
}
$this->setData($data);
return $this;
}

/**
Expand Down
1 change: 0 additions & 1 deletion app/code/core/Mage/Paygate/Model/Authorizenet.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@ protected function _place($payment, $amount, $requestType)
default:
Mage::throwException($defaultExceptionMessage);
}
return $this;
}

/**
Expand Down
1 change: 0 additions & 1 deletion app/code/core/Mage/Sales/Model/Recurring/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ public function getFieldComment($field)
default:
return parent::getFieldComment($field);
}
return null;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Shipping/Model/Carrier/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ abstract class Mage_Shipping_Model_Carrier_Abstract extends Varien_Object
* Retrieve information from carrier configuration
*
* @param string $field
* @return mixed
* @return string|false
*/
public function getConfigData($field)
{
Expand Down Expand Up @@ -514,7 +514,7 @@ public function getTotalNumOfBoxes($weight)
*/
$this->_numBoxes = 1;
$weight = $this->convertWeightToLbs($weight);
$maxPackageWeight = $this->getConfigData('max_package_weight');
$maxPackageWeight = (float)$this->getConfigData('max_package_weight');
if ($weight > $maxPackageWeight && $maxPackageWeight != 0) {
$this->_numBoxes = ceil($weight / $maxPackageWeight);
$weight = $weight / $this->_numBoxes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ protected function _addFilter($storeId, $attributeCode, $value, $type = '=')
break;
default:
return false;
break;
}

if ($attribute['backend_type'] == 'static') {
Expand Down
Loading

0 comments on commit c7547af

Please sign in to comment.