mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 12:24:04 +00:00
Simplify if-else branches
This commit is contained in:
parent
44d6509691
commit
374c704607
4 changed files with 24 additions and 20 deletions
|
|
@ -48,16 +48,18 @@ trait ParallelCommand
|
||||||
|
|
||||||
if ($pid === -1) {
|
if ($pid === -1) {
|
||||||
return -1;
|
return -1;
|
||||||
} elseif ($pid) {
|
}
|
||||||
|
|
||||||
|
if ($pid) {
|
||||||
// Parent
|
// Parent
|
||||||
return $pid;
|
return $pid;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
// Child
|
// Child
|
||||||
DB::reconnect();
|
DB::reconnect();
|
||||||
|
|
||||||
exit($this->childHandle(...$args) ? 0 : 1);
|
exit($this->childHandle(...$args) ? 0 : 1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected function sysctlGetLogicalCoreCount(bool $darwin): int
|
protected function sysctlGetLogicalCoreCount(bool $darwin): int
|
||||||
{
|
{
|
||||||
|
|
@ -70,7 +72,9 @@ trait ParallelCommand
|
||||||
// perflevel0 refers to P-cores on M-series, and the entire CPU on Intel Macs
|
// perflevel0 refers to P-cores on M-series, and the entire CPU on Intel Macs
|
||||||
if ($darwin && $ffi->sysctlbyname('hw.perflevel0.logicalcpu', FFI::addr($cores), FFI::addr($size), null, 0) === 0) {
|
if ($darwin && $ffi->sysctlbyname('hw.perflevel0.logicalcpu', FFI::addr($cores), FFI::addr($size), null, 0) === 0) {
|
||||||
return $cores->cdata;
|
return $cores->cdata;
|
||||||
} else if ($darwin) {
|
}
|
||||||
|
|
||||||
|
if ($darwin) {
|
||||||
// Reset the size in case the pointer got written to (likely shouldn't happen)
|
// Reset the size in case the pointer got written to (likely shouldn't happen)
|
||||||
$size->cdata = FFI::sizeof($cores);
|
$size->cdata = FFI::sizeof($cores);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,12 +88,12 @@ class TenantAssetController implements HasMiddleware
|
||||||
if (app()->runningUnitTests()) {
|
if (app()->runningUnitTests()) {
|
||||||
// Makes testing the cause of the failure in validatePath() easier
|
// Makes testing the cause of the failure in validatePath() easier
|
||||||
throw new Exception($exceptionMessage);
|
throw new Exception($exceptionMessage);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
// We always use 404 to avoid leaking information about the cause of the error
|
// We always use 404 to avoid leaking information about the cause of the error
|
||||||
// e.g. when someone is trying to access a nonexistent file outside of the allowed
|
// e.g. when someone is trying to access a nonexistent file outside of the allowed
|
||||||
// root folder, we don't want to let the user know whether such a file exists or not.
|
// root folder, we don't want to let the user know whether such a file exists or not.
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,12 @@ abstract class QueueableListener implements ShouldQueue
|
||||||
{
|
{
|
||||||
if (static::$shouldQueue) {
|
if (static::$shouldQueue) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
// The listener is not queued so we manually
|
// The listener is not queued so we manually
|
||||||
// pass the event to the handle() method.
|
// pass the event to the handle() method.
|
||||||
$this->handle($event);
|
$this->handle($event);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,9 @@ class InitializeTenancyByPath extends IdentificationMiddleware
|
||||||
$next,
|
$next,
|
||||||
$route
|
$route
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
throw new RouteIsMissingTenantParameterException;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new RouteIsMissingTenantParameterException;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue