mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-14 01:44:03 +00:00
Apply fixes from StyleCI
This commit is contained in:
parent
417330decd
commit
84890cdd1e
20 changed files with 73 additions and 73 deletions
|
|
@ -37,7 +37,7 @@ class RedisStorageDriver implements StorageDriver
|
|||
return $this->redis->hgetall("tenants:$uuid");
|
||||
}
|
||||
|
||||
return array_combine($fields, $this->redis->hmget("tenants:$uuid", $fields));
|
||||
return \array_combine($fields, $this->redis->hmget("tenants:$uuid", $fields));
|
||||
}
|
||||
|
||||
public function getTenantIdByDomain(string $domain): ?string
|
||||
|
|
@ -48,7 +48,7 @@ class RedisStorageDriver implements StorageDriver
|
|||
public function createTenant(string $domain, string $uuid): array
|
||||
{
|
||||
$this->redis->hmset("domains:$domain", 'tenant_id', $uuid);
|
||||
$this->redis->hmset("tenants:$uuid", 'uuid', json_encode($uuid), 'domain', json_encode($domain));
|
||||
$this->redis->hmset("tenants:$uuid", 'uuid', \json_encode($uuid), 'domain', \json_encode($domain));
|
||||
|
||||
return $this->redis->hgetall("tenants:$uuid");
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ class RedisStorageDriver implements StorageDriver
|
|||
public function deleteTenant(string $id): bool
|
||||
{
|
||||
try {
|
||||
$domain = json_decode($this->getTenantById($id)['domain']);
|
||||
$domain = \json_decode($this->getTenantById($id)['domain']);
|
||||
} catch (\Throwable $th) {
|
||||
throw new \Exception("No tenant with UUID $id exists.");
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ class RedisStorageDriver implements StorageDriver
|
|||
|
||||
public function getAllTenants(array $uuids = []): array
|
||||
{
|
||||
$hashes = array_map(function ($hash) {
|
||||
$hashes = \array_map(function ($hash) {
|
||||
return "tenants:{$hash}";
|
||||
}, $uuids);
|
||||
|
||||
|
|
@ -91,13 +91,13 @@ class RedisStorageDriver implements StorageDriver
|
|||
$all_keys = $this->redis->scan(null, 'MATCH', $redis_prefix . 'tenants:*')[1];
|
||||
}
|
||||
|
||||
$hashes = array_map(function ($key) use ($redis_prefix) {
|
||||
$hashes = \array_map(function ($key) use ($redis_prefix) {
|
||||
// Left strip $redis_prefix from $key
|
||||
return substr($key, strlen($redis_prefix));
|
||||
return \substr($key, \strlen($redis_prefix));
|
||||
}, $all_keys);
|
||||
}
|
||||
|
||||
return array_map(function ($tenant) {
|
||||
return \array_map(function ($tenant) {
|
||||
return $this->redis->hgetall($tenant);
|
||||
}, $hashes);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue