summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-08-21 17:22:04 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-08-21 17:22:04 +0200
commitd2fdfc77f7a9485548869414d4377cd6848fe339 (patch)
treeb308dd8b5d45d6e7aafab8b0c9b567f707efa621
parent2875f7095562b302f13e1ef7e8cfd581cfc984bf (diff)
Improve coding style for return statements that only check one condition
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--application/models/mfile.php12
-rw-r--r--application/models/mmultipaste.php12
2 files changed, 4 insertions, 20 deletions
diff --git a/application/models/mfile.php b/application/models/mfile.php
index 748d187a3..4b14f1bf5 100644
--- a/application/models/mfile.php
+++ b/application/models/mfile.php
@@ -64,11 +64,7 @@ class Mfile extends CI_Model {
->limit(1)
->get();
- if ($query->num_rows() == 1) {
- return true;
- } else {
- return false;
- }
+ return $query->num_rows() == 1;
}
function get_filedata($id)
@@ -195,11 +191,7 @@ class Mfile extends CI_Model {
->limit(1)
->get();
- if ($query->num_rows() == 0) {
- return true;
- } else {
- return false;
- }
+ return $query->num_rows() == 0;
}
public function delete_by_user($userid)
diff --git a/application/models/mmultipaste.php b/application/models/mmultipaste.php
index d44454f52..fc0889377 100644
--- a/application/models/mmultipaste.php
+++ b/application/models/mmultipaste.php
@@ -70,11 +70,7 @@ class Mmultipaste extends CI_Model {
LIMIT 1';
$query = $this->db->query($sql, array($id));
- if ($query->num_rows() == 1) {
- return true;
- } else {
- return false;
- }
+ return $query->num_rows() == 1;
}
public function valid_id($id)
@@ -129,11 +125,7 @@ class Mmultipaste extends CI_Model {
$f = new \service\storage($this->get_tarball_path($id));
$f->unlink();
- if ($this->id_exists($id)) {
- return false;
- }
-
- return true;
+ return $this->id_exists($id);
}
public function get_owner($id)