Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 9 |
CRAP | |
0.00% |
0 / 78 |
PovertyLineService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 9 |
306.00 | |
0.00% |
0 / 78 |
__construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
__clone | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
getInstance | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 5 |
|||
addpovertyLine | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
showpovertyLine | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 17 |
|||
updatepovertyLine | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
deletepovertyLine | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getpovertyLine | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getPovertyLineDataImport | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
<?php | |
namespace com\linways\core\ams\professional\service; | |
use com\linways\core\ams\professional\exception\ProfessionalException; | |
class PovertyLineService extends BaseService | |
{ | |
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; | |
} | |
/** | |
* add povertyLine | |
* @author Aswin | |
* @param $povertyLineName | |
* @throws ProfessionalException | |
* @return object|array|\com\linways\base\util\$objectList[] | |
*/ | |
public function addpovertyLine($povertyLineName) | |
{ | |
$povertyLineName=$this->realEscapeString($povertyLineName); | |
$query="insert into poverty_line (poverty_line) values ('$povertyLineName')"; | |
try{ | |
$response=$this->executeQueryForList($query,true); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $response; | |
} | |
/** | |
* return all povertyLine details | |
* @author Aswin | |
* @throws ProfessionalException | |
* @return object|array|\com\linways\base\util\$objectList[] | |
*/ | |
public function showpovertyLine() | |
{ | |
$query="select * from poverty_line"; | |
try{ | |
$response=$this->executeQueryForList($query); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
if($response==null) | |
{ | |
throw new ProfessionalException(ProfessionalException::ARRAY_EMPTY,"No records found"); | |
} | |
else | |
{ | |
return $response; | |
} | |
} | |
/** | |
* update povertyLine | |
* @author Aswin | |
* @param $povertyLineName | |
* @param $povertyLineID | |
* @throws ProfessionalException | |
* @return string | |
*/ | |
public function updatepovertyLine($povertyLineName,$povertyLineID) | |
{ | |
$povertyLineID=$this->realEscapeString($povertyLineID); | |
$povertyLineName=$this->realEscapeString($povertyLineName); | |
$query="update poverty_line set poverty_line='$povertyLineName' where id=$povertyLineID"; | |
try{ | |
$responsse=$this->executeQueryForList($query); | |
}catch (\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return "updated"; | |
} | |
/** | |
* delete povertyLine | |
* @author Aswin | |
* @param $povertyLineID | |
* @throws ProfessionalException | |
* @return string | |
*/ | |
public function deletepovertyLine($povertyLineID) | |
{ | |
$povertyLineID=$this->realEscapeString($povertyLineID); | |
$query="delete from poverty_line where id=$povertyLineID"; | |
try{ | |
$response=$this->executeQueryForList($query); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return "deleted"; | |
} | |
/** | |
* get poverty line by id | |
* @author Aswin | |
* @param unknown $id | |
* @throws ProfessionalException | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
*/ | |
public function getpovertyLine($id) | |
{ | |
$id=$this->realEscapeString($id); | |
$query="select * from poverty_line where id='$id'"; | |
try{ | |
$response=$this->executeQueryForObject($query); | |
return $response; | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
public function getPovertyLineDataImport() | |
{ | |
$query="SELECT id , poverty_line as name from poverty_line"; | |
try{ | |
return $this->executeQueryForList($query); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
} | |