1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
businessauthadapter.php
См. документацию.
1<?php
2
4
6use Bitrix\Seo;
12use InvalidArgumentException;
13
15{
17 private $setup;
18
20 private $config;
21
23 private $installs;
24
25 public function getAuthUrl()
26 {
27 $serviceUrl = (new Retargeting\ProxyRequest())->getServiceUrl(Seo\Service::SERVICE_URL);
28
30 {
31 try
32 {
33 Seo\Service::register($serviceUrl);
34 }
35 catch (SystemException $e)
36 {
37 return '';
38 }
39 }
40
41 $authorizeUrl = (new Retargeting\ProxyRequest())->getServiceUrl(Seo\Service::getAuthorizeLink());
42
43 $authorizeData = Seo\Service::getAuthorizeData(
44 $this->getEngineCode(),
46 );
47 $uri = new Uri($authorizeUrl);
48 if(!empty($this->parameters['URL_PARAMETERS']))
49 {
50 $authorizeData['urlParameters'] = $this->parameters['URL_PARAMETERS'];
51 }
52 if($this->setup && $this->config)
53 {
54 $authorizeData['settings'] = Json::encode([
55 'setup' => $this->setup->toArray() + ($this->installs? $this->installs->toArray() : []),
56 'business_config' => $this->config->toArray(),
57 'repeat' => false
58 ]);
59 }
60
61 $uri->addParams($authorizeData);
62 return $uri->getLocator();
63 }
64
70 public function setSetup(IAuthSettings $setup = null): self
71 {
72 if($setup instanceof Facebook\Setup)
73 {
74 $this->setup = $setup;
75 return $this;
76 }
77 throw new InvalidArgumentException("Argument is not instance of Facebook/Setup");
78 }
79
85 public function setConfig(IAuthSettings $config = null): self
86 {
87 if($config instanceof Facebook\Config)
88 {
89 $this->config = $config;
90 return $this;
91 }
92 throw new InvalidArgumentException("Argument is not instance of Facebook/Config");
93 }
94
95 public function setInstalls(?IAuthSettings $installs) : self
96 {
97 if($installs instanceof Facebook\Installs)
98 {
99 $this->installs = $installs;
100 return $this;
101 }
102 throw new InvalidArgumentException("Argument is not instance of Facebook/Installs");
103 }
104}
Определения json.php:9
Определения uri.php:17
static getAuthorizeLink()
Определения service.php:370
static register(string $serviceUrl='')
Определения service.php:318
static isRegistered()
Определения service.php:65
const SERVICE_URL
Определения service.php:40
static getAuthorizeData($engine, $clientType=false)
Определения service.php:381
const CLIENT_TYPE_SINGLE
Определения service.php:53
const CLIENT_TYPE_MULTIPLE
Определения service.php:54
if(file_exists($_SERVER['DOCUMENT_ROOT'] . "/urlrewrite.php")) $uri
Определения urlrewrite.php:61