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


PHP Assert::oneOf方法代码示例

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


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

示例1: getMessages

 /**
  * {@inheritdoc}
  */
 public function getMessages(ConversationInterface $conversation, $offset = 0, $limit = 20, $sortDirection = 'ASC')
 {
     Assert::integer($offset, '$offset expected an integer in Repository::getMessages(). Got: %s');
     Assert::integer($limit, '$limit expected an integer in Repository::getMessages(). Got: %s');
     Assert::oneOf(strtoupper($sortDirection), ['ASC', 'DESC'], '$sortDirection expected either ASC or DESC in Repository::getMessages(). Got: %s');
     return $this->driver->findMessages($conversation, $offset, $limit, $sortDirection);
 }
开发者ID:MHaendel,项目名称:FOSMessage,代码行数:10,代码来源:Repository.php

示例2: __construct

 /**
  * Creates the violation.
  *
  * @param int         $code          The violation code. One of the constants
  *                                   defined in this class.
  * @param mixed       $invalidValue  The value that caused this violation.
  * @param string      $installerName The name of the validated installer.
  * @param string|null $parameterName The name of the validated installer
  *                                   parameter or `null` if this is a generic
  *                                   error.
  */
 public function __construct($code, $invalidValue, $installerName, $parameterName = null)
 {
     Assert::oneOf($code, self::$codes, 'The violation code %s is not valid.');
     Assert::stringNotEmpty($installerName, 'The installer name must be a non-empty string. Got: %s');
     Assert::nullOrStringNotEmpty($parameterName, 'The parameter name must be a non-empty string or null. Got: %s');
     $this->code = $code;
     $this->installerName = $installerName;
     $this->parameterName = $parameterName;
     $this->invalidValue = $invalidValue;
 }
开发者ID:puli,项目名称:asset-plugin,代码行数:21,代码来源:ConstraintViolation.php

示例3: __construct

 /**
  * Creates a new package DTO.
  *
  * @param string $name          The package name.
  * @param string $installerName The name of the installer.
  * @param string $installPath   The absolute install path.
  * @param string $state         One of the STATE_* constants in this class.
  */
 public function __construct($name, $installerName, $installPath, $state)
 {
     Assert::stringNotEmpty($name, 'The package name must be a non-empty string. Got: %s');
     Assert::string($installerName, 'The installer name must be a string. Got: %s');
     Assert::stringNotEmpty($installPath, 'The install path must be a non-empty string. Got: %s');
     Assert::oneOf($state, self::$states, 'The package state must be one of %2$s. Got: %s');
     $this->name = $name;
     $this->installerName = $installerName;
     $this->installPath = $installPath;
     $this->state = $state;
 }
开发者ID:WedgeSama,项目名称:composer-plugin,代码行数:19,代码来源:PuliPackage.php

示例4: moveLeaf

 /**
  * @param TaxonInterface $taxon
  * @param string $direction
  *
  * @throws ElementNotFoundException
  */
 private function moveLeaf(TaxonInterface $taxon, $direction)
 {
     Assert::oneOf($direction, [self::MOVE_DIRECTION_UP, self::MOVE_DIRECTION_DOWN]);
     $leaves = $this->getLeaves();
     foreach ($leaves as $leaf) {
         if ($leaf->getText() === $taxon->getName()) {
             $moveButton = $leaf->getParent()->find('css', sprintf('.sylius-taxon-move-%s', $direction));
             $moveButton->click();
             $moveButton->waitFor(5, function () use($moveButton) {
                 return $this->isOpen() && !$moveButton->hasClass('loading');
             });
             return;
         }
     }
     throw new ElementNotFoundException($this->getDriver(), sprintf('Move %s button for %s taxon', $direction, $taxon->getName()));
 }
开发者ID:sylius,项目名称:sylius,代码行数:22,代码来源:CreatePage.php

示例5: assertAddressType

 /**
  * @param string $type
  */
 private function assertAddressType($type)
 {
     $availableTypes = [self::TYPE_BILLING, self::TYPE_SHIPPING];
     Assert::oneOf($type, $availableTypes, sprintf('There are only two available types %s, %s. %s given', self::TYPE_BILLING, self::TYPE_SHIPPING, $type));
 }
开发者ID:sylius,项目名称:sylius,代码行数:8,代码来源:AddressPage.php

