/**
  * Return the environment 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 environmentDomain($cityName)
 {
     if (isset($cityName)) {
         if (strcmp($cityName, '') != 0) {
             $sewage = new EnvironmentController();
             //Get the z-value for drainage Ditch
             $drainageDitch = $sewage->drainageDitch();
             //Get the z-value for river, lake and sea sewerage disposal
             $riverLakeDisposal = $sewage->river_lake_sea_sewerageDisposal();
             //Get the z-value for river, lake and sea sewerage disposal
             $septicTank = $sewage->septicTank();
             //Get the z-value for other kinds of garbage disposal
             $garbageDisOther = $sewage->garbageDisOther();
             //Get the z-value for the garbage dumped
             $garbageDumped = $sewage->garbageDumped();
             //Get the z-value for garbage buried
             $garbageBuried = $sewage->garbageBuried();
             //Get the z-value for garbage incinerated
             $garbageIncinerated = $sewage->garbageIncinerated();
             //Get the z-value for garbage collected
             $garbageCollected = $sewage->garbageCollected();
             //Get the z-value for cesspit
             $cesspit = $sewage->cesspit();
             //Get the z-value for other kinds of sewerage
             $otherSewerage = $sewage->otherSewerage();
             //Get the z-value for sewerage system
             $sewerageSystem = $sewage->sewerageSystem();
             $cityEnvironmentInfo = array("Destino do Lixo - Outro" => $garbageDisOther[$cityName], "Destino do Lixo - Jogado" => $garbageDumped[$cityName], "Destino do Lixo - Enterrado" => $garbageBuried[$cityName], "Destino do Lixo - Queimado" => $garbageIncinerated[$cityName], "Destino do Lixo - Coletado" => $garbageCollected[$cityName], "Esgotamento Sanitário - Fossa Rudimentar" => $cesspit[$cityName], "Esgotamento Sanitário - Fossa Séptica" => $septicTank[$cityName], "Esgotamento Sanitário - Outro" => $otherSewerage[$cityName], "Esgotamento Sanitário - Rede pluvial" => $sewerageSystem[$cityName], "Esgotamento Sanitário - Rio, Lago ou mar" => $riverLakeDisposal[$cityName], "Esgotamento Sanitário - Vala" => $drainageDitch[$cityName]);
             $cityEnvironmentValues = CityProfileController::mergeAverage($cityEnvironmentInfo);
             return $cityEnvironmentValues;
         }
     }
     return 0;
 }
 /**
  * It will calculate the average of the z-values for Environment
  * @return return the average of z-values by key field of each city
  */
 public function environmentKeyField()
 {
     $sewage = new EnvironmentController();
     //Get the z-value for drainage Ditch
     $drainageDitch = $sewage->drainageDitch();
     $drainageDitchInverted = array_map(array($this, "addImpact"), $drainageDitch);
     //Get the z-value for river, lake and sea sewerage disposal
     $riverLakeDisposal = $sewage->river_lake_sea_sewerageDisposal();
     $riverLakeDisposalInverted = array_map(array($this, "addImpact"), $riverLakeDisposal);
     //Get the z-value for river, lake and sea sewerage disposal
     $septicTank = $sewage->septicTank();
     //Get the z-value for other kinds of garbage disposal
     $garbageDisOther = $sewage->garbageDisOther();
     $garbageDisOtherInverted = array_map(array($this, "addImpact"), $garbageDisOther);
     //Get the z-value for the garbage dumped
     $garbageDumped = $sewage->garbageDumped();
     $garbageDumpedInverted = array_map(array($this, "addImpact"), $garbageDumped);
     //Get the z-value for garbage buried
     $garbageBuried = $sewage->garbageBuried();
     $garbageBuriedInverted = array_map(array($this, "addImpact"), $garbageBuried);
     //Get the z-value for garbage incinerated
     $garbageIncinerated = $sewage->garbageIncinerated();
     $garbageIncineratedInverted = array_map(array($this, "addImpact"), $garbageIncinerated);
     //Get the z-value for garbage collected
     $garbageCollected = $sewage->garbageCollected();
     //Get the z-value for cesspit
     $cesspit = $sewage->cesspit();
     $cesspitInverted = array_map(array($this, "addImpact"), $cesspit);
     //Get the z-value for other kinds of sewerage
     $otherSewerage = $sewage->otherSewerage();
     $otherSewerageInverted = array_map(array($this, "addImpact"), $otherSewerage);
     //Get the z-value for sewerage system
     $sewerageSystem = $sewage->sewerageSystem();
     //sum z-values
     $sumZvalues = array_map(array($this, "sumCityValues"), $drainageDitchInverted, $riverLakeDisposalInverted, $septicTank, $garbageDisOtherInverted, $garbageDumpedInverted, $garbageBuriedInverted, $garbageIncineratedInverted, $garbageCollected, $cesspitInverted, $otherSewerageInverted, $sewerageSystem);
     //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), 11));
     //combine the array keys(cities'name) with the average of z-values gotten
     $zValuesAvg = array_combine(array_keys($septicTank), array_values($zValuesAvg));
     return $zValuesAvg;
 }