Autarky\Utils\Diagnostic::checkPaths PHP Method

checkPaths() public method

public checkPaths ( array $paths )
$paths array
    public function checkPaths(array $paths)
    {
        foreach ($paths as $key => $value) {
            if (!$value) {
                if ($this->verbose) {
                    echo "path.{$key} is empty, skipping\n";
                }
                continue;
            }
            if (!is_dir($value)) {
                echo "ERROR: path.{$key}: {$value} is not a directory\n";
                continue;
            }
            if ($key == 'vendor' || $key == 'base' || $key == 'app') {
                // don't recurse, only check readable
                $this->checkDir("path.{$key}", $value, true, false, false);
                if ($key == 'app') {
                    // recurse over the config directory
                    $this->checkDir("path.{$key}", "{$value}/config", true, false, true);
                }
            } else {
                if ($key == 'storage') {
                    // recurse, check for writeable as well as readable
                    $this->checkDir("path.{$key}", $value, true, true, true);
                } else {
                    // recurse, only check readable
                    $this->checkDir("path.{$key}", $value, true, false, true);
                }
            }
        }
        if ($this->errors === 0) {
            echo "No errors!\n";
            return 0;
        } else {
            return 1;
        }
    }