Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 33 |
| AutonormalizationService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
90.00 | |
0.00% |
0 / 33 |
| __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 |
|||
| getCommonRuleByBatchSem | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| isSubjectSpecificRuleDisabled | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
| <?php | |
| namespace com\linways\core\ams\professional\service; | |
| use com\linways\core\ams\professional\exception\ProfessionalException; | |
| class AutonormalizationService 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; | |
| } | |
| public function getCommonRuleByBatchSem ( $batchId, $semId ) { | |
| $batchId = $this->realEscapeString ( $batchId ); | |
| $semId = $this->realEscapeString ( $semId ); | |
| $ruleId = null; | |
| try { | |
| $sql = "SELECT ruleID FROM normalization_rule3 WHERE batchID = '$batchId' AND semID = '$semId' "; | |
| $ruleId = $this->executeQueryForObject($sql)->ruleID; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $ruleId; | |
| } | |
| public function isSubjectSpecificRuleDisabled ( $batchId, $semId ) { | |
| $batchId = $this->realEscapeString ( $batchId ); | |
| $semId = $this->realEscapeString ( $semId ); | |
| $normalization_subjectwise_rule_privilege = null; | |
| $subject_specific_disabled = null; | |
| try { | |
| $sql = "SELECT id FROM normalization_subjectwise_rule_privilege WHERE batch_id = '$batchId' AND sem_id = '$semId' "; | |
| $normalization_subjectwise_rule_privilege = $this->executeQueryForObject($sql); | |
| if ( !empty ( $normalization_subjectwise_rule_privilege ) ) { | |
| $subject_specific_disabled = 1; | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subject_specific_disabled; | |
| } | |
| } |