/** * @param int $zipcode * @return array */ public function getLocationsFromZipCode($zipcode) { $locations = []; $items = $this->gateway->getLocationsFromZipCode($zipcode); foreach ($items as $item) { $locations[] = $this->factory->newLocation($item['id'], $item['name'], $item['type'], null, $item['idcity'] ? $this->factory->newCity($item['idcity'], $item['cityname']) : null); } return $locations; }
$action = $_POST['action']; switch ($action) { case 'getTechnologies': $getData = new DataGateway(); $getData->getTechnologies($link); break; case 'getServices': $getData = new DataGateway(); $getData->getServices($link); break; case 'getFunctions': $getData = new DataGateway(); $getData->getFunctions($link, $_POST['serviceId']); break; case 'getFunctionInfo': $getData = new DataGateway(); $getData->getFunctionInfo($link, $_POST['functionId']); break; case 'addFunction': $inserter = new Inserter(); $data['name'] = $_POST['name']; $data['description'] = $_POST['description']; $data['serviceId'] = $_POST['serviceId']; $data['techId'] = $_POST['techId']; $data['result'] = $_POST['result']; $data['variables'] = decodeArray($_POST['variables']); $data['exceptions'] = decodeArray($_POST['exceptions']); $data['links'] = decodeArray($_POST['links']); $msg = $inserter->insertFunction($link, $data); echo $msg; break;