Skip to content

Commit

Permalink
Avoid assignment in if clause
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc committed Dec 13, 2021
1 parent 3347e95 commit aa65192
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/private/legacy/OC_Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ public function mimeType() {
* @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;
}

/**
Expand All @@ -138,11 +140,13 @@ public function width() {
* @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;
}

/**
Expand Down

0 comments on commit aa65192

Please sign in to comment.