public static function fixSlashes($str, $removeInitial = false, $removeTrailing = false)
    {
        $r = str_replace('//', '/', $str);

        if (\strlen($r) > 0) {
            if ($removeInitial && ($r[0] === '/')) {
                $r = substr($r, 1);
            }

            if ($removeTrailing && ($r[\strlen($r) - 1] === '/')) {
                $r = substr($r, 0, \strlen($r) - 1);
            }
        }

        return $r;
    }
public static function fixSlashes($str, $removeInitial = false, $removeTrailing = false)
    {
        $r = str_replace('//', '/', $str);

        if (\strlen($r) > 0) {
            if ($removeInitial && ($r[0] === '/')) {
                $r = substr($r, 1);
            }

            if ($removeTrailing && ($r[\strlen($r) - 1] === '/')) {
                $r = substr($r, 0, \strlen($r) - 1);
            }
        }

        return $r;
    }
public static function fixSlashes ( $ str , $ removeInitial = false , $ removeTrailing = false ) { $ r = str_replace ( '//' , '/' , $ str ) ; if ( \ strlen ( $ r ) > 0 ) { if ( $ removeInitial && ( $ r [ 0 ] === '/' ) ) { $ r = substr ( $ r , 1 ) ; } if ( $ removeTrailing && ( $ r [ \ strlen ( $ r ) - 1 ] === '/' ) ) { $ r = substr ( $ r , 0 , \ strlen ( $ r ) - 1 ) ; } } return $ r ; }
Fixes slashes in path

@param string $str
@param bool|false $removeInitial
@param bool|false $removeTrailing

@return mixed|string
Fixes slashes in path