本文整理汇总了PHP中Assert\Assertion::minLength方法的典型用法代码示例。如果您正苦于以下问题:PHP Assertion::minLength方法的具体用法?PHP Assertion::minLength怎么用?PHP Assertion::minLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert\Assertion
的用法示例。
在下文中一共展示了Assertion::minLength方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param null|string $identifierMethodName
* @param null|string $versionMethodName
* @param null|string $popRecordedEventsMethodName
* @param null|string $replayEventsMethodsName
* @param null|string $staticReconstituteFromHistoryMethodName
* @param null|callable $eventToMessageCallback
* @param null|callable $messageToEventCallback
*/
public function __construct($identifierMethodName = null, $versionMethodName = null, $popRecordedEventsMethodName = null, $replayEventsMethodsName = null, $staticReconstituteFromHistoryMethodName = null, $eventToMessageCallback = null, $messageToEventCallback = null)
{
if (null !== $identifierMethodName) {
Assertion::minLength($identifierMethodName, 1, 'Identifier method name needs to be a non empty string');
$this->identifierMethodName = $identifierMethodName;
}
if (null !== $versionMethodName) {
Assertion::minLength($versionMethodName, 1, 'Version method name needs to be a non empty string');
$this->versionMethodName = $versionMethodName;
}
if (null !== $popRecordedEventsMethodName) {
Assertion::minLength($popRecordedEventsMethodName, 1, 'Pop recorded events method name needs to be a non empty string');
$this->popRecordedEventsMethodName = $popRecordedEventsMethodName;
}
if (null !== $replayEventsMethodsName) {
Assertion::minLength($replayEventsMethodsName, 1, 'Replay events method name needs to be a non empty string');
$this->replayEventsMethodName = $replayEventsMethodsName;
}
if (null !== $staticReconstituteFromHistoryMethodName) {
Assertion::minLength($staticReconstituteFromHistoryMethodName, 1, 'Method name for static method reconstitute from history needs to be non empty string');
$this->staticReconstituteFromHistoryMethodName = $staticReconstituteFromHistoryMethodName;
}
if (null !== $eventToMessageCallback) {
Assertion::true(is_callable($eventToMessageCallback), 'EventToMessage callback needs to be a callable');
$this->eventToMessageCallback = $eventToMessageCallback;
}
if (null !== $messageToEventCallback) {
Assertion::true(is_callable($messageToEventCallback), 'MessageToEvent callback needs to be a callable');
$this->messageToEventCallback = $messageToEventCallback;
}
}
示例2: __construct
/**
* @param $text
*/
public function __construct($text)
{
Assertion::string($text);
Assertion::minLength($text, 1);
Assertion::maxLength($text, 1000);
$this->text = $text;
}
示例3: __construct
/**
* @param string $value
*/
public function __construct($value)
{
Assertion::string($value);
Assertion::minLength($value, 1);
Assertion::maxLength($value, 50);
$this->value = strtolower($value);
}
示例4: __construct
/**
* Constructor
*
* @param AMQPQueue $queue
* @param int $waitMicros
* @param string|null $appId
*/
public function __construct(AMQPQueue $queue, $waitMicros = 1000, $appId = null)
{
Assertion::min($waitMicros, 1);
$this->queue = $queue;
$this->waitMicros = $waitMicros;
if (null !== $appId) {
Assertion::minLength($appId, 1);
$this->appId = $appId;
}
}
示例5: __construct
/**
* @param MongoClient $mongoClient
* @param string $dbName
* @param array|null $writeConcern
* @param array $snapshotGridFsMap
*/
public function __construct(MongoClient $mongoClient, $dbName, array $writeConcern = null, array $snapshotGridFsMap = [])
{
Assertion::minLength($dbName, 1, 'Mongo database name is missing');
$this->mongoClient = $mongoClient;
$this->dbName = $dbName;
$this->snapshotGridFsMap = $snapshotGridFsMap;
if (null !== $writeConcern) {
$this->writeConcern = $writeConcern;
}
}
示例6: __construct
/**
* @param AggregateType $aggregateType
* @param string $aggregateId
* @param object $aggregateRoot
* @param int $lastVersion
* @param DateTimeImmutable $createdAt
*/
public function __construct(AggregateType $aggregateType, $aggregateId, $aggregateRoot, $lastVersion, DateTimeImmutable $createdAt)
{
Assertion::minLength($aggregateId, 1);
Assertion::isObject($aggregateRoot);
Assertion::min($lastVersion, 1);
$this->aggregateType = $aggregateType;
$this->aggregateId = $aggregateId;
$this->aggregateRoot = $aggregateRoot;
$this->lastVersion = $lastVersion;
$this->createdAt = $createdAt;
}
示例7: __construct
/**
* JsonRpcRequest constructor.
*
* @param string $server
* @param string $method
* @param array|string|integer|float|bool $params
* @param string $routingKey
* @param int $expiration in milliseconds
* @param string|null $id
* @param int $timestamp
*/
public function __construct(string $server, string $method, $params, string $id = null, string $routingKey = '', int $expiration = 0, int $timestamp = 0)
{
if (!is_array($params) && !is_scalar($params) && null !== $params) {
throw new Exception\InvalidArgumentException('Params must be of type array, scalar or null');
}
Assertion::minLength($server, 1);
$this->server = $server;
$this->method = $method;
$this->params = $params;
$this->id = $id;
$this->routingKey = $routingKey;
$this->expiration = $expiration;
$this->timestamp = 0 === $timestamp ? $timestamp : time();
}
示例8: __construct
/**
* RpcClientRequest constructor.
*
* @param array|string|integer|float|bool $payload
* @param string $server
* @param string $requestId
* @param string|null $routingKey
* @param int $expiration
* @param string|null $userId
* @param string|null $messageId
* @param string|null $timestamp
* @param string|null $type
*/
public function __construct($payload, $server, $requestId, $routingKey = null, $expiration = 0, $userId = null, $messageId = null, $timestamp = null, $type = null)
{
if (!is_array($payload) && !is_scalar($payload)) {
throw new Exception\InvalidArgumentException('$payload must be of type array or scalar');
}
Assertion::minLength($server, 1);
Assertion::minLength($requestId, 1);
Assertion::nullOrString($routingKey);
Assertion::min($expiration, 0);
Assertion::nullOrString($userId);
Assertion::nullOrString($messageId);
Assertion::nullOrString($timestamp);
Assertion::nullOrString($type);
$this->payload = $payload;
$this->server = $server;
$this->requestId = $requestId;
$this->routingKey = $routingKey;
$this->expiration = $expiration;
$this->userId = $userId;
$this->messageId = $messageId;
$this->timestamp = $timestamp;
$this->type = $type;
}
示例9: __construct
/**
* @param string $text
*/
private function __construct($text)
{
Assertion::minLength($text, 1, 'Success message must be at least 1 char long');
$this->text = $text;
$this->init();
}
示例10: __construct
/**
* @param MessageFactory $messageFactory
* @param MessageConverter $messageConverter
* @param \MongoClient $mongoClient
* @param string $dbName
* @param array|null $writeConcern
* @param string|null $streamCollectionName
* @param int|null $transactionTimeout
*/
public function __construct(MessageFactory $messageFactory, MessageConverter $messageConverter, \MongoClient $mongoClient, $dbName, array $writeConcern = null, $streamCollectionName = null, $transactionTimeout = null)
{
Assertion::minLength($dbName, 1, 'Mongo database name is missing');
$this->messageFactory = $messageFactory;
$this->messageConverter = $messageConverter;
$this->mongoClient = $mongoClient;
$this->dbName = $dbName;
if (null !== $streamCollectionName) {
Assertion::minLength($streamCollectionName, 1, 'Stream collection name must be a string with min length 1');
$this->streamCollectionName = $streamCollectionName;
}
if (null !== $writeConcern) {
$this->writeConcern = $writeConcern;
}
if (null !== $transactionTimeout) {
Assertion::min($transactionTimeout, 1, 'Transaction timeout must be a positive integer');
$this->transactionTimeout = $transactionTimeout;
}
}
示例11: hasMinLength
public function hasMinLength($value, $minLength)
{
parent::minLength($value, $minLength);
}
示例12: __construct
public function __construct($aName)
{
Assertion::string($aName, sprintf("An EventName must be a string %s given", Util::getType($aName)));
Assertion::minLength($aName, 5, sprintf("An EventName must be at least 5 chars long, less given in: %s", $aName));
$this->name = $aName;
}
示例13: containsFuzzyContext
public function containsFuzzyContext($partial)
{
Assertion::string($partial);
Assertion::minLength($partial, 1);
return mb_strpos(json_encode($this->logContext), $partial) !== false;
}
示例14: __construct
/**
* Create a new Password
*
* @param string $value
* @return void
*/
public function __construct($value)
{
Assertion::minLength($value, 8);
$this->value = $value;
}
示例15: setName
private function setName($name)
{
Assertion::minLength($name, 3, 'Chapter name must be at least 3 chars long');
$this->name = $name;
}