/**
  * Return the government expenditures z-values for the selected city and its average
  * @param string $cityName name of the selected city
  * @return array $cityValues it contains the z-values and a z-values average
  */
 public function governmentExpendituresDomain($cityName)
 {
     if (isset($cityName)) {
         if (strcmp($cityName, '') != 0) {
             $expenditures = new GovernmentExpendituresController();
             //Get the z-value for city taxes
             $municipalTaxes = $expenditures->municipalTaxes();
             //Get the z-value for federal taxes
             $federalTaxes = $expenditures->federalTaxes();
             //Get the z-value for state taxes
             $stateTaxes = $expenditures->stateTaxes();
             //Get the z-value for government expending
             $governmentExpending = $expenditures->governmentExpending();
             $cityExpendituresInfo = array("Tributos Municipais" => $municipalTaxes[$cityName], "Tributos Federais" => $federalTaxes[$cityName], "Tributos Estaduais" => $stateTaxes[$cityName], "Despesas Realizadas" => $governmentExpending[$cityName]);
             $cityExpendituresValues = CityProfileController::mergeAverage($cityExpendituresInfo);
             return $cityExpendituresValues;
         }
     }
     return 0;
 }
 /**
  * It will calculate the average of the z-values for Government Expenditures
  * @return return the average of z-values by key field of each city
  */
 public function governmentExpendituresKeyField()
 {
     $expenditures = new GovernmentExpendituresController();
     //Get the z-value for city taxes
     $municipalTaxes = $expenditures->municipalTaxes();
     //Get the z-value for federal taxes
     $federalTaxes = $expenditures->federalTaxes();
     //Get the z-value for state taxes
     $stateTaxes = $expenditures->stateTaxes();
     //Get the z-value for government expending
     $governmentExpending = $expenditures->governmentExpending();
     //sum z-values
     $sumZvalues = array_map(array($this, "sumCityValues"), $municipalTaxes, $federalTaxes, $stateTaxes, $governmentExpending);
     //Divide the sum of z-values to obtain the z-values average of each city
     $zValuesAvg = array_map(array($this, "divideKeyFields"), $sumZvalues, array_fill(0, count($sumZvalues), 4));
     //combine the array keys(cities'name) with the average of z-values gotten
     $zValuesAvg = array_combine(array_keys($stateTaxes), array_values($zValuesAvg));
     return $zValuesAvg;
 }