'serv_indep', self::SI_NONAFF => 'serv_nonaff', self::SI_AFF => 'serv_aff', self::SI_THRAFF => 'thresh_aff' ); /** * observed value of counter in case of threshold alarm * @var integer */ private $obsVal = null; /** * constructor: checks validity * * @param strOrEnum both constructions possible: with string representation or by numeric enumeration value * @param iniThrCnt initial threshold count only if strOrEnum == self::SI_THRCNT specified */ function __construct($strOrEnum = self::SI_INDEP, $iniObsVal = null){ if (is_string($strOrEnum)) { $aux_arr = explode (':', $strOrEnum); if (count($aux_arr) > 2) { throw new Exception("Invalid ServInfl string: $strOrEnum"); } } else { $aux_arr[0] = $strOrEnum; $aux_arr[1] = $iniObsVal; } $this->initInstance('ServInfl', self::$defd_vals, $aux_arr[0]); if ($this->getValue() == self::SI_THRAFF) { if (count($aux_arr) < 2 || $aux_arr[1] == null) { throw new Exception("Missing observed value in ServInfl creation"); } $this->obsVal = $aux_arr[1]; } } function getObsVal(){ return $this->obsVal; } function __toString(){ if ($this->obsVal == null) { return parent::__toString(); } else { return parent::__toString() . ":" . $this->obsVal; } } }