本文整理汇总了PHP中Assert\Assertion::greaterThan方法的典型用法代码示例。如果您正苦于以下问题:PHP Assertion::greaterThan方法的具体用法?PHP Assertion::greaterThan怎么用?PHP Assertion::greaterThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert\Assertion
的用法示例。
在下文中一共展示了Assertion::greaterThan方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPeriod
/**
* @param int $period
*
* @return self
*/
private function setPeriod($period)
{
Assertion::integer($period, 'Period must be at least 1.');
Assertion::greaterThan($period, 0, 'Period must be at least 1.');
$this->setParameter('period', $period);
return $this;
}
示例2: __construct
/**
* StorableJWKSet constructor.
*
* @param string $filename
* @param array $parameters
* @param int $nb_keys
*/
public function __construct($filename, array $parameters, $nb_keys)
{
Assertion::integer($nb_keys, 'The key set must contain at least one key.');
Assertion::greaterThan($nb_keys, 0, 'The key set must contain at least one key.');
$this->setFilename($filename);
$this->parameters = $parameters;
$this->nb_keys = $nb_keys;
}
示例3: __construct
public function __construct(string $eventStore = 'cqrs.event_store.cqrs_default', UuidInterface $previousEventId = null, int $delaySeconds = 0, int $throttleMicroseconds = 1000000)
{
Assertion::greaterOrEqualThan($delaySeconds, 0);
Assertion::greaterThan($throttleMicroseconds, 0);
$this->eventStore = $eventStore;
$this->delaySeconds = $delaySeconds;
$this->throttleMicroseconds = $throttleMicroseconds;
}
示例4: paginate
/**
* @param $page
* @param $itemsPerPage
*
* @throws \InvalidArgumentException
*
* @return Item[]
*/
public function paginate($page, $itemsPerPage)
{
Assertion::integer($page, 'Page should be an integer');
Assertion::integer($itemsPerPage, 'ItemsPerPage should be an integer');
Assertion::greaterThan($page, 0, 'Page should be grater than 0');
Assertion::greaterThan($itemsPerPage, 0, 'ItemsPerPage should be grater than 0');
return array_slice($this->findBy([], ['price' => 'ASC']), $page - 1, $itemsPerPage);
}
示例5: checkClaim
/**
* {@inheritdoc}
*/
public function checkClaim(JWTInterface $jwt)
{
if (!$jwt->hasClaim('exp')) {
return [];
}
$exp = (int) $jwt->getClaim('exp');
Assertion::greaterThan($exp, time(), 'The JWT has expired.');
return ['exp'];
}
示例6: enableSignedResponsesSupport
/**
* @param \Jose\JWTCreatorInterface $jwt_creator
* @param string $issuer
* @param string $signature_algorithm
* @param \Jose\Object\JWKSetInterface $signature_key_set
*/
public function enableSignedResponsesSupport(JWTCreatorInterface $jwt_creator, $issuer, $signature_algorithm, JWKSetInterface $signature_key_set)
{
Assertion::string($issuer);
Assertion::inArray($signature_algorithm, $jwt_creator->getSupportedSignatureAlgorithms());
Assertion::greaterThan($signature_key_set->countKeys(), 0, 'The signature key set must have at least one key.');
$this->setJWTCreator($jwt_creator);
$this->setIssuer($issuer);
$this->signature_key_set = $signature_key_set;
$this->signature_algorithm = $signature_algorithm;
}
示例7: __construct
/**
* JWTAccessTokenManager constructor.
*
* @param \Jose\JWTCreatorInterface $jwt_creator
* @param \Jose\JWTLoaderInterface $jwt_loader
* @param string $signature_algorithm
* @param \Jose\Object\JWKSetInterface $signature_key_set
* @param string $issuer
* @param string $key_encryption_algorithm
* @param string $content_encryption_algorithm
* @param \Jose\Object\JWKSetInterface $key_encryption_key_set
*/
public function __construct(JWTCreatorInterface $jwt_creator, JWTLoaderInterface $jwt_loader, $signature_algorithm, JWKSetInterface $signature_key_set, $key_encryption_algorithm, $content_encryption_algorithm, JWKSetInterface $key_encryption_key_set, $issuer)
{
Assertion::string($signature_algorithm);
Assertion::string($key_encryption_algorithm);
Assertion::string($content_encryption_algorithm);
Assertion::greaterThan($signature_key_set->countKeys(), 0, 'The signature key set must have at least one key.');
Assertion::greaterThan($key_encryption_key_set->countKeys(), 0, 'The encryption key set must have at least one key.');
Assertion::inArray($signature_algorithm, $jwt_creator->getSupportedSignatureAlgorithms());
Assertion::inArray($key_encryption_algorithm, $jwt_creator->getSupportedKeyEncryptionAlgorithms());
Assertion::inArray($content_encryption_algorithm, $jwt_creator->getSupportedContentEncryptionAlgorithms());
$this->signature_algorithm = $signature_algorithm;
$this->key_encryption_algorithm = $key_encryption_algorithm;
$this->content_encryption_algorithm = $content_encryption_algorithm;
$this->setIssuer($issuer);
$this->signature_key_set = $signature_key_set;
$this->key_encryption_key_set = $key_encryption_key_set;
$this->setJWTCreator($jwt_creator);
$this->setJWTLoader($jwt_loader);
}
示例8: 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);
}
示例9: enableEncryptedRequestObjectSupport
/**
* {@inheritdoc}
*/
public function enableEncryptedRequestObjectSupport(JWKSetInterface $key_encryption_key_set, $require_encryption)
{
Assertion::boolean($require_encryption);
Assertion::true($this->isRequestObjectSupportEnabled(), 'Request object support must be enabled first.');
Assertion::greaterThan($key_encryption_key_set->countKeys(), 0, 'The encryption key set must have at least one key.');
$this->require_encryption = $require_encryption;
$this->key_encryption_key_set = $key_encryption_key_set;
}
示例10: setIdTokenLifetime
/**
* @param int $id_token_lifetime
*/
public function setIdTokenLifetime($id_token_lifetime)
{
Assertion::integer($id_token_lifetime);
Assertion::greaterThan($id_token_lifetime, 0);
$this->id_token_lifetime = $id_token_lifetime;
}
示例11: getRevTime
/**
* Return the time for the given number of revolutions.
*
* @param int $revs
*
* @throws \OutOfBoundsException If revs <= 0
*
* @return float
*/
public function getRevTime($revs)
{
Assertion::greaterThan($revs, 0, 'Revolutions must be more than 0, got %s');
return $this->netTime / $revs;
}
示例12: __construct
public function __construct($limit)
{
$limit = (int) $limit;
Assertion::greaterThan($limit, 0, 'Limit must be greater than 0');
$this->limit = $limit;
}
示例13: getRandomJWKSetConfiguration
/**
* @param string $name
* @param string $storage_path
* @param int $nb_keys
* @param array $key_configuration
* @param bool $is_rotatable
* @param bool $is_public
*
* @return array
*/
private static function getRandomJWKSetConfiguration($name, $storage_path, $nb_keys, array $key_configuration, $is_rotatable = false, $is_public = true)
{
self::checkParameters($name, $is_public);
Assertion::string($storage_path);
Assertion::notEmpty($storage_path);
Assertion::integer($nb_keys);
Assertion::greaterThan($nb_keys, 0);
Assertion::boolean($is_rotatable);
return [self::BUNDLE_ALIAS => ['key_sets' => [$name => ['auto' => ['is_rotatable' => $is_rotatable, 'is_public' => $is_public, 'nb_keys' => $nb_keys, 'key_configuration' => $key_configuration, 'storage_path' => $storage_path]]]]];
}
示例14: decrypt
/**
* Decryption.
*
* @param \Jose\KeyConverter\RSAKey $key
* @param string $ciphertext
* @param string $hash_algorithm
*
* @return string
*/
public static function decrypt(RSAKey $key, $ciphertext, $hash_algorithm)
{
Assertion::greaterThan($key->getModulusLength(), 0);
$hash = Hash::$hash_algorithm();
$ciphertext = str_split($ciphertext, $key->getModulusLength());
$ciphertext[count($ciphertext) - 1] = str_pad($ciphertext[count($ciphertext) - 1], $key->getModulusLength(), chr(0), STR_PAD_LEFT);
$plaintext = '';
foreach ($ciphertext as $c) {
$temp = self::getRSAESOAEP($key, $c, $hash);
$plaintext .= $temp;
}
return $plaintext;
}
示例15: setInitialAccessTokenLifetime
/**
* @param int $initial_access_token_lifetime
*/
public function setInitialAccessTokenLifetime($initial_access_token_lifetime)
{
Assertion::integer($initial_access_token_lifetime);
Assertion::greaterThan($initial_access_token_lifetime, 0);
$this->initial_access_token_lifetime = $initial_access_token_lifetime;
}