1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 16:14:02 +00:00

Apply fixes from StyleCI

This commit is contained in:
stancl 2019-08-16 16:21:59 +00:00 committed by StyleCI Bot
parent 417330decd
commit 84890cdd1e
20 changed files with 73 additions and 73 deletions

View file

@ -64,7 +64,7 @@ final class TenantManager
$tenant = $this->storage->identifyTenant($domain);
if (! $tenant || ! array_key_exists('uuid', $tenant) || ! $tenant['uuid']) {
if (! $tenant || ! \array_key_exists('uuid', $tenant) || ! $tenant['uuid']) {
throw new \Exception("Tenant could not be identified on domain {$domain}.");
}
@ -94,7 +94,7 @@ final class TenantManager
if ($data) {
$this->put($data, null, $tenant['uuid']);
$tenant = array_merge($tenant, $data);
$tenant = \array_merge($tenant, $data);
}
$this->database->create($this->getDatabaseName($tenant));
@ -175,7 +175,7 @@ final class TenantManager
$uuid = $this->getIdByDomain($domain);
if (is_null($uuid)) {
if (\is_null($uuid)) {
throw new \Exception("Tenant with domain $domain could not be identified.");
}
@ -240,7 +240,7 @@ final class TenantManager
$tenants = $this->storage->getAllTenants($uuids);
if ($this->useJson()) {
$tenants = array_map(function ($tenant_array) {
$tenants = \array_map(function ($tenant_array) {
return $this->jsonDecodeArrayValues($tenant_array);
}, $tenants);
}
@ -273,8 +273,8 @@ final class TenantManager
{
$uuid = $uuid ?: $this->tenant['uuid'];
if (array_key_exists('uuid', $this->tenant) && $uuid === $this->tenant['uuid'] &&
array_key_exists($key, $this->tenant) && ! is_array($key)) {
if (\array_key_exists('uuid', $this->tenant) && $uuid === $this->tenant['uuid'] &&
\array_key_exists($key, $this->tenant) && ! \is_array($key)) {
return $this->tenant[$key];
}
@ -282,7 +282,7 @@ final class TenantManager
return $this->jsonDecodeArrayValues($this->storage->getMany($uuid, $key));
}
return json_decode($this->storage->get($uuid, $key), true);
return \json_decode($this->storage->get($uuid, $key), true);
}
/**
@ -295,10 +295,10 @@ final class TenantManager
*/
public function put($key, $value = null, string $uuid = null)
{
if (in_array($key, ['uuid', 'domain'], true) || (
is_array($key) && (
in_array('uuid', array_keys($key), true) ||
in_array('domain', array_keys($key), true)
if (\in_array($key, ['uuid', 'domain'], true) || (
\is_array($key) && (
\in_array('uuid', \array_keys($key), true) ||
\in_array('domain', \array_keys($key), true)
)
)) {
throw new CannotChangeUuidOrDomainException;
@ -319,7 +319,7 @@ final class TenantManager
}
if (! \is_null($value)) {
return $target[$key] = json_decode($this->storage->put($uuid, $key, json_encode($value)), true);
return $target[$key] = \json_decode($this->storage->put($uuid, $key, \json_encode($value)), true);
}
if (! \is_array($key)) {
@ -328,7 +328,7 @@ final class TenantManager
foreach ($key as $k => $v) {
$target[$k] = $v;
$key[$k] = json_encode($v);
$key[$k] = \json_encode($v);
}
return $this->jsonDecodeArrayValues($this->storage->putMany($uuid, $key));
@ -349,8 +349,8 @@ final class TenantManager
protected function jsonDecodeArrayValues(array $array)
{
array_walk($array, function (&$value, $key) {
$value = json_decode($value, true);
\array_walk($array, function (&$value, $key) {
$value = \json_decode($value, true);
});
return $array;
@ -358,7 +358,7 @@ final class TenantManager
public function useJson()
{
if (property_exists($this->storage, 'useJson') && $this->storage->useJson === false) {
if (\property_exists($this->storage, 'useJson') && $this->storage->useJson === false) {
return false;
}