Skip to content

Commit

Permalink
Use strict comparison operator
Browse files Browse the repository at this point in the history
  • Loading branch information
pH-7 committed Jul 4, 2021
1 parent faddeb4 commit 71b6214
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function updateRatingStatus($userData)
TABLE_RATING,
$conditional_array);

if ($rating_response[STATUS_KEY] == SUCCESS) {
if ($rating_response[STATUS_KEY] === SUCCESS) {
$message = RATING_STATUS_STORED_SUCCESSFULLY;
$status = SUCCESS;
} else {
Expand Down Expand Up @@ -160,7 +160,7 @@ public function updateReview($userData)
$status = SUCCESS;
//START : if user have left 2 comments or rated 3 products (or more) then will rate status as TRUE else FALSE.
$rate_status = $this->IsUserRate($user_id);
if ($rate_status == SUCCESS) {
if ($rate_status === SUCCESS) {
$select_user_rate_query = "(SELECT COUNT(*) from " . TABLE_REVIEW . " WHERE user_id = " . $user_id . " AND is_test = '" . IS_TESTDATA . "' AND is_delete = '" . IS_DELETE . "') as count_rate";
$select_user_desc_query = "(SELECT COUNT(*) from " . TABLE_REVIEW . " WHERE user_id = " . $user_id . " AND is_test = '" . IS_TESTDATA . "' AND is_delete = '" . IS_DELETE . "' AND description != '') as count_comment";
$select_user_review_query = "SELECT " . $select_user_rate_query . "," . $select_user_desc_query;
Expand Down Expand Up @@ -221,12 +221,12 @@ public function addReview($userData)
TABLE_REVIEW,
$conditional_array);

if ($favourite_response[STATUS_KEY] == SUCCESS) {
if ($favourite_response[STATUS_KEY] === SUCCESS) {
$status = SUCCESS;
$message = REVIEW_ADDED_SUCCESSFULLY;
//START : if user have left 2 comments or rated 3 products (or more) then will rate status as TRUE else FALSE.
$rate_status = $this->IsUserRate($user_id);
if ($rate_status == SUCCESS) {
if ($rate_status === SUCCESS) {
$select_user_rate_query = "(SELECT COUNT(*) from " . TABLE_REVIEW . " WHERE user_id = " . $user_id . " AND is_test = '" . IS_TESTDATA . "' AND is_delete = '" . IS_DELETE . "') as count_rate";
$select_user_desc_query = "(SELECT COUNT(*) from " . TABLE_REVIEW . " WHERE user_id = " . $user_id . " AND is_test = '" . IS_TESTDATA . "' AND is_delete = '" . IS_DELETE . "' AND description != '') as count_comment";
$select_user_review_query = "SELECT " . $select_user_rate_query . "," . $select_user_desc_query;
Expand Down Expand Up @@ -632,7 +632,7 @@ public function getProductDetailsV2($userData)
TABLE_HISTORY, ['created_date' => $current_date],
['id' => $history_id, 'is_delete' => IS_DELETE, 'is_test' => IS_TESTDATA],
"");
if ($edit_history_response[STATUS_KEY] == SUCCESS) {
if ($edit_history_response[STATUS_KEY] === SUCCESS) {
$posts[] = $product;
$data['status'] = SUCCESS;
$data['message'] = PRODUCT_FETCHED_SUCCESSFULLY;
Expand All @@ -647,7 +647,7 @@ public function getProductDetailsV2($userData)
$add_history_response = addData(
$connection, '',
TABLE_HISTORY, $history_array);
if ($add_history_response[STATUS_KEY] == SUCCESS) {
if ($add_history_response[STATUS_KEY] === SUCCESS) {
$posts[] = $product;
$data['status'] = SUCCESS;
$data['message'] = PRODUCT_FETCHED_SUCCESSFULLY;
Expand Down Expand Up @@ -696,7 +696,7 @@ public function getProductDetailsV2($userData)
$product_array['is_delete'] = IS_DELETE;
$product_array['is_test'] = IS_TESTDATA;
$productDetails = $this->processProductDetails($product_array, $user_id);
if ($productDetails[STATUS_KEY] == SUCCESS) {
if ($productDetails[STATUS_KEY] === SUCCESS) {
return $productDetails;
} else {
$data['status'] = $productDetails[STATUS_KEY];
Expand Down Expand Up @@ -734,7 +734,7 @@ function processProductDetails($product_array, $user_id)
$insert_response = addData(
$connection, '',
TABLE_PRODUCT, $product_array);
if ($insert_response[STATUS_KEY] == SUCCESS) {
if ($insert_response[STATUS_KEY] === SUCCESS) {
$last_inserted_id = $insert_response[MESSAGE_KEY];
$history_array = ['user_id' => $user_id, 'product_id' => $last_inserted_id, 'created_date' => $current_date];
addData($connection, '', TABLE_HISTORY, $history_array);
Expand Down Expand Up @@ -832,7 +832,7 @@ public function getProductDetails($userData)
['created_date' => $current_date],
['id' => $history_id, 'is_delete' => IS_DELETE, 'is_test' => IS_TESTDATA],
"");
if ($edit_history_response[STATUS_KEY] == SUCCESS) {
if ($edit_history_response[STATUS_KEY] === SUCCESS) {
$posts[] = $product;
$message = PRODUCT_FETCHED_SUCCESSFULLY;
} else {
Expand All @@ -846,7 +846,7 @@ public function getProductDetails($userData)
$connection, '',
TABLE_HISTORY,
$history_array);
if ($add_history_response[STATUS_KEY] == SUCCESS) {
if ($add_history_response[STATUS_KEY] === SUCCESS) {
$posts[] = $product;
$message = PRODUCT_FETCHED_SUCCESSFULLY;
} else {
Expand Down Expand Up @@ -934,7 +934,7 @@ public function getProductDetails($userData)
$connection, '',
TABLE_PRODUCT,
$product_array);
if ($insert_response[STATUS_KEY] == SUCCESS) {
if ($insert_response[STATUS_KEY] === SUCCESS) {
$last_inserted_id = $insert_response[MESSAGE_KEY];
//Insert data into history
$history_array = ['user_id' => $user_id, 'product_id' => $last_inserted_id, 'created_date' => $current_date];
Expand Down Expand Up @@ -1033,7 +1033,7 @@ public function getProductDetails($userData)
$connection, '',
TABLE_PRODUCT,
$product_array);
if ($insert_response[STATUS_KEY] == SUCCESS) {
if ($insert_response[STATUS_KEY] === SUCCESS) {
$last_inserted_id = $insert_response[MESSAGE_KEY];
//Insert data into history
$history_array = ['user_id' => $user_id, 'product_id' => $last_inserted_id, 'created_date' => $current_date];
Expand Down Expand Up @@ -1273,7 +1273,7 @@ public function addToFavourite($userData)
"addToFavourite",
TABLE_FAVOURITE,
$favourite_product_array);
if ($favourite_response[STATUS_KEY] == SUCCESS) {
if ($favourite_response[STATUS_KEY] === SUCCESS) {
$status = SUCCESS;
$message = FAVOURITE_SUCCESSFULLY;
} else {
Expand All @@ -1282,9 +1282,9 @@ public function addToFavourite($userData)
}
}
//START : Check if user have added 5 or more product as favourite then rate status will as true else false.
if ($status == SUCCESS) {
if ($status === SUCCESS) {
$rate_status = $this->IsUserRate($user_id);
if ($rate_status == SUCCESS) {
if ($rate_status === SUCCESS) {
$select_user_fav_query = "SELECT count(*) as count_fav from " . TABLE_FAVOURITE . " WHERE user_id = " . $user_id . "
AND is_favourite = '1'
AND is_test = '" . IS_TESTDATA . "' AND is_delete = '" . IS_DELETE . "' ";
Expand Down

0 comments on commit 71b6214

Please sign in to comment.