elFinder\elFinderVolumeDriver::closestByAttr PHP Method

closestByAttr() protected method

If file has required attr == $val - return file path, If dir has child with has required attr == $val - return child path
Author: Dmitry (dio) Levashov
protected closestByAttr ( string $path, string $attr, boolean $val ) : string | false
$path string file path
$attr string attribute name
$val boolean attribute value
return string | false
    protected function closestByAttr($path, $attr, $val)
    {
        $stat = $this->stat($path);
        if (empty($stat)) {
            return false;
        }
        $v = isset($stat[$attr]) ? $stat[$attr] : false;
        if ($v == $val) {
            return $path;
        }
        return $stat['mime'] == 'directory' ? $this->childsByAttr($path, $attr, $val) : false;
    }