Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
status.php
1<?php
2
4
6
12final class Status
13{
14 private const SEMANTIC_SUCCESS = 'success';
15 private const SEMANTIC_ERROR = 'error';
16 private const SEMANTIC_PROCESS = 'process';
17
19 private $message;
20
22 private $semantic;
23
30 public function __construct(string $message, string $semantic)
31 {
32 $this->message = $message;
33 if (!in_array($semantic, [self::SEMANTIC_SUCCESS, self::SEMANTIC_PROCESS, self::SEMANTIC_ERROR]))
34 {
35 throw new SystemException(sprintf('Unexpected semantic: %s', $semantic));
36 }
37
38 $this->semantic = $semantic;
39 }
40
44 public function getMessage(): string
45 {
46 return $this->message;
47 }
48
52 public function getSemantic(): string
53 {
54 return $this->semantic;
55 }
56
60 public static function getSuccessSemantic(): string
61 {
62 return self::SEMANTIC_SUCCESS;
63 }
64
68 public static function getErrorSemantic(): string
69 {
70 return self::SEMANTIC_ERROR;
71 }
72
76 public static function getProcessSemantic(): string
77 {
78 return self::SEMANTIC_PROCESS;
79 }
80
84 public static function getAvailableSemantics(): array
85 {
86 return [
90 ];
91 }
92}
__construct(string $message, string $semantic)
Definition status.php:30