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


PHP Assertion::choice方法代码示例

本文整理汇总了PHP中Assert\Assertion::choice方法的典型用法代码示例。如果您正苦于以下问题:PHP Assertion::choice方法的具体用法?PHP Assertion::choice怎么用?PHP Assertion::choice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Assert\Assertion的用法示例。


在下文中一共展示了Assertion::choice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @param string $direction
  * @param int $days
  */
 public function __construct($direction, $days)
 {
     Assertion::integerish($days);
     Assertion::choice($direction, [self::DIRECTION_PAST, self::DIRECTION_FUTURE]);
     $this->direction = $direction;
     $this->days = (int) $days;
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:11,代码来源:ReleaseDateCondition.php

示例2: withResolution

 /**
  * @param string $resolution
  *
  * @throws \InvalidArgumentException
  *
  * @return static
  */
 public function withResolution($resolution)
 {
     $choices = [PriceInterface::RESOLUTION_HD, PriceInterface::RESOLUTION_SD];
     Assertion::choice($resolution, $choices);
     $instance = clone $this;
     $instance->resolution = $resolution;
     return $instance;
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:15,代码来源:Price.php

示例3: withAllowEmbed

 /**
  * @param string $allowEmbed
  *
  * @throws \InvalidArgumentException
  *
  * @return static
  */
 public function withAllowEmbed($allowEmbed)
 {
     $choices = [PlayerLocationInterface::ALLOW_EMBED_NO, PlayerLocationInterface::ALLOW_EMBED_YES];
     Assertion::choice($allowEmbed, $choices);
     $instance = clone $this;
     $instance->allowEmbed = $allowEmbed;
     return $instance;
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:15,代码来源:PlayerLocation.php

示例4: __construct

 /**
  * Constructor.
  *
  * @param Identifier $identifier
  * @param \DateTimeImmutable $createdAt
  * @param string $url
  * @param string $visibility
  */
 public function __construct(Identifier $identifier, \DateTimeImmutable $createdAt, $url, $visibility)
 {
     Assertion::choice($visibility, static::$visibilityEnum);
     Assertion::url($url);
     $this->identifier = $identifier;
     $this->createdAt = $createdAt;
     $this->url = $url;
     $this->visibility = $visibility;
 }
开发者ID:ben-gibson,项目名称:foursquare-venue-client,代码行数:17,代码来源:Photo.php

示例5: __construct

 /**
  * @param int $gender
  * @param string $firstName
  * @param string $lastName
  * @param string $email
  */
 public function __construct($gender, $firstName, $lastName, $email)
 {
     Assertion::choice($gender, [self::GENDER_MALE, self::GENDER_FEMALE]);
     Assertion::notEmpty($firstName);
     Assertion::notEmpty($lastName);
     Assertion::email($email);
     $this->gender = $gender;
     $this->firstName = $firstName;
     $this->lastName = $lastName;
     $this->email = $email;
 }
开发者ID:palya-framework,项目名称:palya,代码行数:17,代码来源:CustomerName.php

示例6: __construct

 /**
  * @param string $result
  * @param Coords $target
  * @param Coords $startPoint
  * @param Coords $endPoint
  */
 private function __construct($result, Coords $target, Coords $startPoint = null, Coords $endPoint = null)
 {
     Assertion::choice($result, [static::HIT, static::MISS, static::SANK, static::WIN]);
     if (in_array($result, [static::SANK, static::WIN])) {
         Assertion::notNull($startPoint);
         Assertion::notNull($endPoint);
     }
     $this->result = $result;
     $this->startPoint = $startPoint;
     $this->endPoint = $endPoint;
     $this->target = $target;
 }
开发者ID:WeCamp,项目名称:flyingliquourice,代码行数:18,代码来源:FireResult.php

示例7: array

 /**
  * Create a Config.
  *
  * @param string $sender Sender code to use.
  * @param string $wsdl WSDL file to use (local path or URL), null means default depending on the debug mode.
  * @param int $timeoutSec (Optional) Timeout in seconds, null means no timeout.
  * @param string $operatingMode (Optional) Operating mode, default is "P" for production. "D" = Development, "T" = Test.
  * @param array $soapClientOptions (Optional) Options for SoapClient.
  * @param string $receiver (Optional) Receiver code to use, default: YELLOWCUBE.
  */
 function __construct($sender, $wsdl = null, $timeoutSec = null, $operatingMode = 'P', array $soapClientOptions = array(), $receiver = 'YELLOWCUBE')
 {
     Assertion::notEmpty($sender, 'Sender must be set.');
     Assertion::nullOrNotEmpty($wsdl, 'WSDL must be set.');
     Assertion::nullOrInteger($timeoutSec, 'Timeout must be null or an integer in seconds.');
     Assertion::choice($operatingMode, array('T', 'D', 'P'), 'Operating mode must be "T", "D" or "P".');
     Assertion::notEmpty($receiver, 'Receiver must be set.');
     $this->sender = $sender;
     $this->wsdl = $wsdl;
     $this->timeoutSec = $timeoutSec;
     $this->operatingMode = $operatingMode;
     $this->soapClientOptions = $soapClientOptions;
     $this->receiver = $receiver;
 }
开发者ID:swisspost-yellowcube,项目名称:yellowcube-php,代码行数:24,代码来源:Config.php

示例8: __construct

 /**
  * @param UuidInterface $id
  * @param int $type
  * @param string $street
  * @param string $streetNumber
  * @param string $postalCode
  * @param string $city
  * @param string $state
  * @param string $country
  * @param string $phone
  */
 public function __construct(UuidInterface $id, $type, $street, $streetNumber, $postalCode, $city, $state, $country, $phone)
 {
     Assertion::uuid($id->toString());
     Assertion::choice($type, [self::TYPE_BILLING, self::TYPE_SHIPPING]);
     Assertion::notEmpty($street);
     Assertion::notEmpty($streetNumber);
     Assertion::notEmpty($postalCode);
     Assertion::notEmpty($city);
     Assertion::notEmpty($state);
     Assertion::notEmpty($country);
     Assertion::notEmpty($phone);
     $this->id = $id;
     $this->type = $type;
     $this->street = $street;
     $this->streetNumber = $streetNumber;
     $this->postalCode = $postalCode;
     $this->city = $city;
     $this->state = $state;
     $this->country = $country;
     $this->phone = $phone;
 }
开发者ID:palya-framework,项目名称:palya,代码行数:32,代码来源:CustomerAddress.php

示例9: __construct

 public function __construct($filters, $offset, $limit, $sortField, $sortOrder, $isPaginated)
 {
     Assertion::isArray($filters, "Invalid filters");
     Assertion::integerish($limit, "Invalid limit");
     Assertion::integerish($offset, "Invalid offset");
     Assertion::nullOrString($sortField, "Invalid sort field");
     Assertion::choice($sortOrder, [null, self::ORDER_ASC, self::ORDER_DESC], "Invalid sort order");
     Assertion::boolean($isPaginated, "Invalid value for isPaginated");
     if ($limit < 0) {
         throw new \InvalidArgumentException("Invalid limit");
     }
     if ($offset < 0) {
         throw new \InvalidArgumentException("Invalid offset");
     }
     $this->filters = $filters;
     $this->offset = (int) $offset;
     $this->limit = (int) $limit;
     $this->sortField = $sortField;
     $this->sortOrder = $sortOrder;
     $this->isPaginated = (bool) $isPaginated;
 }
开发者ID:domynation,项目名称:domynation-framework,代码行数:21,代码来源:SearchRequest.php

示例10: withLive

 /**
  * @param string $live
  *
  * @throws \InvalidArgumentException
  *
  * @return static
  */
 public function withLive($live)
 {
     $choices = [VideoInterface::LIVE_NO, VideoInterface::LIVE_YES];
     Assertion::choice($live, $choices);
     $instance = clone $this;
     $instance->live = $live;
     return $instance;
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:15,代码来源:Video.php

示例11: __construct

 /**
  * @param string $relationship
  *
  * @throws \InvalidArgumentException
  */
 public function __construct($relationship)
 {
     $choices = [PlatformInterface::RELATIONSHIP_ALLOW, PlatformInterface::RELATIONSHIP_DENY];
     Assertion::choice($relationship, $choices);
     $this->relationship = $relationship;
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:11,代码来源:Platform.php

示例12: __construct

 /**
  * @param string $value
  */
 private function __construct($value)
 {
     Guard::choice($value, $this->possibleValues());
     $this->value = $value;
 }
开发者ID:duronrulez,项目名称:ginger-php,代码行数:8,代码来源:ChoiceBasedValueObject.php

示例13: __construct

 private function __construct($type)
 {
     Assertion::choice($type, ['read', 'write']);
     $this->type = $type;
 }
开发者ID:phpinpractice,项目名称:event-store,代码行数:5,代码来源:Privilege.php

示例14: withChangeFrequency

 /**
  * @param string $changeFrequency
  *
  * @throws \InvalidArgumentException
  *
  * @return static
  */
 public function withChangeFrequency($changeFrequency)
 {
     $choices = [UrlInterface::CHANGE_FREQUENCY_ALWAYS, UrlInterface::CHANGE_FREQUENCY_HOURLY, UrlInterface::CHANGE_FREQUENCY_DAILY, UrlInterface::CHANGE_FREQUENCY_WEEKLY, UrlInterface::CHANGE_FREQUENCY_MONTHLY, UrlInterface::CHANGE_FREQUENCY_YEARLY, UrlInterface::CHANGE_FREQUENCY_NEVER];
     Assertion::choice($changeFrequency, $choices);
     $instance = clone $this;
     $instance->changeFrequency = $changeFrequency;
     return $instance;
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:15,代码来源:Url.php

示例15: __construct

 /**
  * @param string $algo
  */
 public function __construct($algo)
 {
     Assertion::choice($algo, hash_algos());
     $this->algo = $algo;
 }
开发者ID:indigophp,项目名称:guardian,代码行数:8,代码来源:Hash.php


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