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 <[email protected]>
  • Loading branch information
come-nc authored and backportbot[bot] committed Dec 6, 2021
1 parent d1e0aee commit d897520
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 @@ -124,11 +124,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 @@ -137,11 +139,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 d897520

Please sign in to comment.