public static function get($protections) { $lProtections = array(); foreach ($protections as $lProtection) { $lProtectionItem = new protection_item($lProtection[database_fields::COLUMN_NAME], $lProtection[database_fields::COLUMN_ID], $lProtection[database_fields::COLUMN_IS_ENABLED]); array_push($lProtections, $lProtectionItem->prepareFieldsForJson()); } if (count($lProtections) > 0) { return json_encode($lProtections, JSON_PRETTY_PRINT); } else { http_response_code(ResponseCodes::InvalidInput); } }
/** * @SWG\Api( * path="/remove/{id}", * @SWG\Operation( * method="DELETE", * summary="Remove Protected Application by ID", * notes="", * type="void", * authorizations={}, * @SWG\Parameter( * name="id", * description="ID of Protected Application.", * required=true, * type="integer", * paramType="path" * ), * @SWG\ResponseMessage(code=200, message="Successfull Removed."), * @SWG\ResponseMessage(code=400, message="Invalid ID supplied."), * @SWG\ResponseMessage(code=404, message="Item not found."), * @SWG\ResponseMessage(code=405, message="Invalid Input.") * ) * ) */ public function remove($id) { $this->load->model("protection_model", "lProtectionModel"); $lProtections = $this->lProtectionModel->remove($id); if ($lProtections != NULL) { echo protection_item::get($lProtections); } }