Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/bizproc/lib/activity/operator/ |
Upload File : |
<?php namespace Bitrix\Bizproc\Activity\Operator; use Bitrix\Bizproc\FieldType; use Bitrix\Main\Localization\Loc; class ContainOperator extends BaseOperator { public static function getCode(): string { return 'contain'; } public static function getTitle(): string { return Loc::getMessage('BIZPROC_ACTIVITY_CONDITION_OPERATORS_CONTAIN_OPERATOR_TITLE') ?? ''; } public function __construct($toCheck, $value, FieldType $fieldType) { parent::__construct($toCheck, $value, $fieldType); $this->value = is_array($this->value) ? $this->value : [$this->value]; $this->toCheck = is_array($this->toCheck) ? $this->toCheck : [$this->toCheck]; } public function check(): bool { $baseType = $this->fieldType->getBaseType(); if ($baseType === 'user') { return count(array_diff($this->value, $this->toCheck)) === 0; } $result = false; foreach (\CBPHelper::flatten($this->value) as $v) { foreach ($this->toCheck as $f) { if (is_array($f)) { $result = in_array($v, $f, false); } elseif ( \CBPHelper::hasStringRepresentation($f) && \CBPHelper::hasStringRepresentation($v) && (string)$v !== '' ) { $result = (mb_strpos($f, $v) !== false); } if ($result) { break; } } if (!$result) { break; } } return $result; } }