public static function chmodPath($path, $dirMode = null, $fileMode = null, $recursive = true)
    {
        $result = false;

        $path = realpath($path);
        if (empty($path)) {
            return false;
        }

        $dirMode = $dirMode ?: self::getDefaultDirMode();
        $fileMode = $fileMode ?: self::getDefaultFileMode();

        $result = self::chmodPathSingle($path, $dirMode, $fileMode);
        if ($recursive && is_dir($path)) {
            $result = self::chmodPathRecursive($path, $dirMode, $fileMode);
        }

        return $result;
    }