str_ends_with

Supported Versions: PHP 8
Checks if a string ends with a given substring
str_ends_with(string $haystackstring $needle): bool
        [$token$description] = static::extractDescription($token);



        switch (
true) {

            case 
str_ends_with($token'?*'):

                return new 
InputArgument(trim($token'?*'), InputArgument::IS_ARRAY$description);

            case 
str_ends_with($token'*'):

                return new 
InputArgument(trim($token'*'), InputArgument::IS_ARRAY InputArgument::REQUIRED$description);
        switch (true) {

            case 
str_ends_with($token'?*'):

                return new 
InputArgument(trim($token'?*'), InputArgument::IS_ARRAY$description);

            case 
str_ends_with($token'*'):

                return new 
InputArgument(trim($token'*'), InputArgument::IS_ARRAY InputArgument::REQUIRED$description);

            case 
str_ends_with($token'?'):

                return new 
InputArgument(trim($token'?'), InputArgument::OPTIONAL$description);
                return new InputArgument(trim($token'?*'), InputArgument::IS_ARRAY$description);

            case 
str_ends_with($token'*'):

                return new 
InputArgument(trim($token'*'), InputArgument::IS_ARRAY InputArgument::REQUIRED$description);

            case 
str_ends_with($token'?'):

                return new 
InputArgument(trim($token'?'), InputArgument::OPTIONAL$description);

            case 
preg_match('/(.+)\=\*(.+)/'$token$matches):

                return new 
InputArgument($matches[1], InputArgument::IS_ARRAY$descriptionpreg_split('/,\s?/'$matches[2]));
        }



        switch (
true) {

            case 
str_ends_with($token'='):

                return new 
InputOption(trim($token'='), $shortcutInputOption::VALUE_OPTIONAL$description);

            case 
str_ends_with($token'=*'):

                return new 
InputOption(trim($token'=*'), $shortcutInputOption::VALUE_OPTIONAL InputOption::VALUE_IS_ARRAY$description);
        switch (true) {

            case 
str_ends_with($token'='):

                return new 
InputOption(trim($token'='), $shortcutInputOption::VALUE_OPTIONAL$description);

            case 
str_ends_with($token'=*'):

                return new 
InputOption(trim($token'=*'), $shortcutInputOption::VALUE_OPTIONAL InputOption::VALUE_IS_ARRAY$description);

            case 
preg_match('/(.+)\=\*(.+)/'$token$matches):

                return new 
InputOption($matches[1], $shortcutInputOption::VALUE_OPTIONAL InputOption::VALUE_IS_ARRAY$descriptionpreg_split('/,\s?/'$matches[2]));
    protected function guessModelName($name)

    {

        if (
str_ends_with($name'Factory')) {

            
$name substr($name0, -7);

        }
    public function getMigrationFiles($paths)

    {

        return 
Collection::make($paths)->flatMap(function ($path) {

            return 
str_ends_with($path'.php') ? [$path] : $this->files->glob($path.'/*_*.php');

        })->
filter()->values()->keyBy(function ($file) {

            return 
$this->getMigrationName($file);

        })->
sortBy(function ($file$key) {
    {

        
$command 'pg_restore --no-owner --no-acl --clean --if-exists --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --username="${:LARAVEL_LOAD_USER}" --dbname="${:LARAVEL_LOAD_DATABASE}" "${:LARAVEL_LOAD_PATH}"';



        if (
str_ends_with($path'.sql')) {

            
$command 'psql --file="${:LARAVEL_LOAD_PATH}" --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --username="${:LARAVEL_LOAD_USER}" --dbname="${:LARAVEL_LOAD_DATABASE}"';

        }
    public function forgetPushed()

    {

        foreach (
$this->listeners as $key => $value) {

            if (
str_ends_with($key'_pushed')) {

                
$this->forget($key);

            }

        }
    protected function collection()

    {

        return 
$this->option('collection') ||

               
str_ends_with($this->argument('name'), 'Collection');

    }
        if ($this->collects) {

            
$collects $this->collects;

        } elseif (
str_ends_with(class_basename($this), 'Collection') &&

            (
class_exists($class Str::replaceLast('Collection'''get_class($this))) ||

             
class_exists($class Str::replaceLast('Collection''Resource'get_class($this))))) {

            
$collects $class;
    protected function suffixQueue($queue$suffix '')

    {

        if (
str_ends_with($queue'.fifo')) {

            
$queue Str::beforeLast($queue'.fifo');



            return 
rtrim($this->prefix'/').'/'.Str::finish($queue$suffix).'.fifo';
        if (

            ! 
is_null($name)

            && 
str_ends_with($name'.')

            && ! 
is_null($symfonyRoutes->get($name))

        ) {

            
$name null;
            $parameters array_merge($parameters);



            return (! isset(
$parameters[0]) && ! str_ends_with($match[0], '?}'))

                        ? 
$match[0]

                        : 
Arr::pull($parameters0);

        }, 
$path);
                    $escapedArgument .= '^%"'.substr($part1, -1).'"^%';

                } else {


                    if (
str_ends_with($part'\\')) {

                        
$part .= '\\';

                    }

                    
$quote true;