class_basename

The class_basename function returns the class name of the given class with the class's namespace removed:
<?php $class = class_basename('Foo\Bar\Baz');
<?php     function callTraitHook($name, $params = [])

    {

        foreach (class_uses_recursive($this->component) as $trait) {

            $method = $name.class_basename($trait);



            if (method_exists($this->component, $method)) {

                wrap($this->component)->$method(...$params);
<?php         return $this->queryString = collect(class_uses_recursive($class = $component::class))

            ->map(function ($trait) use ($class, $component) {

                $member = 'queryString' . class_basename($trait);



                if (method_exists($class, $member)) {

                    return invade($component)->{$member}();
<?php         return Arr::wrap(Collection::times(count($classDirnameSegments), function ($index) use ($class, $classDirnameSegments) {

            $classDirname = implode('\\', array_slice($classDirnameSegments, 0, $index));



            return $classDirname.'\\Policies\\'.class_basename($class).'Policy';

        })->reverse()->values()->first(function ($class) {

            return class_exists($class);

        }) ?: [$classDirname.'\\Policies\\'.class_basename($class).'Policy']);
<?php             return $classDirname.'\\Policies\\'.class_basename($class).'Policy';

        })->reverse()->values()->first(function ($class) {

            return class_exists($class);

        }) ?: [$classDirname.'\\Policies\\'.class_basename($class).'Policy']);

    }
<?php     public function broadcastAs(): string

    {

        return $this->name ?: class_basename($this);

    }
<?php             if (! is_array($result)) {

                throw new UnexpectedValueException(sprintf(

                    "%s::reduceSpread expects reducer to return an array, but got a '%s' instead.",

                    class_basename(static::class), gettype($result)

                ));

            }

        }
<?php     protected function buildClass($name)

    {

        $factory = class_basename(Str::ucfirst(str_replace('Factory', '', $name)));



        $namespaceModel = $this->option('model')

                        ? $this->qualifyModel($this->option('model'))
<?php                         ? $this->qualifyModel($this->option('model'))

                        : $this->qualifyModel($this->guessModelName($name));



        $model = class_basename($namespaceModel);



        $namespace = $this->getNamespace(

            Str::replaceFirst($this->rootNamespace(), 'Database\\Factories\\', $this->qualifyClass($this->getNameInput()))
<?php     public function broadcastAs()

    {

        $default = class_basename($this->model).ucfirst($this->event);



        return method_exists($this->model, 'broadcastAs')

                ? ($this->model->broadcastAs($this->event) ?: $default)
<?php         $segments = [

            $instance ? $instance->joiningTableSegment()

                      : Str::snake(class_basename($related)),

            $this->joiningTableSegment(),

        ];
<?php     public function joiningTableSegment()

    {

        return Str::snake(class_basename($this));

    }
<?php         }



        if ($relationshipName === null) {

            $relationshipName = Str::camel(class_basename($related));

        }



        try {
<?php     protected function guessRelationship(string $related)

    {

        $guess = Str::camel(Str::plural(class_basename($related)));



        return method_exists($this->modelName(), $guess) ? $guess : Str::singular($guess);

    }
<?php             'has' => $this->has->concat([new BelongsToManyRelationship(

                $factory,

                $pivot,

                $relationship ?? Str::camel(Str::plural(class_basename(

                    $factory instanceof Factory

                        ? $factory->modelName()

                        : Collection::wrap($factory)->first()

                )))

            )]),

        ]);

    }
<?php     {

        return $this->newInstance(['for' => $this->for->concat([new BelongsToRelationship(

            $factory,

            $relationship ?? Str::camel(class_basename(

                $factory instanceof Factory ? $factory->modelName() : $factory

            ))

        )])]);

    }