public function isValid($recipientId, $content = null) { $rowService = $this->_rowService->toArray(); $smsRecipient = new SmsRecipient(); $this->_phoneNumber = $smsRecipient->getRecipientNumber($recipientId); //diee($this->_rowService->toArray()); $validators = $this->getValidators($rowService['id']); $args['rowService'] = $this->_rowService->toArray(); $args['phoneNumber'] = $this->_phoneNumber; $args['client'] = $this->_client->toArray(); //diee($validators); foreach ($validators as $k => $v) { $refClass = new ReflectionClass($this->_createValidatorClassName($v['validator_name'])); $this->_validatorInstance = $refClass->newInstance($args); if (!$this->_validatorInstance->isValid($recipientId, $content)) { return false; } } /* $vc = new Logic_Service_Validator_Content(); if (!$vc->isValid($recipientId, $content)) return false; $vl = new Logic_Service_Validator_Limit(); if (!$vl->isValid($recipientId, $content)) return false; $bl = new Logic_Service_Validator_BlackList(); if (!$bl->isValid($recipientId, $content)) return false; $wh = new Logic_Service_Validator_WhiteList(); if (!$wh->isValid($recipientId, $content)) return false; */ return true; }
/** * Sprawdzenie, czy numer jest na liscie numerow zablokowanych */ public function isValid($recipientId, $content = null) { $smsRecipient = new SmsRecipient(); $phoneNumber = $smsRecipient->getRecipientNumber($recipientId); $model = new SmsBlacklist(); if ($model->getRecordByNumber($phoneNumber, $clientId)) { $this->_error("Proba wyslania sms na numer obecny na blacklist", $phoneNumber); return false; } return true; }