Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Commit

Permalink
Improve condition checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kkamara committed Feb 6, 2022
1 parent a35d064 commit a76ac72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 3 additions & 3 deletions app/Helpers/RedisCartHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(protected ?Client $client = null) {
* @return Mixed
*/
public function get($key): mixed {
if (!$this->client->exists($key)) {
if (0 === $this->client->exists($key)) {
return null;
}
$result = $this->client->get($key);
Expand All @@ -50,7 +50,7 @@ public function set($key, $value): mixed {
* @return Integer
*/
public function del(string $keys): int {
if (!$this->client->exists($keys)) {
if (0 === $this->client->exists($keys)) {
return 0;
}
return $this->client->del($keys);
Expand All @@ -66,7 +66,7 @@ public function getRedisCart(): mixed {
/**
* @return Mixed
*/
public function getGuestIdentifier(): string {
private function getGuestIdentifier(): string {
return fingerprint();
}

Expand Down
6 changes: 1 addition & 5 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@

use Illuminate\Http\Request;
use App\Models\Product\Product;
use App\Helpers\RedisCartHelper;

class HomeController extends Controller
{
/**
* @param Product $product
* @param RedisCartHelper $redisClient
*/
public function __construct(
protected Product $product = new Product,
protected RedisCartHelper $redisClient = new RedisCartHelper,
) {}
public function __construct(protected Product $product = new Product) {}

/**
* Show the application dashboard.
Expand Down

0 comments on commit a76ac72

Please sign in to comment.