当前位置: 首页>>代码示例>>PHP>>正文


PHP Assertion::minLength方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:prooph,项目名称:event-store,代码行数:40,代码来源:ConfigurableAggregateTranslator.php

示例2: __construct

 /**
  * @param $text
  */
 public function __construct($text)
 {
     Assertion::string($text);
     Assertion::minLength($text, 1);
     Assertion::maxLength($text, 1000);
     $this->text = $text;
 }
开发者ID:vincecore,项目名称:sharemonkey,代码行数:10,代码来源:Text.php

示例3: __construct

 /**
  * @param string $value
  */
 public function __construct($value)
 {
     Assertion::string($value);
     Assertion::minLength($value, 1);
     Assertion::maxLength($value, 50);
     $this->value = strtolower($value);
 }
开发者ID:vincecore,项目名称:sharemonkey,代码行数:10,代码来源:Tag.php

示例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;
     }
 }
开发者ID:bweston92,项目名称:HumusAmqp,代码行数:17,代码来源:JsonRpcClient.php

示例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;
     }
 }
开发者ID:prooph,项目名称:snapshot-mongodb-adapter,代码行数:16,代码来源:MongoDbSnapshotAdapter.php

示例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;
 }
开发者ID:mikemix,项目名称:event-store,代码行数:18,代码来源:Snapshot.php

示例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();
 }
开发者ID:prolic,项目名称:HumusAmqp,代码行数:25,代码来源:JsonRpcRequest.php

示例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;
 }
开发者ID:bweston92,项目名称:HumusAmqp,代码行数:36,代码来源:RpcClientRequest.php

示例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();
 }
开发者ID:creativeprogramming,项目名称:event-store,代码行数:9,代码来源:QuickStartSucceeded.php

示例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;
     }
 }
开发者ID:bweston92,项目名称:event-store-mongodb-adapter,代码行数:28,代码来源:MongoDbEventStoreAdapter.php

示例11: hasMinLength

 public function hasMinLength($value, $minLength)
 {
     parent::minLength($value, $minLength);
 }
开发者ID:slaparra,项目名称:voting-details,代码行数:4,代码来源:AssertionAdapter.php

示例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;
 }
开发者ID:gingerwfms,项目名称:ginger-core,代码行数:6,代码来源:EventName.php

示例13: containsFuzzyContext

 public function containsFuzzyContext($partial)
 {
     Assertion::string($partial);
     Assertion::minLength($partial, 1);
     return mb_strpos(json_encode($this->logContext), $partial) !== false;
 }
开发者ID:metasyntactical,项目名称:inmemory-logger,代码行数:6,代码来源:LogEntry.php

示例14: __construct

 /**
  * Create a new Password
  *
  * @param string $value
  * @return void
  */
 public function __construct($value)
 {
     Assertion::minLength($value, 8);
     $this->value = $value;
 }
开发者ID:alle,项目名称:cribbb,代码行数:11,代码来源:Password.php

示例15: setName

 private function setName($name)
 {
     Assertion::minLength($name, 3, 'Chapter name must be at least 3 chars long');
     $this->name = $name;
 }
开发者ID:bweston92,项目名称:done,代码行数:5,代码来源:ChapterName.php


注:本文中的Assert\Assertion::minLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。