Server : Apache System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64 User : tradze ( 1001) PHP Version : 8.1.34 Disable Function : NONE Directory : /home/tradze/public_html/vendor/laravel/socialite/src/Testing/ |
<?php
namespace Laravel\Socialite\Testing;
use Laravel\Socialite\Contracts\Factory;
class SocialiteFake implements Factory
{
/**
* The original factory instance.
*
* @var \Laravel\Socialite\Contracts\Factory
*/
protected $factory;
/**
* The fake provider instances.
*
* @var array<string, \Laravel\Socialite\Testing\FakeProvider>
*/
protected $providers = [];
/**
* Create a new Socialite fake instance.
*
* @param \Laravel\Socialite\Contracts\Factory $factory
*/
public function __construct($factory)
{
$this->factory = $factory;
}
/**
* Get an OAuth provider implementation.
*
* @param string $driver
* @return \Laravel\Socialite\Contracts\Provider
*/
public function driver($driver = null)
{
return $this->providers[$driver] ?? $this->factory->driver($driver);
}
/**
* Register a fake user for the given driver.
*
* @param string $driver
* @param \Laravel\Socialite\Contracts\User|\Closure|array|null $user
* @return $this
*/
public function fake($driver, $user = null)
{
$resolver = function () use ($driver) {
return $this->factory->driver($driver);
};
$this->providers[$driver] = new FakeProvider($driver, $resolver, $user);
return $this;
}
}