Dir

Writable parent-directory lookup

Table of contents

Namespace: Com\Tecnick\File

class Dir

Source: src/Dir.php:34

Writable parent-directory lookup

Methods

findParentDir()

Returns the full path of a writable parent directory.

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.

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

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): Starting directory. A relative one is anchored to the current working directory first.

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

Source: src/Dir.php:53