You are here

private static function LingotekDashboardController::calcLanguageTotals in Lingotek Translation 8.2

Same name and namespace in other branches
  1. 8 src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::calcLanguageTotals()
  2. 4.0.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::calcLanguageTotals()
  3. 3.0.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::calcLanguageTotals()
  4. 3.1.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::calcLanguageTotals()
  5. 3.2.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::calcLanguageTotals()
  6. 3.3.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::calcLanguageTotals()
  7. 3.4.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::calcLanguageTotals()
  8. 3.5.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::calcLanguageTotals()
  9. 3.6.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::calcLanguageTotals()
  10. 3.7.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::calcLanguageTotals()
  11. 3.8.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::calcLanguageTotals()

Sums the values of the arrays be there keys (PHP 4, PHP 5) array array_sum_values ( array array1 [, array array2 [, array ...]] )

1 call to LingotekDashboardController::calcLanguageTotals()
LingotekDashboardController::getLanguageDetails in src/Controller/LingotekDashboardController.php

File

src/Controller/LingotekDashboardController.php, line 348

Class

LingotekDashboardController
Returns responses for lingotek module setup routes.

Namespace

Drupal\lingotek\Controller

Code

private static function calcLanguageTotals() {
  $return = [];
  $intArgs = func_num_args();
  $arrArgs = func_get_args();
  if ($intArgs < 1) {
    trigger_error('Warning: Wrong parameter count for calcLanguageTotals()', E_USER_WARNING);
  }
  foreach ($arrArgs as $arrItem) {
    if (!is_array($arrItem)) {
      trigger_error('Warning: Wrong parameter values for calcLanguageTotals()', E_USER_WARNING);
    }
    foreach ($arrItem as $k => $v) {
      if (!array_key_exists($k, $return)) {
        $return[$k] = 0;
      }
      $return[$k] += $v;
    }
  }
  return $return;
  $sumArray = [];
  foreach ($myArray as $k => $subArray) {
    foreach ($subArray as $id => $value) {
      $sumArray[$id] += $value;
    }
  }
  return $sumArray;
}