1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-04 17:04:03 +00:00

Rewrite conditional for clarity

This commit is contained in:
Samuel Štancl 2019-08-13 19:11:30 +02:00
parent 0d03414e80
commit 878edfdcee

View file

@ -275,11 +275,12 @@ class TenantManager
*/
public function put($key, $value = null, string $uuid = null)
{
if (in_array($key, ['uuid', 'domain'], true) ||
(is_array($key) && array_reduce(array_keys($key), function ($result, $k) {
return $result || in_array($k, ['uuid', 'domain']);
}, false))
) {
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;
}