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


PHP InvalidArgumentException::arrayOfArraysExpected方法代码示例

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


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

示例1: checkData

 /**
  * Check if data are valid
  *
  * @param AttributeInterface $attribute
  * @param mixed              $data
  *
  * @return mixed
  */
 protected function checkData(AttributeInterface $attribute, $data)
 {
     if (!is_array($data)) {
         throw InvalidArgumentException::arrayExpected($attribute->getCode(), 'setter', 'prices collection', gettype($data));
     }
     foreach ($data as $price) {
         if (!is_array($price)) {
             throw InvalidArgumentException::arrayOfArraysExpected($attribute->getCode(), 'setter', 'prices collection', gettype($data));
         }
         if (!array_key_exists('data', $price)) {
             throw InvalidArgumentException::arrayKeyExpected($attribute->getCode(), 'data', 'setter', 'prices collection', print_r($data, true));
         }
         if (!array_key_exists('currency', $price)) {
             throw InvalidArgumentException::arrayKeyExpected($attribute->getCode(), 'currency', 'setter', 'prices collection', print_r($data, true));
         }
     }
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:25,代码来源:PriceCollectionAttributeSetter.php

示例2: checkData

 /**
  * Check if data are valid
  *
  * @param AttributeInterface $attribute
  * @param mixed              $data
  *
  * @return mixed
  */
 protected function checkData(AttributeInterface $attribute, $data)
 {
     if (!is_array($data)) {
         throw InvalidArgumentException::arrayExpected($attribute->getCode(), 'adder', 'prices collection', gettype($data));
     }
     foreach ($data as $price) {
         if (!is_array($price)) {
             throw InvalidArgumentException::arrayOfArraysExpected($attribute->getCode(), 'adder', 'prices collection', gettype($data));
         }
         if (!array_key_exists('data', $price)) {
             throw InvalidArgumentException::arrayKeyExpected($attribute->getCode(), 'data', 'adder', 'prices collection', print_r($data, true));
         }
         if (!array_key_exists('currency', $price)) {
             throw InvalidArgumentException::arrayKeyExpected($attribute->getCode(), 'currency', 'adder', 'prices collection', print_r($data, true));
         }
         if (!is_numeric($price['data']) && null !== $price['data']) {
             throw InvalidArgumentException::arrayNumericKeyExpected($attribute->getCode(), 'data', 'adder', 'prices collection', gettype($price['data']));
         }
         if (!in_array($price['currency'], $this->currencyRepository->getActivatedCurrencyCodes())) {
             throw InvalidArgumentException::arrayInvalidKey($attribute->getCode(), 'currency', 'The currency does not exist', 'adder', 'prices collection', $price['currency']);
         }
     }
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:31,代码来源:PriceCollectionAttributeAdder.php

示例3: gettype

 function it_throws_an_error_if_attribute_data_does_not_contain_an_array(AttributeInterface $attribute, ProductInterface $product)
 {
     $attribute->getCode()->willReturn('attributeCode');
     $data = ['not an array'];
     $this->shouldThrow(InvalidArgumentException::arrayOfArraysExpected('attributeCode', 'remover', 'prices collection', gettype($data)))->during('removeAttributeData', [$product, $attribute, $data, ['locale' => 'fr_FR', 'scope' => 'mobile']]);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:6,代码来源:PriceCollectionAttributeRemoverSpec.php

示例4:

 function it_throws_an_exception_if_options_are_not_set_correctly()
 {
     $this->shouldThrow(InvalidArgumentException::arrayKeyExpected('completeness', 'locales', 'filter', 'completeness', print_r([], true)))->during('addFieldFilter', ['completeness', 'LOWER THAN ON ALL LOCALES', 100, null, 'mobile', []]);
     $this->shouldThrow(InvalidArgumentException::arrayOfArraysExpected('completeness', 'filter', 'completeness', print_r(['locales' => 'fr_FR'], true)))->during('addFieldFilter', ['completeness', 'LOWER THAN ON ALL LOCALES', 100, null, 'mobile', ['locales' => 'fr_FR']]);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:5,代码来源:CompletenessFilterSpec.php

示例5: checkOptions

 /**
  * Check if options are valid for complex operators
  *      GREATER_OR_EQUALS_THAN_ON_ALL_LOCALES
  *      GREATER_THAN_ON_ALL_LOCALES
  *      LOWER_OR_EQUALS_THAN_ON_ALL_LOCALES
  *      LOWER_THAN_ON_ALL_LOCALES
  *
  * @param string $field
  * @param array  $options
  */
 protected function checkOptions($field, array $options)
 {
     if (!array_key_exists('locales', $options)) {
         throw InvalidArgumentException::arrayKeyExpected($field, 'locales', 'filter', 'completeness', print_r($options, true));
     }
     if (!isset($options['locales']) || !is_array($options['locales'])) {
         throw InvalidArgumentException::arrayOfArraysExpected($field, 'filter', 'completeness', print_r($options, true));
     }
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:19,代码来源:CompletenessFilter.php

示例6: checkData

 /**
  * Check if data are valid
  * "data": doesn't need value
  *
  * @param AttributeInterface $attribute
  * @param mixed              $data
  *
  * @return mixed
  */
 protected function checkData(AttributeInterface $attribute, $data)
 {
     if (!is_array($data)) {
         throw InvalidArgumentException::arrayExpected($attribute->getCode(), 'remover', 'prices collection', gettype($data));
     }
     foreach ($data as $price) {
         if (!is_array($price)) {
             throw InvalidArgumentException::arrayOfArraysExpected($attribute->getCode(), 'remover', 'prices collection', gettype($data));
         }
         if (!array_key_exists('data', $price)) {
             throw InvalidArgumentException::arrayKeyExpected($attribute->getCode(), 'data', 'remover', 'prices collection', print_r($data, true));
         }
         if (!array_key_exists('currency', $price)) {
             throw InvalidArgumentException::arrayKeyExpected($attribute->getCode(), 'currency', 'remover', 'prices collection', print_r($data, true));
         }
         if (!in_array($price['currency'], $this->currencyManager->getActiveCodes())) {
             throw InvalidArgumentException::arrayInvalidKey($attribute->getCode(), 'currency', 'The currency does not exist', 'remover', 'prices collection', $price['currency']);
         }
     }
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:29,代码来源:PriceCollectionAttributeRemover.php


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