/**
* Verifies and adds all files from a directory.
*
* @return $this
*/
public function addDirectory(string
$directory, bool
$recursive = false
) { $directory = self::
resolveDirectory($directory);
// Map the directory to depth 2 to so directories become arrays
foreach (directory_map($directory, 2, true
) as $key =>
$path) { if (is_string($path)) { $this->
addFile($directory .
$path);
} elseif ($recursive &&
is_array($path)) { $this->
addDirectory($directory .
$key, true
);
} } return $this;
} // --------------------------------------------------------------------