/** * Return the employment 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 employmentDomain($cityName) { if (isset($cityName)) { if (strcmp($cityName, '') != 0) { $employmnet = new EmploymentController(); //Get the z-value for gross domestic product (GDP) $cityEmployment = $employmnet->cityEmployment(); //Get the z-value for Gross value added (GVA) $citySalary = $employmnet->citySalary(); $cityEmploymentInfo = array("Número de vínculos empregatícios" => $cityEmployment[$cityName], "Remuneração média" => $citySalary[$cityName]); $cityEmploymentValues = CityProfileController::mergeAverage($cityEmploymentInfo); return $cityEmploymentValues; } } return 0; }
/** * It will calculate the average of the z-values for Economy * @return return the average of z-values by key field sortZvaluesof each city */ public function employmentKeyField() { $employmnet = new EmploymentController(); //Get the z-value for gross domestic product (GDP) $cityEmployment = $employmnet->cityEmployment(); //Get the z-value for Gross value added (GVA) $citySalary = $employmnet->citySalary(); //sum z-values $sumZvalues = array_map(array($this, "sumCityValues"), $cityEmployment, $citySalary); //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), 2)); //combine the array keys(cities'name) with the average of z-values gotten $zValuesAvg = array_combine(array_keys($citySalary), array_values($zValuesAvg)); return $zValuesAvg; }