Merge pull request #7607 from JakubOnderka/non-correlationg-types-const

chg: [internal] Convert array to const
pull/7609/head
Jakub Onderka 2021-07-27 18:40:47 +02:00 committed by GitHub
commit 442392652f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 21 deletions

View File

@ -89,17 +89,17 @@ class Attribute extends AppModel
const UPLOAD_DEFINITIONS = ['attachment'];
// skip Correlation for the following types
public $nonCorrelatingTypes = array(
'comment',
'http-method',
'aba-rtn',
'gender',
'counter',
'port',
'nationality',
'cortex',
'boolean',
'anonymised'
const NON_CORRELATING_TYPES = array(
'comment',
'http-method',
'aba-rtn',
'gender',
'counter',
'port',
'nationality',
'cortex',
'boolean',
'anonymised'
);
const PRIMARY_ONLY_CORRELATING_TYPES = array(
@ -1695,7 +1695,7 @@ class Attribute extends AppModel
'conditions' => [
'OR' => $or,
'NOT' => [
'Attribute.type' => $this->nonCorrelatingTypes,
'Attribute.type' => Attribute::NON_CORRELATING_TYPES,
],
'Attribute.disable_correlation' => 0,
],
@ -2304,7 +2304,7 @@ class Attribute extends AppModel
'Attribute.deleted' => 0,
'Attribute.disable_correlation' => 0,
'NOT' => array(
'Attribute.type' => $this->nonCorrelatingTypes,
'Attribute.type' => Attribute::NON_CORRELATING_TYPES,
),
);
if ($attributeId) {

View File

@ -82,7 +82,7 @@ class Correlation extends AppModel
'conditions' => [
'AND' => $extraConditions,
'NOT' => [
'Attribute.type' => $this->Attribute->nonCorrelatingTypes,
'Attribute.type' => Attribute::NON_CORRELATING_TYPES,
],
'Attribute.disable_correlation' => 0,
'Event.disable_correlation' => 0,
@ -117,7 +117,7 @@ class Correlation extends AppModel
]
],
'NOT' => [
'Attribute.type' => $this->Attribute->nonCorrelatingTypes,
'Attribute.type' => Attribute::NON_CORRELATING_TYPES,
],
'Attribute.disable_correlation' => 0,
'Event.disable_correlation' => 0,
@ -269,7 +269,7 @@ class Correlation extends AppModel
return true;
}
// Don't do any correlation if the type is a non correlating type
if (in_array($a['type'], $this->Attribute->nonCorrelatingTypes)) {
if (in_array($a['type'], Attribute::NON_CORRELATING_TYPES, true)) {
return true;
}
if ($this->__preventExcludedCorrelations($a)) {
@ -306,7 +306,7 @@ class Correlation extends AppModel
],
'NOT' => [
'Attribute.event_id' => $a['event_id'],
'Attribute.type' => $this->Attribute->nonCorrelatingTypes,
'Attribute.type' => Attribute::NON_CORRELATING_TYPES,
],
'Attribute.disable_correlation' => 0,
'Event.disable_correlation' => 0,

View File

@ -381,7 +381,7 @@ class Feed extends AppModel
$redisResultToAttributePosition = [];
foreach ($attributes as $k => $attribute) {
if (in_array($attribute['type'], $this->Attribute->nonCorrelatingTypes, true)) {
if (in_array($attribute['type'], Attribute::NON_CORRELATING_TYPES, true)) {
continue; // attribute type is not correlateable
}
if (!empty($attribute['disable_correlation'])) {
@ -1313,7 +1313,7 @@ class Feed extends AppModel
$this->Attribute = ClassRegistry::init('Attribute');
$pipe = $redis->multi(Redis::PIPELINE);
foreach ($event['Event']['Attribute'] as $attribute) {
if (!in_array($attribute['type'], $this->Attribute->nonCorrelatingTypes)) {
if (!in_array($attribute['type'], Attribute::NON_CORRELATING_TYPES, true)) {
if (in_array($attribute['type'], $this->Attribute->getCompositeTypes())) {
$value = explode('|', $attribute['value']);
if (in_array($attribute['type'], Attribute::PRIMARY_ONLY_CORRELATING_TYPES, true)) {

View File

@ -210,7 +210,7 @@ class ShadowAttribute extends AppModel
if (isset($sa['ShadowAttribute'])) {
$sa = $sa['ShadowAttribute'];
}
if (in_array($sa['type'], $this->Attribute->nonCorrelatingTypes)) {
if (in_array($sa['type'], Attribute::NON_CORRELATING_TYPES, true)) {
return;
}
$this->ShadowAttributeCorrelation = ClassRegistry::init('ShadowAttributeCorrelation');
@ -228,7 +228,7 @@ class ShadowAttribute extends AppModel
'Attribute.value1' => $cV,
'Attribute.value2' => $cV
),
'Attribute.type !=' => $this->Attribute->nonCorrelatingTypes,
'Attribute.type !=' => Attribute::NON_CORRELATING_TYPES,
'Attribute.deleted' => 0,
'Attribute.event_id !=' => $sa['event_id']
),