1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
chatindex.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\Internals
;
4
5
use
Bitrix\Main\Localization\Loc
;
6
7
class
ChatIndex
8
{
9
private
const
CHARS_TO_REPLACE = [
'('
,
')'
,
'['
,
']'
,
'{'
,
'}'
,
'<'
,
'>'
,
'-'
,
'#'
,
'"'
,
'\''
];
10
12
private
$title;
13
15
private
$chatId;
16
18
private
$userList;
19
20
public
static
function
create
():
ChatIndex
21
{
22
return
new
static
();
23
}
24
25
private
function
__construct()
26
{
27
}
28
32
public
function
isEmptyUsers
(): bool
33
{
34
return
empty($this->userList);
35
}
36
40
public
function
getRowTitle
(): string
41
{
42
return
$this->title
;
43
}
44
45
public
function
getClearedTitle
(): string
46
{
47
return
ChatIndex::clearText
($this->
title
);
48
}
49
54
public
function
setTitle
(
string
$title):
ChatIndex
55
{
56
$this->
title
= $title;
57
58
return
$this;
59
}
60
64
public
function
getChatId
(): int
65
{
66
return
$this->chatId;
67
}
68
73
public
function
setChatId
(
int
$chatId):
ChatIndex
74
{
75
$this->chatId = $chatId;
76
77
return
$this;
78
}
79
83
public
function
getRowUserNameList
():
array
84
{
85
return
$this->userList
;
86
}
87
91
public
function
getClearedUserList
():
array
92
{
93
$clearedUsers = [];
94
foreach
($this->userList as
$user
)
95
{
96
$clearedUsers[] =
ChatIndex::clearText
(
$user
);
97
}
98
99
return
$clearedUsers;
100
}
101
106
public
function
setUserList
(
array
$users):
ChatIndex
107
{
108
$this->userList = $users;
109
110
return
$this;
111
}
112
120
public
static
function
clearText
(
string
$text
): string
121
{
122
$clearedText = str_replace(static::CHARS_TO_REPLACE,
' '
,
$text
);
123
$clearedText = preg_replace(
'/\s+/'
,
' '
, $clearedText);
124
125
return
trim($clearedText);
126
}
127
128
public
static
function
matchAgainstWildcard
($phrase, $leftWildcard =
'+'
, $rightWildcard =
'*'
, $minTokenSize =
null
)
129
{
130
$ftMinTokenSize = $minTokenSize ?:
\Bitrix\Main\ORM\Query\Filter\Helper::getMinTokenSize
();
131
132
$orValues = [];
133
134
//split to words by any non-word symbols
135
$andValues =
\Bitrix\Main\ORM\Query\Filter\Helper::splitWords
($phrase);
136
137
if
(!empty($andValues))
138
{
139
$andValues = array_filter(
140
$andValues,
141
static
function
(
$val
) use ($ftMinTokenSize)
142
{
143
return
(mb_strlen(
$val
) >= $ftMinTokenSize);
144
}
145
);
146
147
if
(!empty($andValues))
148
{
149
$orValues[] = $leftWildcard . implode($rightWildcard .
" "
. $leftWildcard, $andValues) . $rightWildcard;
150
}
151
}
152
153
if
(!empty($orValues))
154
{
155
return
"("
.implode(
") ("
, $orValues).
")"
;
156
}
157
158
return
''
;
159
}
160
}
Bitrix\Im\Internals\ChatIndex
Определения
chatindex.php:8
Bitrix\Im\Internals\ChatIndex\getChatId
getChatId()
Определения
chatindex.php:64
Bitrix\Im\Internals\ChatIndex\setUserList
setUserList(array $users)
Определения
chatindex.php:106
Bitrix\Im\Internals\ChatIndex\create
static create()
Определения
chatindex.php:20
Bitrix\Im\Internals\ChatIndex\getRowTitle
getRowTitle()
Определения
chatindex.php:40
Bitrix\Im\Internals\ChatIndex\getClearedTitle
getClearedTitle()
Определения
chatindex.php:45
Bitrix\Im\Internals\ChatIndex\clearText
static clearText(string $text)
Определения
chatindex.php:120
Bitrix\Im\Internals\ChatIndex\matchAgainstWildcard
static matchAgainstWildcard($phrase, $leftWildcard='+', $rightWildcard=' *', $minTokenSize=null)
Определения
chatindex.php:128
Bitrix\Im\Internals\ChatIndex\setTitle
setTitle(string $title)
Определения
chatindex.php:54
Bitrix\Im\Internals\ChatIndex\getRowUserNameList
getRowUserNameList()
Определения
chatindex.php:83
Bitrix\Im\Internals\ChatIndex\setChatId
setChatId(int $chatId)
Определения
chatindex.php:73
Bitrix\Im\Internals\ChatIndex\getClearedUserList
getClearedUserList()
Определения
chatindex.php:91
Bitrix\Im\Internals\ChatIndex\isEmptyUsers
isEmptyUsers()
Определения
chatindex.php:32
Bitrix\Main\Localization\Loc
Определения
loc.php:12
Bitrix\Main\ORM\Query\Filter\Helper\getMinTokenSize
static getMinTokenSize()
Определения
helper.php:76
Bitrix\Main\ORM\Query\Filter\Helper\splitWords
static splitWords($string)
Определения
helper.php:92
$userList
$userList
Определения
discount_coupon_list.php:276
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Im\Internals
Определения
chatindex.php:3
Bitrix\Main\$user
$user
Определения
mysql_to_pgsql.php:33
title
<? endif;?> window document title
Определения
prolog_main_admin.php:76
$text
$text
Определения
template_pdf.php:79
$title
$title
Определения
pdf.php:123
$val
$val
Определения
options.php:1793
bitrix
modules
im
lib
internals
chatindex.php
Создано системой
1.14.0