Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
entity.php
1
<?php
2
3
namespace
Bitrix\Sale\TradingPlatform\Ebay\Api
;
4
5
use
Bitrix\Main\Localization\Loc
;
6
use
Bitrix\Main\SystemException
;
7
use
Bitrix\Main\ArgumentNullException
;
8
9
Loc::loadMessages
(__FILE__);
10
11
abstract
class
Entity
12
{
13
protected
$siteId
;
14
protected
$apiCaller
;
15
protected
$authToken
;
16
protected
$ebaySiteId
;
17
protected
$warningLevel
=
"High"
;
18
19
public
function
__construct
(
$siteId
)
20
{
21
if
(!isset(
$siteId
))
22
throw
new
ArgumentNullException
(
"siteId"
);
23
24
$this->siteId =
$siteId
;
25
$ebay = \Bitrix\Sale\TradingPlatform\Ebay\Ebay::getInstance();
26
$settings = $ebay->getSettings();
27
28
if
(empty($settings[
$siteId
][
"API"
][
"SITE_ID"
]))
29
throw
new
SystemException
(
Loc::getMessage
(
'SALE_EBAY_ENTITY_SETTINGS_EMPTY'
, array(
'#SITE_ID#'
=>
$siteId
)));
30
31
if
(empty($settings[
$siteId
][
"API"
][
"SITE_ID"
]))
32
throw
new
ArgumentNullException
(
Loc::getMessage
(
'SALE_EBAY_ENTITY_TOKEN_EMPTY'
, array(
'#SITE_ID#'
=>
$siteId
)));
33
34
$this->ebaySiteId = $settings[
$siteId
][
"API"
][
"SITE_ID"
];
35
$this->authToken = $settings[
$siteId
][
"API"
][
"AUTH_TOKEN"
];
36
$this->apiCaller =
new
Caller
( array(
37
"EBAY_SITE_ID"
=> $settings[
$siteId
][
"API"
][
"SITE_ID"
],
38
"URL"
=> $ebay->getApiUrl(),
39
));
40
}
41
42
protected
function
array2Tags
(array $params)
43
{
44
$result =
""
;
45
46
foreach
($params as $tag => $value)
47
{
48
if
(is_array($value))
49
{
50
reset($value);
51
52
if
(key($value) !== 0)
53
{
54
$result .= $this->
array2Tags
($value);
55
}
56
else
57
{
58
foreach
($value as $val)
59
{
60
$result .=
'<'
.$tag.
'>'
.$val.
'</'
.$tag.
'>'
.
"\n"
;
61
}
62
}
63
}
64
elseif($value <>
''
)
65
{
66
$result .=
'<'
.$tag.
'>'
.$value.
'</'
.$tag.
'>'
.
"\n"
;
67
}
68
}
69
70
return
$result;
71
}
72
}
Bitrix\Main\ArgumentNullException
Definition
exception.php:54
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\SystemException
Definition
exception.php:8
Bitrix\Sale\TradingPlatform\Ebay\Api\Caller
Definition
caller.php:11
Bitrix\Sale\TradingPlatform\Ebay\Api\Entity
Definition
entity.php:12
Bitrix\Sale\TradingPlatform\Ebay\Api\Entity\__construct
__construct($siteId)
Definition
entity.php:19
Bitrix\Sale\TradingPlatform\Ebay\Api\Entity\$authToken
$authToken
Definition
entity.php:15
Bitrix\Sale\TradingPlatform\Ebay\Api\Entity\$ebaySiteId
$ebaySiteId
Definition
entity.php:16
Bitrix\Sale\TradingPlatform\Ebay\Api\Entity\$siteId
$siteId
Definition
entity.php:13
Bitrix\Sale\TradingPlatform\Ebay\Api\Entity\$apiCaller
$apiCaller
Definition
entity.php:14
Bitrix\Sale\TradingPlatform\Ebay\Api\Entity\array2Tags
array2Tags(array $params)
Definition
entity.php:42
Bitrix\Sale\TradingPlatform\Ebay\Api\Entity\$warningLevel
$warningLevel
Definition
entity.php:17
Bitrix\Sale\TradingPlatform\Ebay\Api
Definition
caller.php:3
modules
sale
lib
tradingplatform
ebay
api
entity.php
Создано системой
1.10.0