cfmgrv4/app/Libraries/MySocket/GoogleSocket/GoogleSocket.php
2024-10-10 20:23:32 +09:00

42 lines
1.0 KiB
PHP

<?php
namespace App\Libraries\MySocket\GoogleSocket;
use App\Entities\UserSNSEntity;
use App\Libraries\MySocket\MySocket;
use App\Models\UserSNSModel;
use Config\Services;
abstract class GoogleSocket extends MySocket
{
private string $_site = "GOOGLE";
private ?UserSNSModel $_model = null;
protected $_client = null;
protected $session;
protected string $_access_token = "";
protected string $_token_name = "access_token";
public function __construct()
{
$this->session = Services::session();
}
abstract public function getClient(): mixed;
abstract public function createAuthUrl(): string;
abstract public function setToken(string $access_code): void;
abstract public function getUserSNSEntity(): UserSNSEntity;
final public function getToken(): string
{
return $this->session->get($this->_token_name);
}
final public function getSite(): string
{
return $this->_site;
}
final protected function getModel(): UserSNSModel
{
if ($this->_model === null) {
$this->_model = model(UserSNSModel::class);
}
return $this->_model;
}
}