Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Find whether the type of a variable is string
<?php is_string(mixed $value): bool
<?php             case $config === false:

            case $class === false:

                return false;

            case is_string($class):

                return $class;

            default:

                return DefaultCacher::class;
<?php         return $this

            ->fluentlyGetOrSet('container')

            ->setter(function ($container) {

                return is_string($container) ? AssetContainerAPI::find($container) : $container;

            })

            ->args(func_get_args());

    }
<?php     protected function permission($permission)

    {

        if (is_string($permission)) {

            $permission = Permission::make($permission);

        }
<?php     public function assignRole($role)

    {

        $roles = collect(array_wrap($role))->map(function ($role) {

            return is_string($role) ? Role::find($role) : $role;

        })->filter();



        $this->roles = $this->roles ?? collect();
<?php     public function removeRole($role)

    {

        $roles = collect(array_wrap($role))->map(function ($role) {

            return is_string($role) ? Role::find($role) : $role;

        })->filter();



        $roles->each(function ($role) {
<?php     public function hasRole($role)

    {

        return $this->roles()->has(

            is_string($role) ? $role : $role->handle()

        );

    }
<?php     public function addToGroup($group)

    {

        $groups = collect(array_wrap($group))->map(function ($group) {

            return is_string($group) ? UserGroup::find($group) : $group;

        })->filter();



        $this->groups = $this->groups ?? collect();
<?php     public function removeFromGroup($group)

    {

        $groups = collect(array_wrap($group))->map(function ($group) {

            return is_string($group) ? UserGroup::find($group) : $group;

        })->filter();



        $groups->each(function ($group) {
<?php     public function isInGroup($group)

    {

        return $this->groups()->has(

            is_string($group) ? $group : $group->handle()

        );

    }
<?php             return [];

        }



        return is_string($preferences) ? json_decode($preferences, true) : $preferences;

    }



    public function setPreferences($preferences)
<?php     public function assignRole($role)

    {

        $roles = collect(array_wrap($role))->map(function ($role) {

            return is_string($role) ? $role : $role->handle();

        })->all();



        $this->set('roles', array_merge($this->get('roles', []), $roles));
<?php     public function removeRole($role)

    {

        $toBeRemoved = collect(array_wrap($role))->map(function ($role) {

            return is_string($role) ? $role : $role->handle();

        });



        $roles = collect($this->get('roles', []))
<?php     public function addToGroup($group)

    {

        $groups = collect(array_wrap($group))->map(function ($group) {

            return is_string($group) ? $group : $group->handle();

        })->all();



        $this->set('groups', array_merge($this->get('groups', []), $groups));
<?php     public function removeFromGroup($group)

    {

        $toBeRemoved = collect(array_wrap($group))->map(function ($group) {

            return is_string($group) ? $group : $group->handle();

        });



        $groups = collect($this->get('groups', []))
<?php     public function assignRole($role)

    {

        if (is_string($role)) {

            $role = RoleAPI::find($role);

        }