Makes sure the directory ends with a slash

@param string $strDirectory
@return string
428357
private function fileFormatDir($strDirectory, $strSlash=DIRECTORY_SEPARATOR) {
		return substr($strDirectory, -1) != $strSlash ? $strDirectory.$strSlash : $strDirectory;
	}
652485
private function checkDirectoryExists(string $directory) : string
    {
        $realDirectory = realpath($directory);

        if (false === $realDirectory) {
            throw new DirectoryMissingException('The directory "' . $directory . '" does not exist, or we cannot access it');
        }

        if (!is_dir($realDirectory)) {
            throw new NotADirectoryException('The path "' . $realDirectory . '" did not resolve to a directory');
        }

        return $realDirectory;
    }
37930
private function normalizeDir($dir)
    {
        $dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);

        if (preg_match('#^s?ftp://#', $dir)) {
            $dir .= '/';
        }

        return $dir;
    }
464733
protected function modifyPath(string $str): string
    {
        return (string) $this->filterDataPath($str)->withParameters($this->parameters);
    }
671542
private function myDirectoryToString(string $directorySeparator, ?callable $stringEncoder = null): string
    {
        $result = '';

        if ($this->myAboveBaseLevel > 0) {
            $result .= str_repeat('..' . $directorySeparator, $this->myAboveBaseLevel);
        }

        if ($this->myIsAbsolute) {
            $result .= $directorySeparator;
        }

        $result .= implode($directorySeparator, $stringEncoder !== null ?
            array_map($stringEncoder, $this->myDirectoryParts) :
            $this->myDirectoryParts);

        if (count($this->myDirectoryParts) > 0) {
            $result .= $directorySeparator;
        }

        return $result;
    }
798776
public static function fixPath($path)
    {
        // Detect which direction of slash is "wrong"
        switch (DIRECTORY_SEPARATOR) {
            case '\\':
                $wrongDirection = '/';
                break;

            case '/':
            default:
                $wrongDirection = '\\';
                break;
        }

        if (false !== stristr($path, $wrongDirection)) {
            $path = str_replace($wrongDirection, DIRECTORY_SEPARATOR, $path);

            // In case of mixed slashes we maybe need to cleanup
            if (stristr($path, '\\\\')) {
                $path = str_replace('\\\\', '\\', $path);
            } elseif (stristr($path, '//')) {
                $path = str_replace('//', '/', $path);
            }
        }

        // Return corrected path
        return $path;
    }
82468
public function widont($str) {
		$str = rtrim($str);
		$space = strrpos($str, ' ');

		if ($space !== false) {
			$str = substr($str, 0, $space) . '&nbsp;' . substr($str, $space + 1);
		}

		return $str;
	}
625487
static function theme_url_to_dir( $src ) 	{
		$site_root = trailingslashit(get_theme_root_uri()).get_stylesheet();
		$tmp = str_replace($site_root, '', $src);
		//$tmp = trailingslashit(get_theme_root()).get_stylesheet().$tmp;
		$tmp = get_stylesheet_directory().$tmp;
		if ( realpath($tmp) ) {
			return realpath($tmp);
		}
		return $tmp;
	}
594632
private function str_slice($str, $start = 0, $end = false)
    {
        if ($end !== FALSE && ($start < 0 || $end <= 0)) {
            $max = strlen($str);

            if ($start < 0) {
                if (($start = $max + $start) < 0) {
                    return '';
                }
            }

            if ($end < 0) {
                if (($end = $max + $end) < 0) {
                    return '';
                }
            }

            if ($end <= $start) {
                return '';
            }
        }

        $slice = ($end === FALSE) ? substr($str, $start) : substr($str, $start, $end - $start);

        return ($slice === FALSE) ? '' : $slice;
    }
918760
function getScriptFolder() {
        $path = self::getScriptPathFull();
        if ( $path === false ) return false;
        // Don't use DIRECTORY_SEPARATOR, PHP makes these forward slashes on Windows
        $pieces = explode('/', $path);
        if ( count($pieces) < 1 ) return false;
        return $pieces[count($pieces)-1];
    }
226749
protected function modifyPath(string $str): string
    {
        return (string) $this->filterSegment($str)->withDirname($this->dirname);
    }
281444
public function normalize($strPath)
    {
        $strPath = $this->fixEncoding($strPath);

        if ($this->_isPharArchive($strPath)) {
            return str_replace('\\', '/', $strPath);
        }

        $n = strlen($strPath);
        $slash = $this->slash;
        $altSlash = $this->altSlash;
        $prev = 0;
        for ($i = 0; $i < $n; $i++) {
            $c = $strPath{$i};
            if ($c === $altSlash) {
                return $this->normalizer($strPath, $n, ($prev === $slash) ? $i - 1 : $i);
            }
            if (($c === $slash) && ($prev === $slash) && ($i > 1)) {
                return $this->normalizer($strPath, $n, $i - 1);
            }
            if (($c === ':') && ($i > 1)) {
                return $this->normalizer($strPath, $n, 0);
            }
            $prev = $c;
        }
        if ($prev === $slash) {
            return $this->normalizer($strPath, $n, $n - 1);
        }

        return $strPath;
    }
431936
public function _slashify($path, $isDirectory)
    {
        $p = (string) $path;

        if (self::$separator !== '/') {
            $p = str_replace(self::$separator, '/', $p);
        }

        if (!StringHelper::startsWith('/', $p)) {
            $p = '/' . $p;
        }

        if (!StringHelper::endsWith('/', $p) && $isDirectory) {
            $p .= '/';
        }

        return $p;
    }
897378
public function getOriginalVendorDir($endingSlash = false)
    {
        if ($endingSlash && null != $this->originalVendorDir) {
            return $this->originalVendorDir . '/';
        }

        return $this->originalVendorDir;
    }
1022957
private function action2path($s)
	{
		$s = preg_replace('#(.)(?=[A-Z])#', '$1-', $s);
		$s = strtolower($s);
		$s = rawurlencode($s);
		return $s;
	}
612399
public function getFullPath()
    {
        return rtrim(
            '' == $this->path ? $this->name : $this->path . DIRECTORY_SEPARATOR . $this->name,
            DIRECTORY_SEPARATOR
        );
    }
868773
public static function slashTerm($path)
    {
        if (Folder::isSlashTerm($path)) {
            return $path;
        }

        return $path . Folder::correctSlashFor($path);
    }