Prado\Security\TSecurityManager::setValidationKey PHP Метод

setValidationKey() публичный Метод

public setValidationKey ( $value )
    public function setValidationKey($value)
    {
        if ('' === $value) {
            throw new TInvalidDataValueException('securitymanager_validationkey_invalid');
        }
        $this->_validationKey = $value;
    }

Usage Example

Пример #1
0
 public function testValidateData()
 {
     $sec = new TSecurityManager();
     $sec->init(null);
     $sec->setValidationKey('aKey');
     $sec->setValidation('SHA1');
     $hashed = $sec->hashData('A text to hash');
     self::assertEquals('A text to hash', $sec->validateData($hashed));
     // try to alter the hashed data
     $hashed[45] = "z";
     self::assertFalse($sec->validateData($hashed));
     // and a test without tampered data
     self::assertFalse($sec->validateData('bad'));
 }