Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Strip whitespace (or other characters) from the end of a string
<?php rtrim(string $string, string $characters = " \n\r\t\v\x00"): string
<?php return $file;
}
$cwd = rtrim($cwd, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
return preg_replace('/^' . preg_quote($cwd, '/') . '/', '', $file);
}
<?php $classPath = static::generatePathFromNamespace($classNamespace);
$testPath = static::generateTestPathFromNamespace($this->baseTestNamespace);
$this->baseClassPath = rtrim($classPath, DIRECTORY_SEPARATOR).'/';
$this->baseViewPath = rtrim($viewPath, DIRECTORY_SEPARATOR).'/';
$this->baseTestPath = rtrim($testPath, DIRECTORY_SEPARATOR).'/';
<?php $testPath = static::generateTestPathFromNamespace($this->baseTestNamespace);
$this->baseClassPath = rtrim($classPath, DIRECTORY_SEPARATOR).'/';
$this->baseViewPath = rtrim($viewPath, DIRECTORY_SEPARATOR).'/';
$this->baseTestPath = rtrim($testPath, DIRECTORY_SEPARATOR).'/';
if(! empty($stubSubDirectory) && str($stubSubDirectory)->startsWith('..')) {
<?php $this->baseClassPath = rtrim($classPath, DIRECTORY_SEPARATOR).'/';
$this->baseViewPath = rtrim($viewPath, DIRECTORY_SEPARATOR).'/';
$this->baseTestPath = rtrim($testPath, DIRECTORY_SEPARATOR).'/';
if(! empty($stubSubDirectory) && str($stubSubDirectory)->startsWith('..')) {
$this->stubDirectory = rtrim(str($stubSubDirectory)->replaceFirst('..' . DIRECTORY_SEPARATOR, ''), DIRECTORY_SEPARATOR).'/';
<?php $this->baseTestPath = rtrim($testPath, DIRECTORY_SEPARATOR).'/';
if(! empty($stubSubDirectory) && str($stubSubDirectory)->startsWith('..')) {
$this->stubDirectory = rtrim(str($stubSubDirectory)->replaceFirst('..' . DIRECTORY_SEPARATOR, ''), DIRECTORY_SEPARATOR).'/';
} else {
$this->stubDirectory = rtrim('stubs'.DIRECTORY_SEPARATOR.$stubSubDirectory, DIRECTORY_SEPARATOR).'/';
}
<?php if(! empty($stubSubDirectory) && str($stubSubDirectory)->startsWith('..')) {
$this->stubDirectory = rtrim(str($stubSubDirectory)->replaceFirst('..' . DIRECTORY_SEPARATOR, ''), DIRECTORY_SEPARATOR).'/';
} else {
$this->stubDirectory = rtrim('stubs'.DIRECTORY_SEPARATOR.$stubSubDirectory, DIRECTORY_SEPARATOR).'/';
}
$directories = preg_split('/[.\/(\\\\)]+/', $rawCommand);
<?php $stubName = 'livewire.layout.stub';
if (! empty($stubSubDirectory) && str($stubSubDirectory)->startsWith('..')) {
$stubDirectory = rtrim(str($stubSubDirectory)->replaceFirst('..' . DIRECTORY_SEPARATOR, ''), DIRECTORY_SEPARATOR) . '/';
} else {
$stubDirectory = rtrim('stubs' . DIRECTORY_SEPARATOR . $stubSubDirectory, DIRECTORY_SEPARATOR) . '/';
}
<?php if (! empty($stubSubDirectory) && str($stubSubDirectory)->startsWith('..')) {
$stubDirectory = rtrim(str($stubSubDirectory)->replaceFirst('..' . DIRECTORY_SEPARATOR, ''), DIRECTORY_SEPARATOR) . '/';
} else {
$stubDirectory = rtrim('stubs' . DIRECTORY_SEPARATOR . $stubSubDirectory, DIRECTORY_SEPARATOR) . '/';
}
if (File::exists($stubPath = base_path($stubDirectory . $stubName))) {
<?php foreach($keys[1] ?? [] as $key) {
$replacement .= '$this->' . $key . ', ';
}
$replacement = rtrim($replacement, ', ');
$replacement .= ');';
}
<?php {
$found = rtrim($found);
$foundEscaped = preg_quote($found, '/');
<?php $url = $options['url'] ?? $url;
$url = rtrim($url, '/');
$url = (string) str($url)->when(! str($url)->isUrl(), fn($url) => $url->start('/'));
<?php $string = $messages;
}
return strlen($string) - strlen(rtrim($string, PHP_EOL));
}
<?php $relativeTarget = (new SymfonyFilesystem)->makePathRelative($target, dirname($link));
$this->link($this->isFile($target) ? rtrim($relativeTarget, '/') : $relativeTarget, $link);
}
<?php protected function concatPathToUrl($url, $path)
{
return rtrim($url, '/').'/'.ltrim($path, '/');
}
<?php public static function setFacadeNamespace($namespace)
{
static::$facadeNamespace = rtrim($namespace, '\\').'\\';
}