當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。