/**
  * Return the economy domain 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 economyDomain($cityName)
 {
     if (isset($cityName)) {
         if (strcmp($cityName, '') != 0) {
             $economy = new EconomyController();
             //Get the z-value for  gross domestic product (GDP)
             $cityGdp = $economy->cityGdp();
             //Get the z-value for Gross value added (GVA)
             $cityGva = $economy->cityGva();
             //Get the z-value for amount of companies
             $cityCompanies = $economy->cityCompanies();
             $cityEconomyInfo = array("Número de estabelecimentos" => $cityCompanies[$cityName], "PIB" => $cityGdp[$cityName], "Valor Adicionado Bruto" => $cityGva[$cityName]);
             $cityEconomyValues = CityProfileController::mergeAverage($cityEconomyInfo);
             return $cityEconomyValues;
         }
     }
     return 0;
 }
 /**
  * It will calculate the average of the z-values for Economy
  * @return return the average of z-values by key field of each city
  */
 public function economyKeyField()
 {
     $economy = new EconomyController();
     //Get the z-value for  gross domestic product (GDP)
     $cityGdp = $economy->cityGdp();
     //Get the z-value for Gross value added (GVA)
     $cityGva = $economy->cityGva();
     //Get the z-value for amount of companies
     $cityCompanies = $economy->cityCompanies();
     //sum z-values
     $sumZvalues = array_map(array($this, "sumCityValues"), $cityGdp, $cityGva, $cityCompanies);
     //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), 3));
     //combine the array keys(cities'name) with the average of z-values gotten
     $zValuesAvg = array_combine(array_keys($cityCompanies), array_values($zValuesAvg));
     return $zValuesAvg;
 }