This commit is contained in:
Bellord
2026-07-07 19:10:50 +03:00
parent 19eaeb4f4e
commit 01d61b89fe
10 changed files with 837 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace Ixrs\Catalog\Support;
class IBlock
{
static array $operations = [
'!><' => 'NB', //not between
'!=' => 'NI', //not Identical
'!%' => 'NS', //not substring
'><' => 'B', //between
'>=' => 'GE', //greater or equal
'<=' => 'LE', //less or equal
'=' => 'I', //Identical
'%' => 'S', //substring
'?' => '?', //logical
'>' => 'G', //greater
'<' => 'L', //less
'!' => 'N', // not field LIKE val
'*' => 'FT', // partial full text match
'*=' => 'FTI', // identical full text match
'*%' => 'FTL', // partial full text match based on LIKE
];
public static function getOperationFilter($key)
{
$re = '/^(!><|!=|!%|><|>=|<=|=|%|\?|>|<|!|\*|\*=|\*%)?(PROPERTY_)(\d+)$/m';
$matches = [];
$r = preg_match($re, $key, $matches);
if($r){
return [
'FIELD' => mb_strtoupper($matches[2] . $matches[3]),
'OPERATION' => static::$operations[$matches[1]]??'',
'PREFIX' => $matches[1],
'ID' => $matches[3],
];
}
return [];
}
}