Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
abstractmanager.php
1<?php
2
4
8
9abstract class AbstractManager extends ServiceBase
10{
11 protected int $userId;
12 protected ?ApiService $apiService = null;
13
21 {
22 parent::__construct($connection);
23 $this->userId = $userId;
24 $this->apiService = $this->prepareApiService($connection);
25 }
26
34 {
35 $server = $this->prepareServerData($connection->getServer());
36
37 return new ApiService($server, $this->userId);
38 }
39
43 protected function initServiceName(): string
44 {
46 }
47
53 protected function prepareServerData(Server $server): array
54 {
55 return [
56 'SERVER_SCHEME' => $server->getScheme(),
57 'SERVER_HOST' => $server->getHost(),
58 'SERVER_PORT' => $server->getPort(),
59 'SERVER_USERNAME' => $server->getUserName(),
60 'SERVER_PASSWORD' => $server->getPassword(),
61 ];
62 }
63}
__construct(Connection $connection, int $userId)