mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 02:54:03 +00:00
Use consistent shortest path terminology
This commit is contained in:
parent
c867ecec44
commit
a1e8324fb5
1 changed files with 7 additions and 7 deletions
|
|
@ -489,26 +489,26 @@ class TableRLSManager implements RLSPolicyManager
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the passed path is better than the current shortest path.
|
* Determine if the passed path is preferred to the current shortest path.
|
||||||
*
|
*
|
||||||
* Non-nullable paths are preferred over nullable paths.
|
* Non-nullable paths are preferred to nullable paths.
|
||||||
* From paths of the same nullability, the shorter will be preferred.
|
* From paths of the same nullability, the shorter will be preferred.
|
||||||
*/
|
*/
|
||||||
protected function determineBetterPath(array $path, array $currentBestPath): bool
|
protected function determineBetterPath(array $path, array $shortestPath): bool
|
||||||
{
|
{
|
||||||
if (! $currentBestPath) {
|
if (! $shortestPath) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pathIsNullable = $this->isPathNullable($path['steps']);
|
$pathIsNullable = $this->isPathNullable($path['steps']);
|
||||||
$bestPathIsNullable = $this->isPathNullable($currentBestPath['steps']);
|
$shortestPathIsNullable = $this->isPathNullable($shortestPath['steps']);
|
||||||
|
|
||||||
// Prefer non-nullable
|
// Prefer non-nullable
|
||||||
if ($pathIsNullable !== $bestPathIsNullable) {
|
if ($pathIsNullable !== $shortestPathIsNullable) {
|
||||||
return ! $pathIsNullable;
|
return ! $pathIsNullable;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prefer shorter
|
// Prefer shorter
|
||||||
return count($path['steps']) < count($currentBestPath['steps']);
|
return count($path['steps']) < count($shortestPath['steps']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue