Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
base.php
1<?php
2
4
9
10abstract class Base
11{
15 protected \CSocServAuth $oauthClient;
16
20 protected string $serviceName;
21
26 public static function getInstance(): ?static
27 {
28 if (!Loader::includeModule('socialservices'))
29 {
30 return null;
31 }
32
33 if (!$userId = \CCalendar::GetCurUserId())
34 {
35 return null;
36 }
37
38 $className = static::class;
39
40 $instance = new $className($userId);
41
42 if (!$instance->checkService())
43 {
44 return null;
45 }
46
47 $instance->serviceName = $className::getServiceName();
48
49 return $instance;
50 }
51
55 abstract protected function __construct($userId);
56
60 abstract public function getUrl(): string;
61
65 abstract protected function checkService(): bool;
66
67
71 abstract public static function getServiceName(): string;
72}