private getPathDepth ( string $path ) : integer | ||
$path | string | A Puli path. |
Результат | integer | The depth starting with 0 for the root node. |
private function getPathDepth($path)
{
// / has depth 0
// /webmozart has depth 1
// /webmozart/puli has depth 2
// ...
return substr_count(rtrim($path, '/'), '/');
}