示例6: setVerbosity

 /**
  * Sets the verbosity level of the output.
  *
  * @param int $verbosity One of the constants {@link NORMAL}, {@link VERBOSE},
  *                       {@link VERY_VERBOSE} or {@link DEBUG}. Only output
  *                       with the given verbosity level or smaller will be
  *                       written out.
  */
 public function setVerbosity($verbosity)
 {
     Assert::oneOf($verbosity, array(IO::NORMAL, IO::VERBOSE, IO::VERY_VERBOSE, IO::DEBUG), 'The verbosity must be one of IO::NORMAL, IO::VERBOSE, IO::VERY_VERBOSE and IO::DEBUG.');
     $this->verbosity = (int) $verbosity;
 }
开发者ID:webmozart,项目名称:console,代码行数:13,代码来源:Output.php

示例7: iShouldBeAbleToShopUsingTheCurrency

 /**
  * @Then I should be able to shop using the :currencyCode currency
  */
 public function iShouldBeAbleToShopUsingTheCurrency($currencyCode)
 {
     $this->homePage->open();
     Assert::oneOf($currencyCode, $this->homePage->getAvailableCurrencies());
 }
开发者ID:origammi,项目名称:Sylius,代码行数:8,代码来源:CurrencyContext.php

示例8: iShouldBeAbleToShopUsingTheLocale

 /**
  * @Then I should be able to shop using the :localeName locale
  */
 public function iShouldBeAbleToShopUsingTheLocale($localeName)
 {
     $this->homePage->open();
     Assert::oneOf($localeName, $this->homePage->getAvailableLocales());
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:8,代码来源:LocaleContext.php

示例9: setDefaultColumnAlignment

 /**
  * Returns the default column alignment.
  *
  * @param int $alignment One of the {@link Alignment} constants.
  *
  * @return static The current instance.
  */
 public function setDefaultColumnAlignment($alignment)
 {
     Assert::oneOf($alignment, Alignment::all(), 'The default column alignment must be one of the Alignment constants. Got: %s');
     $this->defaultColumnAlignment = $alignment;
     return $this;
 }
开发者ID:webmozart,项目名称:console,代码行数:13,代码来源:TableStyle.php

示例10: getDetail

 /**
  * @param string $name
  *
  * @return mixed
  */
 public function getDetail($name)
 {
     Assert::oneOf($name, array_keys($this->details), 'ParsedKey::getDetail() expected one of: %2$s. Got: %s');
     return $this->details[$name];
 }
开发者ID:acmephp,项目名称:acmephp,代码行数:10,代码来源:ParsedKey.php

示例11: getResourceUrl

 /**
  * Find a resource URL.
  *
  * @param string $resource
  *
  * @return string
  */
 public function getResourceUrl($resource)
 {
     Assert::oneOf($resource, self::getResourcesNames(), 'Resource type "%s" is not supported by the ACME server (supported: %2$s)');
     return isset($this->serverResources[$resource]) ? $this->serverResources[$resource] : null;
 }
开发者ID:acmephp,项目名称:core,代码行数:12,代码来源:ResourcesDirectory.php

示例12: setSearchedRelationType

 /**
  * Set searchedRelationType
  *
  * @param string $searchedRelationType
  * @return User
  */
 public function setSearchedRelationType($searchedRelationType)
 {
     Assert::oneOf($searchedRelationType, self::availableSearchingTypes());
     $this->searchedRelationType = $searchedRelationType;
     return $this;
 }
开发者ID:winkutc,项目名称:server,代码行数:12,代码来源:User.php

示例13: setType

 /**
  * Set type
  *
  * @param string $type
  * @return Course
  */
 public function setType($type)
 {
     Assert::oneOf($type, [self::TYPE_C, self::TYPE_TD, self::TYPE_TP]);
     $this->type = $type;
     $this->refreshKey();
     return $this;
 }
开发者ID:winkutc,项目名称:server,代码行数:13,代码来源:Course.php

示例14: setCellAlignment

 /**
  * Sets the cell alignment.
  *
  * @param int $alignment One of the {@link Alignment} constants.
  *
  * @return static The current instance.
  */
 public function setCellAlignment($alignment)
 {
     Assert::oneOf($alignment, Alignment::all(), 'The cell alignment must be one of the Alignment constants. Got: %s');
     $this->cellAlignment = $alignment;
     return $this;
 }
开发者ID:webmozart,项目名称:console,代码行数:13,代码来源:GridStyle.php


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