Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
service.php
1<?php
2
3namespace Bitrix\Seo\Catalog;
4
8
9final class Service implements IService, IInternalService
10{
12 private static $authAdapterPool = [];
13
14 public const GROUP = 'catalog';
15
16 public const TYPE_FACEBOOK = 'facebook';
17
18
19 private function __construct()
20 {}
21
22 private function __clone()
23 {}
24
28 public static function getInstance(): Service
29 {
30 static $instance;
31 return $instance = $instance ?? new Service;
32 }
33
37 public static function getTypeByEngine(string $engineCode): ?string
38 {
39 foreach (self::getTypes() as $type)
40 {
41 if($engineCode === self::getEngineCode($type))
42 {
43 return $type;
44 }
45 }
46 return null;
47 }
48
52 public static function canUseAsInternal(): bool
53 {
54 return true;
55 }
56
60 public static function getMethodPrefix(): string
61 {
62 return self::GROUP;
63 }
64
68 public static function getEngineCode($type) : string
69 {
70 return self::GROUP . '.' . $type;
71 }
72
76 public static function getTypes() : array
77 {
78 return [ self::TYPE_FACEBOOK ];
79 }
80
85 public static function getAuthAdapter($type) : AuthAdapter
86 {
87 if (!array_key_exists( $type, self::$authAdapterPool ))
88 {
89 return self::$authAdapterPool[$type] = AuthAdapter::create($type)->setService(self::getInstance());
90 }
91 return self::$authAdapterPool[$type];
92 }
93
99 public function getCatalog(string $type): Catalog
100 {
101 return Catalog::create($type)->setService($this);
102 }
103}
create()
static getEngineCode($type)
Definition service.php:68
static getTypeByEngine(string $engineCode)
Definition service.php:37
getCatalog(string $type)
Definition service.php:99
static getAuthAdapter($type)
Definition service.php:85