當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Assert::isArray方法代碼示例

本文整理匯總了PHP中Hesper\Core\Base\Assert::isArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Assert::isArray方法的具體用法?PHP Assert::isArray怎麽用?PHP Assert::isArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Hesper\Core\Base\Assert的用法示例。


在下文中一共展示了Assert::isArray方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isIndexExists

 public static function isIndexExists($array, $key, $message = null)
 {
     Assert::isArray($array);
     if (!array_key_exists($key, $array)) {
         throw new WrongArgumentException($message . ', ' . self::dumpArgument($key));
     }
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:7,代碼來源:Assert.php

示例2: setDefault

 /**
  * @return PrimitiveMultiList
  **/
 public function setDefault($default)
 {
     Assert::isArray($default);
     foreach ($default as $index) {
         Assert::isTrue(array_key_exists($index, $this->list));
     }
     return parent::setDefault($default);
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:11,代碼來源:PrimitiveMultiList.php

示例3: setValue

 /**
  * @return PrimitiveRegistryList
  **/
 public function setValue($value)
 {
     if ($value) {
         Assert::isArray($value);
         Assert::isInstance(current($value), Registry::class);
     }
     $this->value = $value;
     return $this;
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:12,代碼來源:PrimitiveRegistryList.php

示例4: cacheListByQuery

 protected function cacheListByQuery(SelectQuery $query, $array)
 {
     if ($array !== Cache::NOT_FOUND) {
         Assert::isArray($array);
         Assert::isTrue(current($array) instanceof Identifiable);
     }
     Cache::me()->mark($this->className)->add($this->makeQueryKey($query, self::SUFFIX_LIST), $array, Cache::EXPIRES_FOREVER);
     return $array;
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:9,代碼來源:CacheDaoWorker.php

示例5: __construct

 public function __construct($field, $words, $logic)
 {
     if (is_string($field)) {
         $field = new DBField($field);
     }
     Assert::isArray($words);
     $this->field = $field;
     $this->words = $words;
     $this->logic = $logic;
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:10,代碼來源:FullText.php

示例6: cacheListByQuery

 protected function cacheListByQuery(SelectQuery $query, $array, $expires = Cache::EXPIRES_FOREVER)
 {
     if ($array !== Cache::NOT_FOUND) {
         Assert::isArray($array);
         Assert::isTrue(current($array) instanceof Identifiable);
     }
     $key = $this->makeQueryKey($query, self::SUFFIX_LIST);
     Cache::me()->mark($this->className)->set($key, ['tags' => $this->getTagsForQuery($query), 'data' => $array], $expires);
     //			SemaphorePool::me()->free(self::LOCK_PREFIX.$key);
     return $array;
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:11,代碼來源:TaggableDaoWorker.php

示例7: cacheListByQuery

 protected function cacheListByQuery(SelectQuery $query, $array)
 {
     if ($array !== Cache::NOT_FOUND) {
         Assert::isArray($array);
         Assert::isTrue(current($array) instanceof Identifiable);
     }
     $cache = Cache::me();
     $key = $this->makeQueryKey($query, self::SUFFIX_LIST);
     if ($this->handler->touch($this->keyToInt($key))) {
         $cache->mark($this->className)->add($key, $array, Cache::EXPIRES_FOREVER);
     }
     return $array;
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:13,代碼來源:VoodooDaoWorker.php

示例8: toStringOneDeepLvl

 /**
  * @deprecated to support old convert method in CurlHttpClient
  *
  * @param array $array
  *
  * @return string
  */
 public static function toStringOneDeepLvl($array)
 {
     Assert::isArray($array);
     $result = [];
     foreach ($array as $key => $value) {
         if (is_array($value)) {
             foreach ($value as $valueKey => $simpleValue) {
                 $result[] = $key . '[' . $valueKey . ']=' . urlencode($simpleValue);
             }
         } else {
             $result[] = $key . '=' . urlencode($value);
         }
     }
     return implode('&', $result);
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:22,代碼來源:UrlParamsUtils.php

示例9: importValue

 public function importValue($value)
 {
     if ($value !== null) {
         Assert::isArray($value);
     } else {
         return null;
     }
     $result = true;
     $resultValue = [];
     foreach ($value as $id => $form) {
         Assert::isInstance($form, Form::class);
         $resultValue[$id] = $form;
         if ($form->getErrors()) {
             $result = false;
         }
     }
     $this->value = $resultValue;
     return $result;
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:19,代碼來源:PrimitiveFormsList.php

示例10: import

 /**
  * @param array $scope
  * from http request
  * looks like foo[1]=42&bar[1]=test&foo[2]=44&bar[2]=anothertest
  */
 public function import(array $scope)
 {
     $this->imported = true;
     foreach ($scope as $name => $paramList) {
         /**
          * @var array $paramList
          * looks like array(1 => 42, 2 => 44)
          */
         Assert::isArray($paramList);
         foreach ($paramList as $key => $value) {
             if (!isset($this->formList[$key])) {
                 $this->formList[$key] = clone $this->sampleForm;
             }
             $this->formList[$key]->importMore([$name => $value]);
         }
     }
     reset($this->formList);
     return $this;
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:24,代碼來源:FormCollection.php

示例11: cacheListByQuery

 protected function cacheListByQuery(SelectQuery $query, $array)
 {
     if ($array !== Cache::NOT_FOUND) {
         Assert::isArray($array);
         Assert::isTrue(current($array) instanceof Identifiable);
     }
     $cache = Cache::me();
     $listKey = $this->makeQueryKey($query, self::SUFFIX_LIST);
     $semKey = $this->keyToInt($this->indexKey);
     $pool = SemaphorePool::me();
     if ($pool->get($semKey)) {
         $this->syncMap($listKey);
         $cache->mark($this->className)->add($listKey, $array, Cache::EXPIRES_FOREVER);
         if ($array !== Cache::NOT_FOUND) {
             foreach ($array as $object) {
                 $this->cacheById($object);
             }
         }
         $pool->free($semKey);
     }
     return $array;
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:22,代碼來源:SmartDaoWorker.php

示例12: prepareFullText

 private static function prepareFullText($words, $logic)
 {
     Assert::isArray($words);
     $retval = self::quoteValue(implode(' ', $words));
     if (self::IN_BOOLEAN_MODE === $logic) {
         return addcslashes($retval, '+-<>()~*"') . ' ' . 'IN BOOLEAN MODE';
     } else {
         return $retval;
     }
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:10,代碼來源:MyDialect.php

示例13: __construct

 public function __construct(EntityProto $proto, &$object)
 {
     Assert::isArray($object);
     return parent::__construct($proto, $object);
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:5,代碼來源:ScopeSetter.php

示例14: makeList

 public function makeList($objectsList, $recursive = true)
 {
     if ($objectsList === null) {
         return null;
     }
     Assert::isArray($objectsList);
     $result = [];
     foreach ($objectsList as $id => $object) {
         $result[$id] = $this->makeListItemBuilder($object)->make($object, $recursive);
     }
     return $result;
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:12,代碼來源:PrototypedBuilder.php

示例15: getMirrorValues

 /**
  * @deprecated by array_combine($array, $array)
  **/
 public static function getMirrorValues($array)
 {
     Assert::isArray($array);
     $result = [];
     foreach ($array as $value) {
         Assert::isTrue(is_integer($value) || is_string($value), 'only integer or string values accepted');
         $result[$value] = $value;
     }
     return $result;
 }
開發者ID:justthefish,項目名稱:hesper,代碼行數:13,代碼來源:ArrayUtils.php


注:本文中的Hesper\Core\Base\Assert::isArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。