Skip to content

Commit c41043d

Browse files
paulrodriguezPaul Rodriguez
andauthored
change all ands in conditional statements to && for better consistency (#970)
Co-authored-by: Paul Rodriguez <[email protected]>
1 parent d359766 commit c41043d

File tree

9 files changed

+31
-31
lines changed

9 files changed

+31
-31
lines changed

app/Mage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ public static function setRoot($appRoot = '')
317317

318318
$appRoot = realpath($appRoot);
319319

320-
if (is_dir($appRoot) and is_readable($appRoot)) {
320+
if (is_dir($appRoot) && is_readable($appRoot)) {
321321
self::$_appRoot = $appRoot;
322322
} else {
323323
self::throwException($appRoot . ' is not a directory or not readable by this user');

app/code/core/Mage/Catalog/Model/Product/Option/Api.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Mage_Catalog_Model_Product_Option_Api extends Mage_Catalog_Model_Api_Resou
4545
public function add($productId, $data, $store = null)
4646
{
4747
$product = $this->_getProduct($productId, $store, null);
48-
if (!(is_array($data['additional_fields']) and count($data['additional_fields']))) {
48+
if (!(is_array($data['additional_fields']) && count($data['additional_fields']))) {
4949
$this->_fault('invalid_data');
5050
}
5151
if (!$this->_isTypeAllowed($data['type'])) {
@@ -76,7 +76,7 @@ public function update($optionId, $data, $store = null)
7676
}
7777
$product = $this->_getProduct($option->getProductId(), $store, null);
7878
$option = $product->getOptionById($optionId);
79-
if (isset($data['type']) and !$this->_isTypeAllowed($data['type'])) {
79+
if (isset($data['type']) && !$this->_isTypeAllowed($data['type'])) {
8080
$this->_fault('invalid_type');
8181
}
8282
if (isset($data['additional_fields'])) {
@@ -109,7 +109,7 @@ protected function _prepareAdditionalFields(&$data, $groupType)
109109
// reset can be used as there should be the only
110110
// element in 'additional_fields' for options of all types except those from Select group
111111
$field = reset($data['additional_fields']);
112-
if (!(is_array($field) and count($field))) {
112+
if (!(is_array($field) && count($field))) {
113113
$this->_fault('invalid_data');
114114
} else {
115115
foreach ($field as $key => $value) {
@@ -119,7 +119,7 @@ protected function _prepareAdditionalFields(&$data, $groupType)
119119
} else {
120120
// convert Select rows array to appropriate format for saving in the model
121121
foreach ($data['additional_fields'] as $row) {
122-
if (!(is_array($row) and count($row))) {
122+
if (!(is_array($row) && count($row))) {
123123
$this->_fault('invalid_data');
124124
} else {
125125
foreach ($row as $key => $value) {

app/code/core/Mage/Core/Helper/Abstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public function escapeHtml($data, $allowedTags = null)
212212
} else {
213213
// process single item
214214
if (strlen($data)) {
215-
if (is_array($allowedTags) and !empty($allowedTags)) {
215+
if (is_array($allowedTags) && !empty($allowedTags)) {
216216
$allowed = implode('|', $allowedTags);
217217
$result = preg_replace('/<([\/\s\r\n]*)(' . $allowed . ')([\/\s\r\n]*)>/si', '##$1$2$3##', $data);
218218
$result = htmlspecialchars($result, ENT_COMPAT, 'UTF-8', false);

app/code/core/Mage/Core/Helper/Data.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ public function getEscapedCSVData(array $data)
942942
$value = (string)$value;
943943

944944
$firstLetter = substr($value, 0, 1);
945-
if ($firstLetter !== false and in_array($firstLetter, array("=", "+", "-"))) {
945+
if ($firstLetter !== false && in_array($firstLetter, array("=", "+", "-"))) {
946946
$data[$key] = ' ' . $value;
947947
}
948948
}
@@ -958,7 +958,7 @@ public function getEscapedCSVData(array $data)
958958
*/
959959
public function unEscapeCSVData($data)
960960
{
961-
if (is_array($data) and Mage::getStoreConfigFlag(Mage_ImportExport_Model_Export_Adapter_Csv::CONFIG_ESCAPING_FLAG)) {
961+
if (is_array($data) && Mage::getStoreConfigFlag(Mage_ImportExport_Model_Export_Adapter_Csv::CONFIG_ESCAPING_FLAG)) {
962962

963963
foreach ($data as $key => $value) {
964964
$value = (string)$value;

app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Combine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public function validate(Varien_Object $object)
216216
$valid = parent::validate($object);
217217
if (!$valid && $product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
218218
$children = $object->getChildren();
219-
if (is_array($children) and isset($children[0])) {
219+
if (is_array($children) && isset($children[0])) {
220220
$child = $children[0];
221221

222222
/** @var Mage_Catalog_Model_Product $childProduct */

app/code/core/Mage/Sendfriend/Model/Sendfriend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ protected function _sentCountByCookies($increment = false)
520520
$oldTimes = explode(',', $oldTimes);
521521
foreach ($oldTimes as $oldTime) {
522522
$periodTime = $time - $this->_getHelper()->getPeriod();
523-
if (is_numeric($oldTime) AND $oldTime >= $periodTime) {
523+
if (is_numeric($oldTime) && $oldTime >= $periodTime) {
524524
$newTimes[] = $oldTime;
525525
}
526526
}

app/code/core/Mage/XmlConnect/Helper/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ static public function arrayMergeRecursive($target, $changes)
423423
$changes = array($changes);
424424
}
425425
foreach ($changes as $key => $value) {
426-
if (!array_key_exists($key, $target) and !is_numeric($key)) {
426+
if (!array_key_exists($key, $target) && !is_numeric($key)) {
427427
$target[$key] = $changes[$key];
428428
continue;
429429
}

app/code/core/Zend/Date.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class Zend_Date extends Zend_Date_DateObject
149149
*/
150150
public function __construct($date = null, $part = null, $locale = null)
151151
{
152-
if (is_object($date) and !($date instanceof Zend_TimeSync_Protocol) and
152+
if (is_object($date) && !($date instanceof Zend_TimeSync_Protocol) &&
153153
!($date instanceof Zend_Date)) {
154154
if ($locale instanceof Zend_Locale) {
155155
$locale = $date;
@@ -160,12 +160,12 @@ public function __construct($date = null, $part = null, $locale = null)
160160
}
161161
}
162162

163-
if (($date !== null) and !is_array($date) and !($date instanceof Zend_TimeSync_Protocol) and
164-
!($date instanceof Zend_Date) and !defined($date) and Zend_Locale::isLocale($date, true, false)) {
163+
if (($date !== null) && !is_array($date) && !($date instanceof Zend_TimeSync_Protocol) &&
164+
!($date instanceof Zend_Date) && !defined($date) && Zend_Locale::isLocale($date, true, false)) {
165165
$locale = $date;
166166
$date = null;
167167
$part = null;
168-
} else if (($part !== null) and !defined($part) and Zend_Locale::isLocale($part, true, false)) {
168+
} else if (($part !== null) && !defined($part) && Zend_Locale::isLocale($part, true, false)) {
169169
$locale = $part;
170170
$part = null;
171171
}
@@ -460,7 +460,7 @@ public function toString($format = null, $type = null, $locale = null)
460460
$format = null;
461461
}
462462

463-
if (($type !== null) and ($type != 'php') and ($type != 'iso') and
463+
if (($type !== null) && ($type != 'php') && ($type != 'iso') &&
464464
Zend_Locale::isLocale($type, null, false)) {
465465
$locale = $type;
466466
$type = null;
@@ -1214,7 +1214,7 @@ public function getTimezoneFromString($zone)
12141214
}
12151215

12161216
preg_match('/([+-]\d{2}):{0,1}\d{2}/', $zone, $match);
1217-
if (!empty($match) and ($match[count($match) - 1] <= 14) and ($match[count($match) - 1] >= -12)) {
1217+
if (!empty($match) && ($match[count($match) - 1] <= 14) && ($match[count($match) - 1] >= -12)) {
12181218
$zone = "Etc/GMT";
12191219
$zone .= ($match[count($match) - 1] < 0) ? "+" : "-";
12201220
$zone .= (int) abs($match[count($match) - 1]);
@@ -1223,7 +1223,7 @@ public function getTimezoneFromString($zone)
12231223

12241224
preg_match('/([[:alpha:]\/_]{3,30})(?!.*([[:alpha:]\/]{3,30}))/', $zone, $match);
12251225
try {
1226-
if (!empty($match) and (!is_int($match[count($match) - 1]))) {
1226+
if (!empty($match) && (!is_int($match[count($match) - 1]))) {
12271227
$oldzone = $this->getTimezone();
12281228
$this->setTimezone($match[count($match) - 1]);
12291229
$result = $this->getTimezone();
@@ -1273,7 +1273,7 @@ private function _assign($calc, $date, $comp = 0, $dst = false)
12731273
}
12741274

12751275
// dst-correction if 'fix_dst' = true and dst !== false but only for non UTC and non GMT
1276-
if ((self::$_options['fix_dst'] === true) and ($dst !== false) and ($this->_dst === true)) {
1276+
if ((self::$_options['fix_dst'] === true) && ($dst !== false) && ($this->_dst === true)) {
12771277
$hour = $this->toString(self::HOUR, 'iso');
12781278
if ($hour != $dst) {
12791279
if (($dst == ($hour + 1)) or ($dst == ($hour - 23))) {
@@ -1528,7 +1528,7 @@ private function _calculate($calc, $date, $part, $locale)
15281528

15291529
case self::WEEKDAY_8601:
15301530
$weekday = (int) $this->toString(self::WEEKDAY_8601, 'iso', $locale);
1531-
if ((intval($date) > 0) and (intval($date) < 8)) {
1531+
if ((intval($date) > 0) && (intval($date) < 8)) {
15321532
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true),
15331533
$this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour);
15341534
}
@@ -1545,7 +1545,7 @@ private function _calculate($calc, $date, $part, $locale)
15451545

15461546
case self::WEEKDAY_DIGIT:
15471547
$weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale);
1548-
if (is_numeric($date) and (intval($date) >= 0) and (intval($date) < 7)) {
1548+
if (is_numeric($date) && (intval($date) >= 0) && (intval($date) < 7)) {
15491549
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $date, 1970, true),
15501550
$this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour);
15511551
}
@@ -2084,7 +2084,7 @@ private function _calculate($calc, $date, $part, $locale)
20842084
if (empty($timematch)) {
20852085
preg_match('/[T,\s]{0,1}(\d{2})(\d{2})(\d{2})/', $tmpdate, $timematch);
20862086
}
2087-
if (empty($datematch) and empty($timematch)) {
2087+
if (empty($datematch) && empty($timematch)) {
20882088
#require_once 'Zend/Date/Exception.php';
20892089
throw new Zend_Date_Exception("unsupported ISO8601 format ($date)", 0, null, $date);
20902090
}
@@ -2644,7 +2644,7 @@ private function _calculate($calc, $date, $part, $locale)
26442644
}
26452645

26462646
$parsed = Zend_Locale_Format::getDate($date, array('date_format' => $part, 'locale' => $locale, 'fix_date' => true, 'format_type' => 'iso'));
2647-
if ((strpos(strtoupper($part), 'YY') !== false) and (strpos(strtoupper($part), 'YYYY') === false)) {
2647+
if ((strpos(strtoupper($part), 'YY') !== false) && (strpos(strtoupper($part), 'YYYY') === false)) {
26482648
$parsed['year'] = self::getFullYear($parsed['year']);
26492649
}
26502650

@@ -2974,7 +2974,7 @@ private function _date($calc, $date, $format, $locale)
29742974
}
29752975

29762976
$parsed = Zend_Locale_Format::getDate($date, array('date_format' => $format, 'locale' => $locale, 'format_type' => 'iso'));
2977-
if ((strpos(strtoupper($format), 'YY') !== false) and (strpos(strtoupper($format), 'YYYY') === false)) {
2977+
if ((strpos(strtoupper($format), 'YY') !== false) && (strpos(strtoupper($format), 'YYYY') === false)) {
29782978
$parsed['year'] = self::getFullYear($parsed['year']);
29792979
}
29802980
} catch (Zend_Locale_Exception $e) {
@@ -4800,34 +4800,34 @@ public static function isDate($date, $format = null, $locale = null)
48004800
$parsed = $date;
48014801
}
48024802

4803-
if (((strpos($format, 'Y') !== false) or (strpos($format, 'y') !== false)) and
4803+
if (((strpos($format, 'Y') !== false) or (strpos($format, 'y') !== false)) &&
48044804
(!isset($parsed['year']))) {
48054805
// Year expected but not found
48064806
return false;
48074807
}
48084808

4809-
if ((strpos($format, 'M') !== false) and (!isset($parsed['month']))) {
4809+
if ((strpos($format, 'M') !== false) && (!isset($parsed['month']))) {
48104810
// Month expected but not found
48114811
return false;
48124812
}
48134813

4814-
if ((strpos($format, 'd') !== false) and (!isset($parsed['day']))) {
4814+
if ((strpos($format, 'd') !== false) && (!isset($parsed['day']))) {
48154815
// Day expected but not found
48164816
return false;
48174817
}
48184818

4819-
if (((strpos($format, 'H') !== false) or (strpos($format, 'h') !== false)) and
4819+
if (((strpos($format, 'H') !== false) or (strpos($format, 'h') !== false)) &&
48204820
(!isset($parsed['hour']))) {
48214821
// Hour expected but not found
48224822
return false;
48234823
}
48244824

4825-
if ((strpos($format, 'm') !== false) and (!isset($parsed['minute']))) {
4825+
if ((strpos($format, 'm') !== false) && (!isset($parsed['minute']))) {
48264826
// Minute expected but not found
48274827
return false;
48284828
}
48294829

4830-
if ((strpos($format, 's') !== false) and (!isset($parsed['second']))) {
4830+
if ((strpos($format, 's') !== false) && (!isset($parsed['second']))) {
48314831
// Second expected but not found
48324832
return false;
48334833
}

app/code/core/Zend/Validate/File/Upload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public function isValid($value, $file = null)
243243
protected function _throw($file, $errorType)
244244
{
245245
if ($file !== null) {
246-
if (is_array($file) and !empty($file['name'])) {
246+
if (is_array($file) && !empty($file['name'])) {
247247
$this->_value = $file['name'];
248248
}
249249
}

0 commit comments

Comments
 (0)