protected function setupCallbacks(Client $client, Container $app, array $config)
    {
        if (!isset($config['callbacks']) || $config['callbacks']) {
            $client->registerDefaultCallbacks();

            $client->registerCallback(function (Report $report) use ($app) {
                $tracker = $app->make(Tracker::class);

                if ($context = $tracker->context()) {
                    $report->setContext($context);
                }

                if ($job = $tracker->get()) {
                    $report->setMetaData(['job' => $job]);
                }
            });
        }

        if (!isset($config['user']) || $config['user']) {
            $client->registerCallback(new CustomUser(function () use ($app) {
                if ($user = $app->auth->user()) {
                    if (method_exists($user, 'attributesToArray') && is_callable([$user, 'attributesToArray'])) {
                        return $user->attributesToArray();
                    }

                    if ($user instanceof GenericUser) {
                        $reflection = new ReflectionClass($user);
                        $property = $reflection->getProperty('attributes');
                        $property->setAccessible(true);

                        return $property->getValue($user);
                    }
                }
            }));
        }
    }
protected function setupCallbacks(Client $client, Container $app, array $config)
    {
        if (!isset($config['callbacks']) || $config['callbacks']) {
            $client->registerDefaultCallbacks();

            $client->registerCallback(function (Report $report) use ($app) {
                $tracker = $app->make(Tracker::class);

                if ($context = $tracker->context()) {
                    $report->setContext($context);
                }

                if ($job = $tracker->get()) {
                    $report->setMetaData(['job' => $job]);
                }
            });
        }

        if (!isset($config['user']) || $config['user']) {
            $client->registerCallback(new CustomUser(function () use ($app) {
                if ($user = $app->auth->user()) {
                    if (method_exists($user, 'attributesToArray') && is_callable([$user, 'attributesToArray'])) {
                        return $user->attributesToArray();
                    }

                    if ($user instanceof GenericUser) {
                        $reflection = new ReflectionClass($user);
                        $property = $reflection->getProperty('attributes');
                        $property->setAccessible(true);

                        return $property->getValue($user);
                    }
                }
            }));
        }
    }
protected function setupCallbacks ( Client $ client , Container $ app , array $ config ) { if ( ! isset ( $ config [ 'callbacks' ] ) || $ config [ 'callbacks' ] ) { $ client -> registerDefaultCallbacks ( ) ; $ client -> registerCallback ( function ( Report $ report ) use ( $ app ) { $ tracker = $ app -> make ( Tracker :: class ) ; if ( $ context = $ tracker -> context ( ) ) { $ report -> setContext ( $ context ) ; } if ( $ job = $ tracker -> get ( ) ) { $ report -> setMetaData ( [ 'job' => $ job ] ) ; } } ) ; } if ( ! isset ( $ config [ 'user' ] ) || $ config [ 'user' ] ) { $ client -> registerCallback ( new CustomUser ( function ( ) use ( $ app ) { if ( $ user = $ app -> auth -> user ( ) ) { if ( method_exists ( $ user , 'attributesToArray' ) && is_callable ( [ $ user , 'attributesToArray' ] ) ) { return $ user -> attributesToArray ( ) ; } if ( $ user instanceof GenericUser ) { $ reflection = new ReflectionClass ( $ user ) ; $ property = $ reflection -> getProperty ( 'attributes' ) ; $ property -> setAccessible ( true ) ; return $ property -> getValue ( $ user ) ; } } } ) ) ; } }
Setup the callbacks.

@param \Bugsnag\Client                           $client
@param \Illuminate\Contracts\Container\Container $app
@param array                                     $config

@return void
Setup the callbacks .