aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/legacy/OC_Image.php
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2021-12-02 15:38:42 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2021-12-06 14:26:27 +0100
commit8504f0a59ed11f8c3dfb4d3acf674a0a8cf8d17e (patch)
tree3f424a33598d69b0edcb4af41a4331eb87452f9a /lib/private/legacy/OC_Image.php
parentab3a1d5706a5cc0c7f00b5d5ab47d493ffe68790 (diff)
downloadnextcloud-server-8504f0a59ed11f8c3dfb4d3acf674a0a8cf8d17e.tar.gz
nextcloud-server-8504f0a59ed11f8c3dfb4d3acf674a0a8cf8d17e.zip
Avoid assignment in if clause
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/legacy/OC_Image.php')
-rw-r--r--lib/private/legacy/OC_Image.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php
index 1b1d98325ba..333a9d919ef 100644
--- a/lib/private/legacy/OC_Image.php
+++ b/lib/private/legacy/OC_Image.php
@@ -124,11 +124,13 @@ class OC_Image implements \OCP\IImage {
* @return int
*/
public function width() {
- if ($this->valid() && (($width = imagesx($this->resource)) !== false)) {
- return $width;
- } else {
- return -1;
+ if ($this->valid()) {
+ $width = imagesx($this->resource);
+ if ($width !== false) {
+ return $width;
+ }
}
+ return -1;
}
/**
@@ -137,11 +139,13 @@ class OC_Image implements \OCP\IImage {
* @return int
*/
public function height() {
- if ($this->valid() && (($height = imagesy($this->resource)) !== false)) {
- return $height;
- } else {
- return -1;
+ if ($this->valid()) {
+ $height = imagesy($this->resource);
+ if ($height !== false) {
+ return $height;
+ }
}
+ return -1;
}
/**