Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Strip whitespace (or other characters) from the end of a string
Alias chop
<?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('/'));