Skip to content

Commit

Permalink
Use strict equality operator and swap array() for []
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsandersen committed Nov 5, 2022
1 parent 8479ff8 commit 297cee8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/object/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct($resource) {
break;
case 'mc_versions':
if (is_null($value) || empty($value)) {
$this->supported_minecraft_versions = array();
$this->supported_minecraft_versions = [];
} else {
$versions = array_map(
function($version) {
Expand Down
8 changes: 4 additions & 4 deletions src/support/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function listResources($category, $page) {
return NULL;
}

$offset = $page == 1 ? 0 : 10 * ($page - 1);
$offset = $page === 1 ? 0 : 10 * ($page - 1);

if (!is_null($this->conn)) {
$categoryClause = is_null($category) ? '' : 'AND r.resource_category_id = :resource_category_id';
Expand All @@ -58,7 +58,7 @@ public function listResources($category, $page) {
if ($resStmt->execute()) {
$resources = $resStmt->fetchAll();

if (is_null($resources) || $resources == false || empty($resources)) {
if (is_null($resources) || $resources === false || empty($resources)) {
return NULL;
}

Expand Down Expand Up @@ -99,7 +99,7 @@ public function getResourcesByUser($user_id, $page) {
return NULL;
}

$offset = $page == 1 ? 0 : 10 * ($page - 1);
$offset = $page === 1 ? 0 : 10 * ($page - 1);

if (!is_null($this->conn)) {
$resStmt = $this->conn->prepare($this->_resource('AND r.user_id = :user_id LIMIT 10 OFFSET :offset'));
Expand Down Expand Up @@ -152,7 +152,7 @@ public function getResourceUpdates($resource_id, $page) {
return NULL;
}

$offset = $page == 1 ? 0 : 10 * ($page - 1);
$offset = $page === 1 ? 0 : 10 * ($page - 1);

if (!is_null($this->conn)) {
$updatesStmt = $this->conn->prepare($this->_resource_update('AND r.resource_id = :resource_id LIMIT 10 OFFSET :offset'));
Expand Down

0 comments on commit 297cee8

Please sign in to comment.