AsseticBundle\Cli\SetupCommand::createPath PHP Метод

createPath() приватный Метод

Creates a path with the needed permissions
private createPath ( Symfony\Component\Console\Output\OutputInterface $output, string $which, string $path, integer $mode ) : boolean
$output Symfony\Component\Console\Output\OutputInterface The output object
$which string Which path?
$path string The path
$mode integer The permissions
Результат boolean Success
    private function createPath(OutputInterface $output, $which, $path, $mode)
    {
        $displayMode = decoct($mode);
        $pathExists = is_dir($path);
        if (!$path) {
            $output->writeln('Creation of ' . $which . ' path skipped - no path provided');
            return true;
        }
        if (!$pathExists) {
            if (mkdir($path, $mode, true)) {
                $output->writeln($which . ' path created "' . $path . '" with mode "' . $displayMode . '"');
                return true;
            } else {
                $output->writeln('<error>' . $which . ' path "' . $path . '" could not be created.</error>');
                return false;
            }
        }
        $readable = is_readable($path);
        $writable = is_writable($path);
        if ($readable && $writable) {
            $output->writeln('Creation of ' . $which . ' path "' . $path . '" skipped - path exists with correct permissions');
            return true;
        } elseif (!$readable && !$writable) {
            $output->writeln('<error>Creation of ' . $which . ' path "' . $path . '" failed - path exists but is neither readable nor writable</error>');
        } elseif (!$readable) {
            $output->writeln('<error>Creation of ' . $which . ' path "' . $path . '" failed - path exists but is not readable</error>');
        } elseif (!$writable) {
            $output->writeln('<error>Creation of ' . $which . ' path "' . $path . '" failed - path exists but is not writable</error>');
        }
        return false;
    }