Open Data Catalog v
HelperTrait.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use Drupal\Core\Config\ConfigFactoryInterface;
7 
11 trait HelperTrait {
17  private $configService;
18 
22  private function setConfigService(ConfigFactoryInterface $configService) {
23  $this->configService = $configService;
24  }
25 
34  private function getPropertyList() : array {
35  if (isset($this->configService)) {
36  $list = $this->configService->get('metastore.settings')->get('property_list');
37  return array_values(array_filter($list));
38  }
39  throw new \Exception("Can't get property list, the config service was not set.");
40  }
41 
51  private function emptyPropertyOfSameType($data) {
52  if (is_array($data)) {
53  return [];
54  }
55  return "";
56  }
57 
61  private function getUuidService() {
62  return new Uuid5();
63  }
64 
65 }
Drupal\metastore\Reference\HelperTrait
trait HelperTrait
Definition: HelperTrait.php:11
Drupal\metastore\Reference
Definition: Dereferencer.php:3
Drupal\metastore\Service\Uuid5
Definition: Uuid5.php:17