From f86d8d862236820a5aa4706cd05359788781cda5 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 29 May 2017 21:26:14 +0200 Subject: [PATCH] optimize isset --- DataStorage/Database/DataMapperAbstract.php | 2 +- Localization/L11nManager.php | 2 +- Stdlib/Graph/BinaryTree.php | 2 +- Stdlib/Map/MultiMap.php | 2 +- System/File/Ftp/FtpStorage.php | 2 +- Utils/Barcode/C25.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index 67bd6ef66..9cab711d0 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -1843,7 +1843,7 @@ class DataMapperAbstract implements DataMapperInterface $query = static::getQuery(); $query->limit($limit); - if (isset($from) && isset($to) && !empty(static::getCreatedAt())) { + if (isset($from, $to) && !empty(static::getCreatedAt())) { $query->where(static::getCreatedAt(), '>=', $from); $query->where(static::getCreatedAt(), '<=', $to); } diff --git a/Localization/L11nManager.php b/Localization/L11nManager.php index 6ed90d66f..edff93711 100644 --- a/Localization/L11nManager.php +++ b/Localization/L11nManager.php @@ -151,7 +151,7 @@ class L11nManager { if (!isset($module) && isset($this->language[$language])) { return $this->language[$language]; - } elseif (isset($this->language[$language]) && isset($this->language[$language][$module])) { + } elseif (isset($this->language[$language], $this->language[$language][$module])) { return $this->language[$language][$module]; } else { return []; diff --git a/Stdlib/Graph/BinaryTree.php b/Stdlib/Graph/BinaryTree.php index b82df944a..a3dced390 100644 --- a/Stdlib/Graph/BinaryTree.php +++ b/Stdlib/Graph/BinaryTree.php @@ -217,7 +217,7 @@ class BinaryTree extends Tree $right2 = isset($node2) ? $this->getRight($node1) : $this->getRight($node2); // todo: compare values? true symmetry requires the values to be the same - if(isset($node1) && isset($node2)) { + if(isset($node1, $node2)) { return $this->isSymmetric($left1, $right2) && $this->isSymmetric($right1, $left2); } diff --git a/Stdlib/Map/MultiMap.php b/Stdlib/Map/MultiMap.php index 307a422cb..14051a3be 100644 --- a/Stdlib/Map/MultiMap.php +++ b/Stdlib/Map/MultiMap.php @@ -370,7 +370,7 @@ class MultiMap implements \Countable return false; } - if (isset($this->keys[$old]) && isset($this->keys[$new])) { + if (isset($this->keys[$old], $this->keys[$new])) { $this->keys[$old] = $this->keys[$new]; $this->garbageCollect(); diff --git a/System/File/Ftp/FtpStorage.php b/System/File/Ftp/FtpStorage.php index 6b7d11950..6656db956 100644 --- a/System/File/Ftp/FtpStorage.php +++ b/System/File/Ftp/FtpStorage.php @@ -51,7 +51,7 @@ class FtpStorage extends StorageAbstract ftp_pasv($this->con, $mode); - if(isset($login) && isset($pass)) { + if(isset($login, $pass)) { ftp_login($this->con, $login, $pass); } } diff --git a/Utils/Barcode/C25.php b/Utils/Barcode/C25.php index c7218f887..9cb3fac68 100644 --- a/Utils/Barcode/C25.php +++ b/Utils/Barcode/C25.php @@ -127,7 +127,7 @@ class C25 extends C128Abstract } for ($posX = 1; $posX <= $length; $posX += 2) { - if (isset($temp[$posX]) && isset($temp[($posX + 1)])) { + if (isset($temp[$posX], $temp[($posX + 1)])) { $temp1 = explode('-', $temp[$posX]); $temp2 = explode('-', $temp[($posX + 1)]);