Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Tells whether the filename is a directory
<?php is_dir(string $filename): bool
<?php function delete_directory(string $dir): void
{
if ( ! is_dir($dir)) {
return;
}
<?php if ('.' === $file || '..' === $file) {
continue;
}
if (is_dir("$dir/$file")) {
delete_directory("$dir/$file");
} else {
unlink("$dir/$file");
<?php {
$location = $this->prefixer->prefixPath($prefix);
if ( ! is_dir($location)) {
return;
}
<?php {
$location = $this->prefixer->prefixPath($path);
if ( ! is_dir($location)) {
return;
}
<?php protected function ensureDirectoryExists(string $dirname, int $visibility): void
{
if (is_dir($dirname)) {
return;
}
<?php clearstatcache(false, $dirname);
if ( ! is_dir($dirname)) {
$errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : '';
throw UnableToCreateDirectory::atLocation($dirname, $errorMessage);
<?php $visibility = $config->get(Config::OPTION_VISIBILITY, $config->get(Config::OPTION_DIRECTORY_VISIBILITY));
$permissions = $this->resolveDirectoryVisibility($visibility);
if (is_dir($location)) {
$this->setPermissions($location, $permissions);
return;
<?php public function setVisibility(string $path, string $visibility): void
{
$path = $this->prefixer->prefixPath($path);
$visibility = is_dir($path) ? $this->visibility->forDirectory($visibility) : $this->visibility->forFile(
$visibility
);
<?php {
$dirname = dirname($fullPath);
if (is_dir($dirname) || @mkdir($dirname, $this->localDirectoryPermissions, true)) {
return;
}
<?php return;
}
if ( ! is_dir($dirname)) {
throw UnableToCreateParentDirectory::atLocation($fullPath, error_get_last()['message'] ?? '');
}
}