public function equipCar() { $specs = SpecStorage::getCommonSpecifications(); array_push($specs, SpecStorage::getSpecification(self::airCondType)); array_push($specs, SpecStorage::getSpecification(self::airbagSlug, self::airBagNumber)); $this->assignDefaultSpecs($specs); }
public function equipCar() { $eClassDefSpecs = SpecStorage::getCommonSpecifications(); array_push($eClassDefSpecs, SpecStorage::getSpecification(self::airCondType)); array_push($eClassDefSpecs, SpecStorage::getSpecification(self::airbagSlug, self::airBagNumber)); array_push($eClassDefSpecs, SpecStorage::getSpecification("cruise")); array_push($eClassDefSpecs, SpecStorage::getSpecification("parktronic")); array_push($eClassDefSpecs, SpecStorage::getSpecification("senzor-ploaie")); $this->assignDefaultSpecs($eClassDefSpecs); }
public function equipCar() { $sClassDefSpecs = SpecStorage::getCommonSpecifications(); array_push($sClassDefSpecs, SpecStorage::getSpecification(self::airCondType)); array_push($sClassDefSpecs, SpecStorage::getSpecification(self::airbagSlug, self::airBagNumber)); array_push($sClassDefSpecs, SpecStorage::getSpecification("xenon")); array_push($sClassDefSpecs, SpecStorage::getSpecification("scauneRegl")); array_push($sClassDefSpecs, SpecStorage::getSpecification("senzor-lumina")); array_push($sClassDefSpecs, SpecStorage::getSpecification("senzor-ploaie")); array_push($sClassDefSpecs, SpecStorage::getSpecification("piele")); array_push($sClassDefSpecs, SpecStorage::getSpecification("parktronic")); array_push($sClassDefSpecs, SpecStorage::getSpecification("calculator")); array_push($sClassDefSpecs, SpecStorage::getSpecification("cruise")); $this->assignDefaultSpecs($sClassDefSpecs); }
/** * Checks if an optional specification is assigned to the vehicle -> deletes it * @param type $specification */ public function deleteSpec($specName) { $specificationExists = SpecStorage::getSpecification($specName); if (!isset($specificationExists)) { // Helper::displayErrorMessage("There is no such specification: " . $specName); } else { $isEquipped = isset($this->optionalSpecs[$specName]); if ($isEquipped) { // Helper::displayInfoMessage("DELETING optional specification: " . $this->optionalSpecs[$specName]->getNameSpec()); // $deletedSpec = $this->optionalSpecs[$specName]->getNameSpec(); unset($this->optionalSpecs[$specName]); // Helper::displaySuccessMessage("The specification (" . $deletedSpec . ") was successfully deleted"); } else { // Helper::displayErrorMessage("This car is not equipped with: " . $specificationExists->getNameSpec()); } } }
/** * Removes the optional specification from the vehicle held in the session * @Route("/removeSpec/{specSlug}", name="removeSpecification") * @param Request $request * @param string $specSlug * @return JSON Specification Name */ public function removeSpecificationAction(Request $request, $specSlug) { $session = $request->getSession(); $specificationToRemove = SpecStorage::getSpecification($specSlug); $removedSpecName = $specificationToRemove->getNameSpec(); $vehicleToCustomize = $session->get("automobileSession"); $vehicleToCustomize->deleteSpec($specSlug); $session->set("automobileSession", $vehicleToCustomize); $responseArray = json_encode(array("removedSpec" => $removedSpecName)); $response = new Response($responseArray); $response->headers->set('Content-Type', 'application/json'); return $response; }