Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 54 |
| FeeReservationService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
156.00 | |
0.00% |
0 / 54 |
| __construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 2 |
|||
| __clone | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
| getInstance | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 5 |
|||
| getAllFeeReservations | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 17 |
|||
| saveFeeReservation | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 18 |
|||
| deleteFeeReservation | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| <?php | |
| namespace com\linways\core\ams\professional\service; | |
| use com\linways\core\ams\professional\exception\ProfessionalException; | |
| class FeeReservationService extends BaseService | |
| { | |
| // /Condition 1 - Presence of a static member variable | |
| private static $_instance = null; | |
| // /Condition 2 - Locked down the constructor | |
| private function __construct() | |
| { | |
| } | |
| // Prevent any oustide instantiation of this class | |
| // /Condition 3 - Prevent any object or instance of that class to be cloned | |
| private function __clone() | |
| {} | |
| // Prevent any copy of this object | |
| // /Condition 4 - Have a single globally accessible static method | |
| public static function getInstance() | |
| { | |
| if (! is_object(self::$_instance)) // or if( is_null(self::$_instance) ) or if( self::$_instance == null ) | |
| self::$_instance = new self(); | |
| return self::$_instance; | |
| } | |
| /** | |
| * get all fee reservations | |
| * @author Aswin | |
| * @throws ProfessionalException | |
| * @return unknown | |
| */ | |
| public function getAllFeeReservations() | |
| { | |
| $query="select * from fee_reservations"; | |
| try{ | |
| $response=$this->executeQueryForList($query); | |
| if($response) | |
| { | |
| return $response; | |
| } | |
| else | |
| { | |
| throw new ProfessionalException(ProfessionalException::ARRAY_EMPTY,"NO FEE RESERVATION DEFINED"); | |
| } | |
| }catch(\Exception $e) | |
| { | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| } | |
| /** | |
| * save fee reservation | |
| * @author Aswin | |
| * @param unknown $feeReservationInp | |
| * @throws ProfessionalException | |
| * @return string | |
| */ | |
| public function saveFeeReservation($feeReservationInp) | |
| { | |
| $feeReservationInp=$this->realEscapeObject($feeReservationInp); | |
| if(!$feeReservationInp->id) | |
| { | |
| $query="INSERT INTO fee_reservations (feeReservationName,feeReservationDesc) values (\"".$feeReservationInp->feeReservationName."\",\"".$feeReservationInp->feeReservationDesc."\")"; | |
| } | |
| else | |
| { | |
| $query="update fee_reservations set feeReservationName=\"".$feeReservationInp->feeReservationName."\",feeReservationDesc=\"".$feeReservationInp->feeReservationDesc."\" where id=\"".$feeReservationInp->id."\""; | |
| } | |
| try{ | |
| $response=$this->executeQueryForList($query); | |
| return "inserted"; | |
| }catch(\Exception $e) | |
| { | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| } | |
| /** | |
| * delete fee reservation | |
| * @author Aswin | |
| * @param unknown $id | |
| * @throws ProfessionalException | |
| * @return string | |
| */ | |
| public function deleteFeeReservation($id) | |
| { | |
| $id=$this->realEscapeString($id); | |
| $query="delete from fee_reservations where id=$id"; | |
| try{ | |
| $response=$this->executeQueryForList($query); | |
| return "deleted"; | |
| }catch(\Exception $e) | |
| { | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| } | |
| } | |