Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Finds whether a variable is an object
is_object(mixed $value): bool
    public function getPolicyFor($class)

    {

        if (
is_object($class)) {

            
$class get_class($class);

        }
    public function queue($event)

    {

        if (
$event instanceof ShouldBroadcastNow ||

            (
is_object($event) &&

             
method_exists($event'shouldBroadcastNow') &&

             
$event->shouldBroadcastNow())) {

            return 
$this->app->make(BusDispatcherContract::class)->dispatchNow(new BroadcastEvent(clone $event));
            } else {

                
$itemKey data_get($item$key);



                if (
is_object($itemKey) && method_exists($itemKey'__toString')) {

                    
$itemKey = (string) $itemKey;

                }
        foreach ($this->items as $key => $item) {

            
$resolvedKey $keyBy($item$key);



            if (
is_object($resolvedKey)) {

                
$resolvedKey = (string) $resolvedKey;

            }
        $first $this->first();



        if (
is_array($first) || (is_object($first) && ! $first instanceof Stringable)) {

            return 
implode($glue ?? ''$this->pluck($value)->all());

        }
            if (Arr::accessible($target) && Arr::exists($target$segment)) {

                
$target $target[$segment];

            } elseif (
is_object($target) && isset($target->{$segment})) {

                
$target $target->{$segment};

            } else {

                return 
value($default);
            } elseif ($overwrite || ! Arr::exists($target$segment)) {

                
$target[$segment] = $value;

            }

        } elseif (
is_object($target)) {

            if (
$segments) {

                if (! isset(
$target->{$segment})) {

                    
$target->{$segment} = [];
            foreach ($this as $key => $item) {

                
$resolvedKey $keyBy($item$key);



                if (
is_object($resolvedKey)) {

                    
$resolvedKey = (string) $resolvedKey;

                }
                } else {

                    
$itemKey data_get($item$key);



                    if (
is_object($itemKey) && method_exists($itemKey'__toString')) {

                        
$itemKey = (string) $itemKey;

                    }
            $retrieved data_get($item$key);



            
$strings array_filter([$retrieved$value], function ($value) {

                return 
is_string($value) || (is_object($value) && method_exists($value'__toString'));

            });



            if (
count($strings) < && count(array_filter([$retrieved$value], 'is_object')) == 1) {
    protected function execute($container)

    {

        try {

            
$this->result is_object($this->callback)

                ? 
$container->call([$this->callback'__invoke'], $this->parameters)

                : 
$container->call($this->callback$this->parameters);
    {

        if (
is_string($callback) && str_contains($callback'::')) {

            
$callback explode('::'$callback);

        } elseif (
is_object($callback) && ! $callback instanceof Closure) {

            
$callback = [$callback'__invoke'];

        }
            return $value;

        }, 
$value$this->attributes);



        if (
$attribute->withCaching || (is_object($value) && $attribute->withObjectCaching)) {

            
$this->attributeCastCache[$key] = $value;

        } else {

            unset(
$this->attributeCastCache[$key]);
                $value

                
$caster->get($this$key$value$this->attributes);



            if (
$caster instanceof CastsInboundAttributes || ! is_object($value)) {

                unset(
$this->classCastCache[$key]);

            } else {

                
$this->classCastCache[$key] = $value;
            )

        );



        if (
$attribute->withCaching || (is_object($value) && $attribute->withObjectCaching)) {

            
$this->attributeCastCache[$key] = $value;

        } else {

            unset(
$this->attributeCastCache[$key]);