Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
utils.php
1<?php
2
4
7
8class Utils
9{
15 public static function extractEntityDescription($entityIdentifier, $defaultNamespace = "bitrix")
16 {
17 $namespace = $defaultNamespace;
18 $name = $entityIdentifier;
19
20 if(mb_strpos($entityIdentifier, ":"))
21 {
22 [$namespace, $name] = explode(":", $entityIdentifier);
23 }
24
25 return [
26 "name" => $name,
27 "namespace" => $namespace,
28 "fullname" => "$namespace:$name",
29 "relativePath" => "$namespace/$name",
30 "defaultFullname" => $namespace && $namespace != "bitrix" ? "$namespace:$name" : $name
31 ];
32 }
33
40 public static function jsonEncode($string, $options = JSON_HEX_TAG | JSON_HEX_AMP | JSON_PRETTY_PRINT | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE)
41 {
42 return Json::encode($string, $options);
43 }
44
45 public static function getFileHash(File $file) {
46 if ($file->isExists())
47 {
48 return hash_file('md5', $file->getPhysicalPath());
49 }
50
51 return "";
52 }
53}
getPhysicalPath()
static getFileHash(File $file)
Definition utils.php:45
static jsonEncode($string, $options=JSON_HEX_TAG|JSON_HEX_AMP|JSON_PRETTY_PRINT|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_UNESCAPED_UNICODE)
Definition utils.php:40
static extractEntityDescription($entityIdentifier, $defaultNamespace="bitrix")
Definition utils.php:15