本文整理汇总了PHP中Assert\Assertion::greaterOrEqualThan方法的典型用法代码示例。如果您正苦于以下问题:PHP Assertion::greaterOrEqualThan方法的具体用法?PHP Assertion::greaterOrEqualThan怎么用?PHP Assertion::greaterOrEqualThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert\Assertion
的用法示例。
在下文中一共展示了Assertion::greaterOrEqualThan方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getKey
/**
* @param int $index
*
* @return \Jose\Object\JWKInterface
*/
public function getKey($index)
{
Assertion::integer($index, 'The index must be a positive integer.');
Assertion::greaterOrEqualThan($index, 0, 'The index must be a positive integer.');
Assertion::true($this->hasKey($index), 'Undefined index.');
return $this->getKeys()[$index];
}
示例2: __construct
/**
* @param float $value
* @param string $currency
*
* @throws \InvalidArgumentException
*/
public function __construct($value, $currency)
{
Assertion::float($value);
Assertion::greaterOrEqualThan($value, PriceInterface::VALUE_MIN);
$this->value = $value;
$this->currency = $currency;
}
示例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: __construct
/**
* ClientAssertionJwt constructor.
*
* @param \Jose\JWTLoaderInterface $jwt_loader
* @param \OAuth2\Exception\ExceptionManagerInterface $exception_manager
* @param int $secret_lifetime
*/
public function __construct(JWTLoaderInterface $jwt_loader, ExceptionManagerInterface $exception_manager, $secret_lifetime = 0)
{
$this->setJWTLoader($jwt_loader);
$this->setExceptionManager($exception_manager);
Assertion::integer($secret_lifetime);
Assertion::greaterOrEqualThan($secret_lifetime, 0);
$this->secret_lifetime = $secret_lifetime;
}
示例5: __construct
/**
* ClientSecretBasic constructor.
*
* @param string $realm
* @param int $secret_lifetime
*/
public function __construct($realm, $secret_lifetime = 0)
{
Assertion::string($realm);
Assertion::integer($secret_lifetime);
Assertion::greaterOrEqualThan($secret_lifetime, 0);
$this->realm = $realm;
$this->secret_lifetime = $secret_lifetime;
}
示例6: __construct
private function __construct(Coords $startPoint, Coords $endPoint, $hits = 0)
{
Assertion::integer($hits);
Assertion::greaterOrEqualThan($hits, 0);
$size = $startPoint->distance($endPoint) + 1;
Assertion::greaterOrEqualThan($size, static::MINIMUM_SIZE);
Assertion::lessOrEqualThan($hits, $size);
$this->startPoint = $startPoint;
$this->endPoint = $endPoint;
$this->hits = $hits;
}
示例7: __construct
/**
* A value object that contains a geographical coordinate.
*
* @param $latitude
* @param $longitude
*/
public function __construct($latitude, $longitude)
{
Assertion::true(is_int($latitude) || is_float($latitude));
Assertion::true(is_int($longitude) || is_float($longitude));
Assertion::greaterOrEqualThan($latitude, -90.0);
Assertion::lessOrEqualThan($latitude, 90.0);
Assertion::greaterOrEqualThan($longitude, -180.0);
Assertion::lessOrEqualThan($longitude, 180.0);
$this->latitude = $latitude;
$this->longitude = $longitude;
}
示例8: verify
/**
* If the counter is not provided, the OTP is verified at the actual counter.
*
* {@inheritdoc}
*/
public function verify($otp, $counter = null, $window = null)
{
Assertion::string($otp, 'The OTP must be a string');
Assertion::nullOrInteger($counter, 'The counter must be null or an integer');
Assertion::greaterOrEqualThan($counter, 0, 'The counter must be at least 0.');
Assertion::nullOrInteger($window, 'The window parameter must be null or an integer');
if (null === $counter) {
$counter = $this->getCounter();
} elseif ($counter < $this->getCounter()) {
return false;
}
return $this->verifyOtpWithWindow($otp, $counter, $window);
}
示例9: __construct
public function __construct($time, $memory, $nbCalls, Document $traceDocument = null)
{
Assertion::integer($time, 'Time is not an integer, got "%s"');
Assertion::greaterOrEqualThan($time, 0, 'Time must be greater than 0, got "%s"');
Assertion::integer($memory, 'Memory was not an integer, got "%s"');
Assertion::greaterOrEqualThan($memory, 0);
Assertion::integer($nbCalls, 'Number of calls was not an integer, got "%s"');
Assertion::greaterOrEqualThan($nbCalls, 0);
$this->time = $time;
$this->memory = $memory;
$this->nbCalls = $nbCalls;
// not serialized.
$this->traceDocument = $traceDocument;
}
示例10: __construct
/**
* @param mixed $time Time taken to execute the iteration in microseconds.
*/
public function __construct($time)
{
Assertion::greaterOrEqualThan($time, 0, 'Time cannot be less than 0, got %s');
Assertion::integer($time);
$this->netTime = $time;
}
示例11: createRSAKey
/**
* {@inheritdoc}
*/
public static function createRSAKey(array $values)
{
Assertion::keyExists($values, 'size', 'The key size is not set.');
$size = $values['size'];
unset($values['size']);
Assertion::true(0 === $size % 8, 'Invalid key size.');
Assertion::greaterOrEqualThan($size, 384, 'Key length is too short. It needs to be at least 384 bits.');
$key = openssl_pkey_new(['private_key_bits' => $size, 'private_key_type' => OPENSSL_KEYTYPE_RSA]);
openssl_pkey_export($key, $out);
$rsa = new RSAKey($out);
$values = array_merge($values, $rsa->toArray());
return new JWK($values);
}
示例12: testGreaterOrEqualThanThrowsException
/**
* @dataProvider invalidGreaterOrEqualProvider
*
* @param mixed $value
* @param mixed $limit
*/
public function testGreaterOrEqualThanThrowsException($value, $limit)
{
$this->setExpectedException('Assert\\AssertionFailedException', null, Assertion::INVALID_GREATER_OR_EQUAL);
Assertion::greaterOrEqualThan($value, $limit);
}
示例13: withViewCount
/**
* @param int $viewCount
*
* @throws \InvalidArgumentException
*
* @return static
*/
public function withViewCount($viewCount)
{
Assertion::integer($viewCount);
Assertion::greaterOrEqualThan($viewCount, VideoInterface::VIEW_COUNT_MIN);
$instance = clone $this;
$instance->viewCount = $viewCount;
return $instance;
}
示例14: __construct
public function __construct($offset)
{
$offset = (int) $offset;
Assertion::greaterOrEqualThan($offset, 0, 'Offset cannot be lower than 0');
$this->offset = $offset;
}
示例15: setExpiresAt
/**
* {@inheritdoc}
*/
public function setExpiresAt($expires_at)
{
Assertion::integer($expires_at);
Assertion::greaterOrEqualThan($expires_at, 0);
$this->expires_at = $expires_at;
}