Skip to content

Commit

Permalink
fix: fallback to null when user attribute value is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Wisdom Ebong committed Dec 4, 2023
1 parent 0255d17 commit a598d11
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/Ushahidi/Authzn/GenericUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Illuminate\Contracts\Auth\Authenticatable as AuthContract;
use Laravel\Passport\HasApiTokens;
use Ushahidi\Contracts\Entity;
use Ushahidi\Core\Entity\User;

class GenericUser implements Entity, AuthContract
{
Expand Down Expand Up @@ -130,7 +129,7 @@ public function asArray()
*/
public function __get($key)
{
return $this->attributes[$key];
return $this->attributes[$key] ?? null;
}

/**
Expand Down Expand Up @@ -166,9 +165,4 @@ public function __unset($key)
{
unset($this->attributes[$key]);
}

public function generateEntityFromSelf(): User
{
return new User($this->attributes);
}
}

0 comments on commit a598d11

Please sign in to comment.