Dir

Writable parent-directory lookup

Namespace: Com\Tecnick\File

File: Dir.php line 34

Writable parent-directory lookup

Tags

Methods

findParentDir()

File: Dir.php line 53

public findParentDir(string $name[, string $dir = __DIR__ ]) : string

Walks up from $dir looking for a writable directory named $name. A read-only directory of that name, or a regular file bearing it, is skipped.

Parameters

  • $name : string: Single directory name to search for. An empty or absolute name, or one containing a path separator or a parent-directory segment, is reported as not found.
  • $dir : string = __DIR__: Starting directory. A relative one is anchored to the current working directory first.

Return values

string —

Directory name with a trailing separator, or an empty string when no writable match exists up to the filesystem root.