1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
formatservice.php
См. документацию.
1<?php
2
3namespace Bitrix\Location\Service;
4
5use Bitrix\Location\Common\RepositoryTrait;
6use \Bitrix\Location\Entity;
7use Bitrix\Location\Exception\RuntimeException;
8use Bitrix\Location\Common\BaseService;
9use Bitrix\Location\Infrastructure\Service\Config\Container;
10use Bitrix\Location\Repository\FormatRepository;
11
19final class FormatService extends BaseService
20{
21 use RepositoryTrait;
22
24 protected static $instance;
25
27 private $defaultFormatCode;
28
30 protected $repository;
31
39 public function findByCode(string $formatCode, string $languageId)
40 {
41 $result = false;
42
43 try
44 {
45 $result = $this->repository->findByCode($formatCode, $languageId);
46 }
47 catch (RuntimeException $exception)
48 {
49 $this->processException($exception);
50 }
51
52 return $result;
53 }
54
61 public function findAll(string $languageId)
62 {
63 $result = false;
64
65 try
66 {
67 $result = $this->repository->findAll($languageId);
68 }
69 catch (RuntimeException $exception)
70 {
71 $this->processException($exception);
72 }
73
74 return $result;
75 }
76
83 public function findDefault(string $languageId)
84 {
85 $result = false;
86
87 try
88 {
89 $result = $this->repository
90 ->findByCode($this->defaultFormatCode, $languageId);
91
92 }
93 catch (RuntimeException $exception)
94 {
95 $this->processException($exception);
96 }
97
98 return $result;
99 }
100
106 public function getDefaultFormatCode(): string
107 {
108 return $this->defaultFormatCode;
109 }
110
115 public function setDefaultFormatCode($defaultFormatCode)
116 {
117 $this->defaultFormatCode = $defaultFormatCode;
118 return $this;
119 }
120
125 protected function __construct(Container $config)
126 {
127 parent::__construct($config);
128 $this->defaultFormatCode = $config->get('defaultFormatCode');
129 $this->setRepository($config->get('repository'));
130 }
131}
processException(\Exception $exception)
Определения baseservice.php:38
findByCode(string $formatCode, string $languageId)
Определения formatservice.php:39
__construct(Container $config)
Определения formatservice.php:125
findDefault(string $languageId)
Определения formatservice.php:83
setDefaultFormatCode($defaultFormatCode)
Определения formatservice.php:115
findAll(string $languageId)
Определения formatservice.php:61
$result
Определения get_property_values.php:14
$formatCode
Определения options.php:112
$config
Определения quickway.php:69