Skip to content

Commit

Permalink
[statistics] Add extra validation (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjuarez20 authored and enzolutions committed Jun 18, 2019
1 parent 563c08b commit e2f0438
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/EventSubscriber/SaveStatisticsListener.php
Expand Up @@ -74,8 +74,13 @@ public function saveStatistics(ConsoleTerminateEvent $event)

$configGlobalAsArray = $this->configurationManager->getConfigGlobalAsArray();

//Validate if the config is enable.
if (is_null($configGlobalAsArray) || !$configGlobalAsArray['application']['statistics']['enabled']) {
//Validate if the config is defined.
if (is_null($configGlobalAsArray) || !isset($configGlobalAsArray['application']['statistics'])) {
return;
}

//Validate if the statistics is enabled.
if (!isset($configGlobalAsArray['application']['statistics']['enabled']) || !$configGlobalAsArray['application']['statistics']['enabled']) {
return;
}

Expand Down
9 changes: 7 additions & 2 deletions src/EventSubscriber/SendStatisticsListener.php
Expand Up @@ -67,8 +67,13 @@ public function calculateStatistics(ConsoleTerminateEvent $event)
$date = date('Y-m-d');
$configGlobalAsArray = $this->configurationManager->getConfigGlobalAsArray();

//Validate if the config is enable.
if (is_null($configGlobalAsArray) || !$configGlobalAsArray['application']['statistics']['enabled']) {
//Validate if the config is defined.
if (is_null($configGlobalAsArray) || !isset($configGlobalAsArray['application']['statistics'])) {
return;
}

//Validate if the statistics is enabled.
if (!isset($configGlobalAsArray['application']['statistics']['enabled']) || !$configGlobalAsArray['application']['statistics']['enabled']) {
return;
}

Expand Down

0 comments on commit e2f0438

Please sign in to comment.