本文整理汇总了PHP中Assert\Assertion::false方法的典型用法代码示例。如果您正苦于以下问题:PHP Assertion::false方法的具体用法?PHP Assertion::false怎么用?PHP Assertion::false使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert\Assertion
的用法示例。
在下文中一共展示了Assertion::false方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkerParameter
/**
* {@inheritdoc}
*/
public function checkerParameter(ClientInterface $client, array &$parameters)
{
if (!array_key_exists('prompt', $parameters)) {
return;
}
Assertion::true(empty(array_diff($parameters['prompt'], $this->getAllowedPromptValues())), sprintf('Invalid parameter "prompt". Allowed values are %s', json_encode($this->getAllowedPromptValues())));
Assertion::false(in_array('none', $parameters['prompt']) && 1 !== count($parameters['prompt']), 'Invalid parameter "prompt". Prompt value "none" must be used alone.');
}
示例2: chooseLetter
/**
* @param string $gameId
* @param string $letter
* @return int
*/
public function chooseLetter($gameId, $letter)
{
Assertion::false($this->gameWon, "Game already won");
Assertion::false($this->gameLost, "Game already lost");
// if letter already exists do nothing
if ($this->lettersCorrectlyGuessed->LetterExistsInContainer($letter) || $this->lettersWrongGuessed->LetterExistsInContainer($letter)) {
$this->wrongGuessedLetter($gameId, $letter);
return;
}
// Execute the right event
$wordContainsLetter = $this->word->wordContainsLetter($letter);
if ($wordContainsLetter === false) {
$this->wrongGuessedLetter($gameId, $letter);
return;
}
// throw good guess
$this->correctlyGuessedLetters($gameId, $letter);
}
示例3: encrypt
/**
* {@inheritdoc}
*/
public function encrypt(Object\JWEInterface &$jwe)
{
Assertion::false($jwe->isEncrypted(), 'The JWE is already encrypted.');
Assertion::greaterThan($jwe->countRecipients(), 0, 'The JWE does not contain recipient.');
$additional_headers = [];
$nb_recipients = $jwe->countRecipients();
$content_encryption_algorithm = $this->getContentEncryptionAlgorithm($jwe);
$compression_method = $this->getCompressionMethod($jwe);
$key_management_mode = $this->getKeyManagementMode($jwe);
$cek = $this->determineCEK($jwe, $content_encryption_algorithm, $key_management_mode, $additional_headers);
for ($i = 0; $i < $nb_recipients; $i++) {
$this->processRecipient($jwe, $jwe->getRecipient($i), $cek, $content_encryption_algorithm, $additional_headers);
}
if (!empty($additional_headers) && 1 === $jwe->countRecipients()) {
$jwe = $jwe->withSharedProtectedHeaders(array_merge($jwe->getSharedProtectedHeaders(), $additional_headers));
}
$iv_size = $content_encryption_algorithm->getIVSize();
$iv = $this->createIV($iv_size);
$this->encryptJWE($jwe, $content_encryption_algorithm, $cek, $iv, $compression_method);
}
示例4: checkPayload
/**
* @param \Jose\Object\JWSInterface $jws
* @param null|string $detached_payload
*/
private function checkPayload(Object\JWSInterface $jws, $detached_payload = null)
{
Assertion::false(null !== $detached_payload && !empty($jws->getPayload()), 'A detached payload is set, but the JWS already has a payload.');
Assertion::true(!empty($jws->getPayload()) || null !== $detached_payload, 'No payload.');
}
示例5: getSignatureAlgorithm
/**
* @param array $complete_header The complete header
* @param \Jose\Object\JWKInterface $key
*
* @return \Jose\Algorithm\SignatureAlgorithmInterface
*/
private function getSignatureAlgorithm(array $complete_header, Object\JWKInterface $key)
{
Assertion::keyExists($complete_header, 'alg', 'No "alg" parameter set in the header.');
Assertion::false($key->has('alg') && $key->get('alg') !== $complete_header['alg'], sprintf('The algorithm "%s" is not allowed with this key.', $complete_header['alg']));
$signature_algorithm = $this->getJWAManager()->getAlgorithm($complete_header['alg']);
Assertion::isInstanceOf($signature_algorithm, Algorithm\SignatureAlgorithmInterface::class, sprintf('The algorithm "%s" is not supported.', $complete_header['alg']));
return $signature_algorithm;
}
示例6: downloadContent
/**
* @throws \InvalidArgumentException
*
* @return string
*/
private function downloadContent()
{
$params = [CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => $this->url];
if (false === $this->allow_unsecured_connection) {
$params[CURLOPT_SSL_VERIFYPEER] = true;
$params[CURLOPT_SSL_VERIFYHOST] = 2;
}
$ch = curl_init();
curl_setopt_array($ch, $params);
$content = curl_exec($ch);
curl_close($ch);
Assertion::false(false === $content, 'Unable to get content.');
return $content;
}
示例7: ensureNotBlocked
/**
* @Then /^the block should not be confirmed$/
*/
public function ensureNotBlocked()
{
Assertion::false($this->isBlocked);
}
示例8: testInvalidFalse
public function testInvalidFalse()
{
$this->setExpectedException('Assert\\AssertionFailedException', null, Assertion::INVALID_FALSE);
Assertion::false(true);
}
示例9: uncompress
/**
* {@inheritdoc}
*/
public function uncompress($data)
{
$data = gzuncompress($data);
Assertion::false(false === $data, 'Unable to uncompress data');
return $data;
}
示例10: validate
private function validate()
{
Assertion::nullOrString($this->logMessageRegExp);
Assertion::nullOrString($this->logMessageInString);
Assertion::nullOrString($this->logContextFuzzy);
Assertion::nullOrIsInstanceOf($this->logTimeLowerBounds, DateTimeInterface::class);
Assertion::nullOrIsInstanceOf($this->logTimeUpperBounds, DateTimeInterface::class);
Assertion::nullOrIsArray($this->logLevelList);
if (!is_null($this->logLevelList)) {
Assertion::notEmpty($this->logLevelList);
Assertion::allInArray($this->logLevelList, array_values((new ReflectionClass(LogLevel::class))->getConstants()));
}
if (!is_null($this->logMessageRegExp)) {
Assertion::true(RegexGuardFactory::getGuard()->isRegexValid($this->logMessageRegExp));
}
if (!is_null($this->logTimeLowerBounds) && !is_null($this->logTimeUpperBounds)) {
Assertion::false($this->logTimeLowerBounds->diff($this->logTimeUpperBounds)->invert);
}
}
示例11: addServiceSource
/**
* @param \SpomkyLabs\JoseBundle\DependencyInjection\Source\SourceInterface $source
*/
public function addServiceSource(Source\SourceInterface $source)
{
$name = $source->getName();
Assertion::false(in_array($name, $this->service_sources), sprintf('The source "%s" is already set.', $name));
$this->service_sources[$name] = $source;
}
示例12: checkRedirectUriForAllClient
/**
* @throws \InvalidArgumentException
*/
private function checkRedirectUriForAllClient()
{
Assertion::false($this->isRedirectUriStorageEnforced(), 'Clients must register at least one redirect URI.');
}
示例13: loadPEM
/**
* @param string $data
*
* @throws \Exception
* @throws \FG\ASN1\Exception\ParserException
*
* @return array
*/
private function loadPEM($data)
{
$res = openssl_pkey_get_private($data);
if (false === $res) {
$res = openssl_pkey_get_public($data);
}
Assertion::false(false === $res, 'Unable to load the key');
$details = openssl_pkey_get_details($res);
Assertion::keyExists($details, 'rsa', 'Unable to load the key');
$this->values['kty'] = 'RSA';
$keys = ['n' => 'n', 'e' => 'e', 'd' => 'd', 'p' => 'p', 'q' => 'q', 'dp' => 'dmp1', 'dq' => 'dmq1', 'qi' => 'iqmp'];
foreach ($details['rsa'] as $key => $value) {
if (in_array($key, $keys)) {
$value = Base64Url::encode($value);
$this->values[array_search($key, $keys)] = $value;
}
}
}
示例14: ensureNoLogRemains
/**
* @Then /^no log about "(.*)" should exist on user "(.*)" should exist$/
*
* @param string $ip
* @param string $username
*/
public function ensureNoLogRemains(string $ip, string $username)
{
Assertion::false($this->getEntityManager()->getRepository('Account:User')->findOneBy(['username' => $username])->exceedsIpFailedAuthAttemptMaximum($ip, new DateTimeComparison()));
}
示例15: addPKCEMethod
/**
* {@inheritdoc}
*/
public function addPKCEMethod(PKCEMethodInterface $method)
{
Assertion::false(array_key_exists($method->getMethodName(), $this->pkce_methods), sprintf('The method "%s" already exists.', $method->getMethodName()));
$this->pkce_methods[$method->getMethodName()] = $method;
}