trim

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Strip whitespace (or other characters) from the beginning and end of a string
<?php trim(string $string, string $characters = " \n\r\t\v\x00"): string
<?php         $disk = Arr::pull($options, 'disk') ?: $this->disk;



        $newPath = trim($path.'/'.$name, '/');



        Storage::disk($disk)->put(

            $newPath, $this->storage->readStream($this->path), $options
<?php             if (is_subclass_of($component, Component::class)) {

                $component = app(ComponentRegistry::class)->getName($component);

            }

            $escapedComponentName = trim(htmlspecialchars(json_encode(['name' => $component])), '{}');



            \PHPUnit\Framework\Assert::assertStringContainsString(

                $escapedComponentName,
<?php             if (is_subclass_of($component, Component::class)) {

                $component = app(ComponentRegistry::class)->getName($component);

            }

            $escapedComponentName = trim(htmlspecialchars(json_encode(['name' => $component])), '{}');



            \PHPUnit\Framework\Assert::assertStringNotContainsString(

                $escapedComponentName,
<?php                 if (is_subclass_of($component, Component::class)) {

                    $component = app(ComponentRegistry::class)->getName($component);

                }

                $escapedComponentName = trim(htmlspecialchars(json_encode(['name' => $component])), '{}');



                \PHPUnit\Framework\Assert::assertStringContainsString(

                    $escapedComponentName,
<?php                 if (is_subclass_of($component, Component::class)) {

                    $component = app(ComponentRegistry::class)->getName($component);

                }

                $escapedComponentName = trim(htmlspecialchars(json_encode(['name' => $component])), '{}');



                \PHPUnit\Framework\Assert::assertStringNotContainsString(

                    $escapedComponentName,
<?php         $namespace = str_replace(

            ['/', '\\'],

            '.',

            trim(trim(config('livewire.class_namespace')), '\\')

        );



        $class = str_replace(
<?php         $class = str_replace(

            ['/', '\\'],

            '.',

            trim(trim($class, '/'), '\\')

        );



        $namespace = collect(explode('.', $namespace))
<?php         $pattern = "/,\s*?key\(([\s\S]*)\)/"; // everything between ",key(" and ")"



        $expression = preg_replace_callback($pattern, function ($match) use (&$key) {

            $key = trim($match[1]) ?: $key;

            return "";

        }, $expression);
<?php     protected function getModel($request, $model)

    {

        if ($this->isClassName($model)) {

            return trim($model);

        }



        return $request->route($model, null) ??
<?php         }



        return $request->route($model, null) ??

            ((preg_match("/^['\"](.*)['\"]$/", trim($model), $matches)) ? $matches[1] : null);

    }
<?php     {

        $segments = explode('|', $this->recaller);



        return count($segments) >= 3 && trim($segments[0]) !== '' && trim($segments[1]) !== '';

    }
<?php         }



        return $this->qualifyClass(

            $this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name

        );

    }
<?php     protected function getNamespace($name)

    {

        return trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\');

    }
<?php     protected function sortImports($stub)

    {

        if (preg_match('/(?P<imports>(?:^use [^;{]+;$\n?)+)/m', $stub, $match)) {

            $imports = explode("\n", trim($match['imports']));



            sort($imports);
<?php             sort($imports);



            return str_replace(trim($match['imports']), implode("\n", $imports), $stub);

        }



        return $stub;