Skip to content

Commit

Permalink
Use || operators instead of „or” (#1023)
Browse files Browse the repository at this point in the history
* Use || operators instead of „or”

ref #958

* Use || operators instead of „or”

ref #958

Co-authored-by: sv3n <github-sr@hotmail.com>
  • Loading branch information
Kevin and sreichel authored Jun 9, 2020
1 parent 1c40a53 commit c1105b5
Show file tree
Hide file tree
Showing 40 changed files with 103 additions and 103 deletions.
2 changes: 1 addition & 1 deletion app/code/community/Cm/RedisSession/Model/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function __construct()
// Connect and authenticate
$this->_redis = new Credis_Client($host, $port, $timeout, $persistent);
if (!empty($pass)) {
$this->_redis->auth($pass) or Zend_Cache::throwException('Unable to authenticate with the redis server.');
$this->_redis->auth($pass) || Zend_Cache::throwException('Unable to authenticate with the redis server.');
}
$this->_redis->setCloseOnDestruct(FALSE); // Destructor order cannot be predicted
$this->_useRedis = TRUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ protected function _prepareLayout()
$defaultGroupId = 0;
foreach ($groupCollection as $group) {
/* @var $group Mage_Eav_Model_Entity_Attribute_Group */
if ($defaultGroupId == 0 or $group->getIsDefault()) {
if ($defaultGroupId == 0 || $group->getIsDefault()) {
$defaultGroupId = $group->getId();
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public function checkSectionPermissions($code=null)
{
static $permissions;

if (!$code or trim($code) == "") {
if (!$code || trim($code) == "") {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function toArray(&$data)
}
if (is_array($data)) {
foreach ($data as &$value) {
if (is_array($value) or is_object($value)) {
if (is_array($value) || is_object($value)) {
$this->toArray($value);
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Authorizenet/Helper/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getSuccessOrderUrl($params)
$url = parent::getSuccessOrderUrl($params);

if ($params['controller_action_name'] === 'sales_order_create'
or $params['controller_action_name'] === 'sales_order_edit'
|| $params['controller_action_name'] === 'sales_order_edit'
) {
/** @var Mage_Sales_Model_Order $order */
$order = Mage::getModel('sales/order');
Expand All @@ -66,7 +66,7 @@ public function getSaveOrderUrlParams($controller)
{
$route = parent::getSaveOrderUrlParams($controller);

if ($controller === "sales_order_create" or $controller === "sales_order_edit") {
if ($controller === "sales_order_create" || $controller === "sales_order_edit") {
$route['action'] = 'save';
$route['controller'] = 'sales_order_create';
$route['module'] = 'admin';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function update($valueId, $data, $store = null)
foreach ($data as $key => $value) {
$data[$key] = Mage::helper('catalog')->stripTags($value);
}
if (!isset($data['title']) or empty($data['title'])) {
if (!isset($data['title']) || empty($data['title'])) {
$this->_fault('option_value_title_required');
}
$data['option_type_id'] = $valueId;
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Sendfriend/Model/Sendfriend.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,9 @@ public function getWebsiteId()
public function setRecipients($recipients)
{
// validate array
if (!is_array($recipients) or !isset($recipients['email'])
or !isset($recipients['name']) or !is_array($recipients['email'])
or !is_array($recipients['name'])) {
if (!is_array($recipients) || !isset($recipients['email'])
|| !isset($recipients['name']) || !is_array($recipients['email'])
|| !is_array($recipients['name'])) {
return $this;
}

Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Tag/Model/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ public function remove($tagId)
*/
protected function _prepareDataForAdd($data)
{
if (!isset($data['product_id']) or !isset($data['tag'])
or !isset($data['customer_id']) or !isset($data['store'])) {
if (!isset($data['product_id']) || !isset($data['tag'])
|| !isset($data['customer_id']) || !isset($data['store'])) {
$this->_fault('invalid_data');
}

Expand All @@ -236,7 +236,7 @@ protected function _prepareDataForAdd($data)
protected function _prepareDataForUpdate($data)
{
// $data should contain at least one field to change
if (!(isset($data['name']) or isset($data['status']) or isset($data['base_popularity']))) {
if (!(isset($data['name']) || isset($data['status']) || isset($data['base_popularity']))) {
$this->_fault('invalid_data');
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/XmlConnect/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ static public function arrayMergeRecursive($target, $changes)
$target[$key] = $changes[$key];
continue;
}
if (is_array($value) or is_array($target[$key])) {
if (is_array($value) || is_array($target[$key])) {
$target[$key] = self::arrayMergeRecursive($target[$key], $changes[$key]);
} else if (is_numeric($key)) {
if (!in_array($value, $target)) {
Expand Down
24 changes: 12 additions & 12 deletions app/code/core/Zend/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function __construct($date = null, $part = null, $locale = null)
}

// set datepart
if (($part !== null && $part !== self::TIMESTAMP) or (!is_numeric($date))) {
if (($part !== null && $part !== self::TIMESTAMP) || (!is_numeric($date))) {
// switch off dst handling for value setting
$this->setUnixTimestamp($this->getGmtOffset());
$this->set($date, $part, $this->_locale);
Expand Down Expand Up @@ -472,7 +472,7 @@ public function toString($format = null, $type = null, $locale = null)

if ($format === null) {
$format = Zend_Locale_Format::getDateFormat($locale) . ' ' . Zend_Locale_Format::getTimeFormat($locale);
} else if (((self::$_options['format_type'] == 'php') && ($type === null)) or ($type == 'php')) {
} else if (((self::$_options['format_type'] == 'php') && ($type === null)) || ($type == 'php')) {
$format = Zend_Locale_Format::convertPhpToIsoFormat($format);
}

Expand Down Expand Up @@ -1276,9 +1276,9 @@ private function _assign($calc, $date, $comp = 0, $dst = false)
if ((self::$_options['fix_dst'] === true) && ($dst !== false) && ($this->_dst === true)) {
$hour = $this->toString(self::HOUR, 'iso');
if ($hour != $dst) {
if (($dst == ($hour + 1)) or ($dst == ($hour - 23))) {
if (($dst == ($hour + 1)) || ($dst == ($hour - 23))) {
$value += 3600;
} else if (($dst == ($hour - 1)) or ($dst == ($hour + 23))) {
} else if (($dst == ($hour - 1)) || ($dst == ($hour + 23))) {
$value -= 3600;
}
$this->setUnixTimestamp($value);
Expand Down Expand Up @@ -2795,7 +2795,7 @@ private function _time($calc, $time, $format, $locale)
$time = $time->toString('HH:mm:ss', 'iso');
} else {
if (is_array($time)) {
if ((isset($time['hour']) === true) or (isset($time['minute']) === true) or
if ((isset($time['hour']) === true) || (isset($time['minute']) === true) ||
(isset($time['second']) === true)) {
$parsed = $time;
} else {
Expand Down Expand Up @@ -2957,7 +2957,7 @@ private function _date($calc, $date, $format, $locale)
$date = $date->toString('d.M.y', 'iso');
} else {
if (is_array($date)) {
if ((isset($date['year']) === true) or (isset($date['month']) === true) or
if ((isset($date['year']) === true) || (isset($date['month']) === true) ||
(isset($date['day']) === true)) {
$parsed = $date;
} else {
Expand Down Expand Up @@ -3261,15 +3261,15 @@ public function compareArpa($date, $locale = null)
*/
private function _checkLocation($location)
{
if (!isset($location['longitude']) or !isset($location['latitude'])) {
if (!isset($location['longitude']) || !isset($location['latitude'])) {
#require_once 'Zend/Date/Exception.php';
throw new Zend_Date_Exception('Location must include \'longitude\' and \'latitude\'', 0, null, $location);
}
if (($location['longitude'] > 180) or ($location['longitude'] < -180)) {
if (($location['longitude'] > 180) || ($location['longitude'] < -180)) {
#require_once 'Zend/Date/Exception.php';
throw new Zend_Date_Exception('Longitude must be between -180 and 180', 0, null, $location);
}
if (($location['latitude'] > 90) or ($location['latitude'] < -90)) {
if (($location['latitude'] > 90) || ($location['latitude'] < -90)) {
#require_once 'Zend/Date/Exception.php';
throw new Zend_Date_Exception('Latitude must be between -90 and 90', 0, null, $location);
}
Expand Down Expand Up @@ -4454,7 +4454,7 @@ public function getFractionalPrecision()
*/
public function setFractionalPrecision($precision)
{
if (!intval($precision) or ($precision < 0) or ($precision > 9)) {
if (!intval($precision) || ($precision < 0) || ($precision > 9)) {
#require_once 'Zend/Date/Exception.php';
throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision);
}
Expand Down Expand Up @@ -4800,7 +4800,7 @@ public static function isDate($date, $format = null, $locale = null)
$parsed = $date;
}

if (((strpos($format, 'Y') !== false) or (strpos($format, 'y') !== false)) &&
if (((strpos($format, 'Y') !== false) || (strpos($format, 'y') !== false)) &&
(!isset($parsed['year']))) {
// Year expected but not found
return false;
Expand All @@ -4816,7 +4816,7 @@ public static function isDate($date, $format = null, $locale = null)
return false;
}

if (((strpos($format, 'H') !== false) or (strpos($format, 'h') !== false)) &&
if (((strpos($format, 'H') !== false) || (strpos($format, 'h') !== false)) &&
(!isset($parsed['hour']))) {
// Hour expected but not found
return false;
Expand Down
12 changes: 6 additions & 6 deletions app/code/core/Zend/Locale/Math/PhpMath.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function Add($op1, $op2, $scale = null)
$op1 = self::normalize($op1);
$op2 = self::normalize($op2);
$result = $op1 + $op2;
if (is_infinite($result) or (abs($result - $op2 - $op1) > $precision)) {
if (is_infinite($result) || (abs($result - $op2 - $op1) > $precision)) {
#require_once 'Zend/Locale/Math/Exception.php';
throw new Zend_Locale_Math_Exception("addition overflow: $op1 + $op2 != $result", $op1, $op2, $result);
}
Expand All @@ -98,7 +98,7 @@ public static function Sub($op1, $op2, $scale = null)
$op1 = self::normalize($op1);
$op2 = self::normalize($op2);
$result = $op1 - $op2;
if (is_infinite($result) or (abs($result + $op2 - $op1) > $precision)) {
if (is_infinite($result) || (abs($result + $op2 - $op1) > $precision)) {
#require_once 'Zend/Locale/Math/Exception.php';
throw new Zend_Locale_Math_Exception("subtraction overflow: $op1 - $op2 != $result", $op1, $op2, $result);
}
Expand All @@ -120,7 +120,7 @@ public static function Pow($op1, $op2, $scale = null)
$op2 = ($op2 > 0) ? floor($op2) : ceil($op2);

$result = pow($op1, $op2);
if (is_infinite($result) or is_nan($result)) {
if (is_infinite($result) || is_nan($result)) {
#require_once 'Zend/Locale/Math/Exception.php';
throw new Zend_Locale_Math_Exception("power overflow: $op1 ^ $op2", $op1, $op2, $result);
}
Expand All @@ -140,7 +140,7 @@ public static function Mul($op1, $op2, $scale = null)
$op1 = self::normalize($op1);
$op2 = self::normalize($op2);
$result = $op1 * $op2;
if (is_infinite($result) or is_nan($result)) {
if (is_infinite($result) || is_nan($result)) {
#require_once 'Zend/Locale/Math/Exception.php';
throw new Zend_Locale_Math_Exception("multiplication overflow: $op1 * $op2 != $result", $op1, $op2, $result);
}
Expand All @@ -164,7 +164,7 @@ public static function Div($op1, $op2, $scale = null)
$op1 = self::normalize($op1);
$op2 = self::normalize($op2);
$result = $op1 / $op2;
if (is_infinite($result) or is_nan($result)) {
if (is_infinite($result) || is_nan($result)) {
#require_once 'Zend/Locale/Math/Exception.php';
throw new Zend_Locale_Math_Exception("division overflow: $op1 / $op2 != $result", $op1, $op2, $result);
}
Expand Down Expand Up @@ -204,7 +204,7 @@ public static function Mod($op1, $op2)
return NULL;
}
$result = $op1 % $op2;
if (is_nan($result) or (($op1 - $result) % $op2 != 0)) {
if (is_nan($result) || (($op1 - $result) % $op2 != 0)) {
#require_once 'Zend/Locale/Math/Exception.php';
throw new Zend_Locale_Math_Exception(
"modulus calculation error: $op1 % $op2 != $result", $op1, $op2, $result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function run()
while (!$reviewBlockIsPresent and $sleepingTime <= 60) {
sleep(1);
$reviewBlockIsPresent = $this->paypalPage->getReviewBlock()->isVisible()
or $this->paypalPage->getOldReviewBlock()->isVisible();
|| $this->paypalPage->getOldReviewBlock()->isVisible();
$sleepingTime++;
}
$this->reviewBlock = $this->paypalPage->getReviewBlock()->isVisible()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function run()
{
sleep(1);
$reviewBlockIsPresent = $this->paypalPage->getReviewBlock()->isVisible()
or $this->paypalPage->getOldReviewBlock()->isVisible();
|| $this->paypalPage->getOldReviewBlock()->isVisible();
$sleepingTime++;
}
/** Log out from previous session. */
Expand Down
2 changes: 1 addition & 1 deletion downloader/Maged/Model/BruteForce/ConfigIni.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function get($name, $defaultValue = null)
*/
public function set($name, $value)
{
if (is_array($value) or is_object($value)) {
if (is_array($value) || is_object($value)) {
throw new Exception ("Bad value type.");
}
$this->data[$name] = $value;
Expand Down
4 changes: 2 additions & 2 deletions lib/Cm/Cache/Backend/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ public function __construct($options = array())
}

if ( ! empty($options['password'])) {
$this->_redis->auth($options['password']) or Zend_Cache::throwException('Unable to authenticate with the redis server.');
$this->_redis->auth($options['password']) || Zend_Cache::throwException('Unable to authenticate with the redis server.');
}

// Always select database on startup in case persistent connection is re-used by other code
if (empty($options['database'])) {
$options['database'] = 0;
}
$this->_redis->select( (int) $options['database']) or Zend_Cache::throwException('The redis database could not be selected.');
$this->_redis->select( (int) $options['database']) || Zend_Cache::throwException('The redis database could not be selected.');

if ( isset($options['notMatchingTags']) ) {
$this->_notMatchingTags = (bool) $options['notMatchingTags'];
Expand Down
4 changes: 2 additions & 2 deletions lib/PEAR/HTTP/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ function sendRequest($saveBody = true)
$this->_sock = new Net_Socket();
$err = $this->_sock->connect($host, $port, null, $this->_timeout, $this->_socketOptions);
}
PEAR::isError($err) or $err = $this->_sock->write($this->_buildRequest());
PEAR::isError($err) || $err = $this->_sock->write($this->_buildRequest());

if (!PEAR::isError($err)) {
if (!empty($this->_readTimeout)) {
Expand Down Expand Up @@ -798,7 +798,7 @@ function sendRequest($saveBody = true)
$this->_url->path = $redirect;

// Relative path
} elseif (substr($redirect, 0, 3) == '../' OR substr($redirect, 0, 2) == './') {
} elseif (substr($redirect, 0, 3) == '../' || substr($redirect, 0, 2) == './') {
if (substr($this->_url->path, -1) == '/') {
$redirect = $this->_url->path . $redirect;
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/PEAR/Mail/mimePart.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ function _quotedPrintableEncode($input , $line_max = 76)
$char = '=09';
} elseif ($dec == 9) {
; // Do nothing if a tab.
} elseif (($dec == 61) OR ($dec < 32 ) OR ($dec > 126)) {
} elseif (($dec == 61) || ($dec < 32 ) || ($dec > 126)) {
$char = $escape . strtoupper(sprintf('%02s', dechex($dec)));
} elseif (($dec == 46) AND ($newline == '')) {
//Bug #9722: convert full-stop at bol
Expand Down
2 changes: 1 addition & 1 deletion lib/PEAR/Net/URL.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ function resolvePath($path)
$path = array_values($path);
$i--;

} elseif ($path[$i] == '..' AND ($i > 1 OR ($i == 1 AND $path[0] != '') ) ) {
} elseif ($path[$i] == '..' AND ($i > 1 || ($i == 1 AND $path[0] != '') ) ) {
unset($path[$i]);
unset($path[$i-1]);
$path = array_values($path);
Expand Down
2 changes: 1 addition & 1 deletion lib/PEAR/SOAP/Transport/HTTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ function _parseHeaders($headers)
$cookie['secure'] = true;
} elseif ('expires' == $elName) {
$cookie['expires'] = str_replace('"', '', $elValue);
} elseif ('path' == $elName OR 'domain' == $elName) {
} elseif ('path' == $elName || 'domain' == $elName) {
$cookie[$elName] = urldecode($elValue);
} else {
$cookie[$elName] = $elValue;
Expand Down
4 changes: 2 additions & 2 deletions lib/Varien/Filter/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function includeDirective($construction)
{
// Processing of {include template=... [...]} statement
$includeParameters = $this->_getIncludeParameters($construction[2]);
if(!isset($includeParameters['template']) or !$this->getIncludeProcessor()) {
if(!isset($includeParameters['template']) || !$this->getIncludeProcessor()) {
// Not specified template or not seted include processor
$replacedValue = '{Error in include processing}';
} else {
Expand All @@ -213,7 +213,7 @@ public function templateDirective($construction)
{
// Processing of {template config_path=... [...]} statement
$templateParameters = $this->_getIncludeParameters($construction[2]);
if (!isset($templateParameters['config_path']) or !$this->getTemplateProcessor()) {
if (!isset($templateParameters['config_path']) || !$this->getTemplateProcessor()) {
$replacedValue = '{Error in template processing}';
} else {
// Including of template
Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Pear/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getLogStream()

public function log($msg, $append_crlf = true)
{
if (is_null($msg) || false===$msg or ''===$msg) {
if (is_null($msg) || false===$msg || ''===$msg) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Zend/Cache/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function getTmpDir()
foreach (array($_ENV, $_SERVER) as $tab) {
foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) {
if (isset($tab[$key]) && is_string($tab[$key])) {
if (($key == 'windir') or ($key == 'SystemRoot')) {
if (($key == 'windir') || ($key == 'SystemRoot')) {
$dir = realpath($tab[$key] . '\\temp');
} else {
$dir = realpath($tab[$key]);
Expand Down
Loading

0 comments on commit c1105b5

Please sign in to comment.