Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplified true/false #1398

Merged
merged 7 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/code/core/Mage/Admin/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public function deleteFromRole()
public function roleUserExists()
{
$result = $this->_getResource()->roleUserExists($this);
return (is_array($result) && count($result) > 0) ? true : false;
return is_array($result) && count($result) > 0;
}

/**
Expand All @@ -294,7 +294,7 @@ public function add()
public function userExists()
{
$result = $this->_getResource()->userExists($this);
return (is_array($result) && count($result) > 0) ? true : false;
return is_array($result) && count($result) > 0;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ protected function _getNodeJson($node, $level = 0)
$allowMove = $this->_isCategoryMoveable($node);
$item['allowDrop'] = $allowMove;
// disallow drag if it's first level and category is root of a store
$item['allowDrag'] = $allowMove && (($node->getLevel()==1 && $rootForStores) ? false : true);
$item['allowDrag'] = $allowMove && !($node->getLevel() == 1 && $rootForStores);

if ((int)$node->getChildrenCount()>0) {
$item['children'] = array();
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function _beforeToHtml()
'content' => $this->getLayout()->createBlock('adminhtml/poll_edit_tab_answers')
->append($this->getLayout()->createBlock('adminhtml/poll_edit_tab_answers_list'))
->toHtml(),
'active' => ( $this->getRequest()->getParam('tab') == 'answers_section' ) ? true : false,
'active' => $this->getRequest()->getParam('tab') == 'answers_section',
));
return parent::_beforeToHtml();
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Model/Report/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function setChildren($children)

public function hasChildren()
{
return (count($this->_children) > 0) ? true : false;
return count($this->_children) > 0;
}

public function addChild($child)
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api/Model/Resource/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,6 @@ private function _updateRoleUsersAcl(Mage_Api_Model_Roles $role)
array('user_id IN(?)' => $users)
);
}
return ($rowsCount > 0) ? true : false;
return $rowsCount > 0;
}
}
4 changes: 2 additions & 2 deletions app/code/core/Mage/Api/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function deleteFromRole()
public function roleUserExists()
{
$result = $this->_getResource()->roleUserExists($this);
return ( is_array($result) && count($result) > 0 ) ? true : false;
return is_array($result) && count($result) > 0;
}

/**
Expand All @@ -198,7 +198,7 @@ public function add()
public function userExists()
{
$result = $this->_getResource()->userExists($this);
return ( is_array($result) && count($result) > 0 ) ? true : false;
return is_array($result) && count($result) > 0;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Bundle/Model/Resource/Price/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ public function getProductsSalableStatus($products, Mage_Core_Model_Website $web
$query = $read->query($select, $bind);
while ($row = $query->fetch()) {
$salable = isset($row['salable']) ? $row['salable'] : true;
$website = $row['website_id'] > 0 ? true : false;
$website = $row['website_id'] > 0;
$status = $row['status'];

$productsData[$row['entity_id']] = $salable && $status && $website;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Centinel/Model/Api/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function sendHttp($url, $connectTimeout = "", $timeout)

// Execute the request.
$result = curl_exec($ch);
$succeeded = curl_errno($ch) == 0 ? true : false;
$succeeded = curl_errno($ch) == 0;

// close cURL resource, and free up system resources
curl_close($ch);
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ protected function _loadDeclaredModules($mergeConfig = null)
$moduleDepends[$moduleName] = array(
'module' => $moduleName,
'depends' => $depends,
'active' => ('true' === (string)$moduleNode->active ? true : false),
'active' => (string)$moduleNode->active === 'true',
);
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ public function useSessionIdForUrl($secure = false)
*/
public function sessionVarCallback($match)
{
if ($this->useSessionIdForUrl($match[2] == 'S' ? true : false)) {
if ($this->useSessionIdForUrl($match[2] == 'S')) {
$session = Mage::getSingleton('core/session');
/* @var Mage_Core_Model_Session $session */
return $match[1]
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Customer/Model/Address/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public function getFormats()
$path = sprintf('%s%s', self::XML_PATH_ADDRESS_TEMPLATE, $typeCode);
$type = new Varien_Object();
$htmlEscape = strtolower($typeConfig->htmlEscape);
$htmlEscape = $htmlEscape == 'false' || $htmlEscape == '0' || $htmlEscape == 'no'
|| !strlen($typeConfig->htmlEscape) ? false : true;
$htmlEscape = !($htmlEscape == 'false' || $htmlEscape == '0' || $htmlEscape == 'no'
|| !strlen($typeConfig->htmlEscape));
$type->setCode($typeCode)
->setTitle((string)$typeConfig->title)
->setDefaultFormat(Mage::getStoreConfig($path, $store))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ public function editPostAction()
}

// If email change was requested then set flag
$isChangeEmail = ($customer->getOldEmail() != $customer->getEmail()) ? true : false;
$isChangeEmail = $customer->getOldEmail() != $customer->getEmail();
$customer->setIsChangeEmail($isChangeEmail);

// If password change was requested then add it to common validation scheme
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function parse()

$batchIoAdapter->open(false);

$isFieldNames = $this->getVar('fieldnames', '') == 'true' ? true : false;
$isFieldNames = $this->getVar('fieldnames', '') == 'true';
if (!$isFieldNames && is_array($this->getVar('map'))) {
$fieldNames = $this->getVar('map');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function parse()

$batchIoAdapter->open(false);

$isFieldNames = $this->getVar('fieldnames', '') == 'true' ? true : false;
$isFieldNames = $this->getVar('fieldnames', '') == 'true';
if (!$isFieldNames && is_array($this->getVar('map'))) {
$this->_parseFieldNames = $this->getVar('map');
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Newsletter/Model/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public function subscribe($email)
$this->setSubscriberConfirmCode($this->randomSequence());
}

$isConfirmNeed = (Mage::getStoreConfig(self::XML_PATH_CONFIRMATION_FLAG) == 1) ? true : false;
$isConfirmNeed = Mage::getStoreConfig(self::XML_PATH_CONFIRMATION_FLAG) == 1;
$isOwnSubscribes = false;
$ownerId = Mage::getModel('customer/customer')
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Paypal/Model/Payflowlink.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ protected function _getOrderFromResponse()
Mage::throwException($response->getRespmsg());
}

$amountCompared = ($response->getAmt() == $order->getPayment()->getBaseAmountAuthorized()) ? true : false;
$amountCompared = $response->getAmt() == $order->getPayment()->getBaseAmountAuthorized();
if (!$order->getId()
|| $order->getState() != Mage_Sales_Model_Order::STATE_PENDING_PAYMENT
|| !$amountCompared
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Sales/Model/Billing/Agreement.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function verifyToken()
public function canPerformAction($customerIdSession)
{
// Get the customer id from billing agreement and compare to logged in customer id
return ((int)$this->getCustomerId() === (int)$customerIdSession) ? true : false;
return (int)$this->getCustomerId() === (int)$customerIdSession;
}

/**
Expand Down