Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
PartnerInfoRequestBuilder.php
1
<?php
2
3
namespace
Bitrix\Main\UpdateSystem
;
4
5
use
Bitrix\Main\Application
;
6
use
Bitrix\Main\License
;
7
use
Bitrix\Main\Web\HttpHeaders
;
8
use
Bitrix\Main\Web\Uri
;
9
10
class
PartnerInfoRequestBuilder
implements
RequestBuilderInterface
11
{
12
private
Request
$request;
13
private
License
$license;
14
private
string
$name;
15
private
string
$phone;
16
private
string
$email;
17
18
public
function
__construct
(
string
$name,
string
$phone,
string
$email)
19
{
20
$this->name = $name;
21
$this->email = $email;
22
$this->phone = $phone;
23
$this->request =
new
Request
;
24
$this->license =
Application::getInstance
()->getLicense();
25
}
26
27
public
function
setHeaders
(): self
28
{
29
$headers =
new
HttpHeaders
();
30
$this->request->setHeaders($headers);
31
32
return
$this;
33
}
34
35
public
function
setUrl
(): self
36
{
37
$url =
new
Uri
($this->license->getDomainStoreLicense() .
'/key_update.php'
);
38
$this->request->setUrl($url);
39
40
return
$this;
41
}
42
43
public
function
setProxy
(): self
44
{
45
$proxyData = [
46
'host'
=> \COption::GetOptionString(
"main"
,
"update_site_proxy_addr"
,
""
),
47
'port'
=> \COption::GetOptionString(
"main"
,
"update_site_proxy_port"
,
""
),
48
'user'
=> \COption::GetOptionString(
"main"
,
"update_site_proxy_user"
,
""
),
49
'password'
=> \COption::GetOptionString(
"main"
,
"update_site_proxy_pass"
,
""
),
50
];
51
52
$this->request->setProxy($proxyData);
53
54
return
$this;
55
}
56
57
public
function
setBody
(): self
58
{
59
$portalInfo =
new
PortalInfo
();
60
$parameters = [
61
'action'
=>
'send_partner_info'
,
62
'license_key'
=> $this->license->getHashLicenseKey(),
63
'partner_id'
=> $this->license->getPartnerId(),
64
'phone'
=> $this->phone,
65
'email'
=> $this->email,
66
'name'
=> $this->name,
67
'site'
=> $_SERVER[
'HTTP_HOST'
],
68
];
69
70
$this->request->setBody($parameters);
71
72
return
$this;
73
}
74
75
public
function
build
():
Request
76
{
77
return
$this->request;
78
}
79
}
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getInstance
static getInstance()
Definition
application.php:95
Bitrix\Main\License
Definition
license.php:1
Bitrix\Main\UpdateSystem\PartnerInfoRequestBuilder
Definition
PartnerInfoRequestBuilder.php:11
Bitrix\Main\UpdateSystem\PartnerInfoRequestBuilder\build
build()
Definition
PartnerInfoRequestBuilder.php:75
Bitrix\Main\UpdateSystem\PartnerInfoRequestBuilder\__construct
__construct(string $name, string $phone, string $email)
Definition
PartnerInfoRequestBuilder.php:18
Bitrix\Main\UpdateSystem\PartnerInfoRequestBuilder\setBody
setBody()
Definition
PartnerInfoRequestBuilder.php:57
Bitrix\Main\UpdateSystem\PartnerInfoRequestBuilder\setUrl
setUrl()
Definition
PartnerInfoRequestBuilder.php:35
Bitrix\Main\UpdateSystem\PartnerInfoRequestBuilder\setHeaders
setHeaders()
Definition
PartnerInfoRequestBuilder.php:27
Bitrix\Main\UpdateSystem\PartnerInfoRequestBuilder\setProxy
setProxy()
Definition
PartnerInfoRequestBuilder.php:43
Bitrix\Main\UpdateSystem\PortalInfo
Definition
PortalInfo.php:1
Bitrix\Main\UpdateSystem\Request
Definition
Request.php:11
Bitrix\Main\Web\HttpHeaders
Definition
httpheaders.php:18
Bitrix\Main\Web\Uri
Definition
uri.php:17
Bitrix\Main\UpdateSystem\RequestBuilderInterface
Definition
RequestBuilderInterface.php:5
Bitrix\Main\UpdateSystem
Definition
ActivationSystem.php:1
modules
main
lib
UpdateSystem
PartnerInfoRequestBuilder.php
Создано системой
1.10.0