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


PHP ArrayHelper::isIndexedArray方法代码示例

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


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

示例1: trimMap

 public static function trimMap($map)
 {
     $trimmedMap = NULL;
     if (isset($map)) {
         foreach ($map as $key => $value) {
             $key = StringHelper::trim($key);
             $value = is_array($value) ? ArrayHelper::isIndexedArray($value) ? self::trimList($value) : self::trimMap($value) : StringHelper::trim($value);
             $trimmedMap[$key] = $value;
         }
     }
     return $trimmedMap;
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:12,代码来源:ArrayElementTrimmer.php

示例2: adjustParameters

 protected function adjustParameters($parameters)
 {
     $adjustedParameters = NULL;
     if (isset($parameters)) {
         if (is_array($parameters) && ArrayHelper::isIndexedArray($parameters)) {
             foreach ($parameters as $key => $compositeParameter) {
                 $adjustedParameters[$key] = $this->adjustCompositeParameter($compositeParameter);
             }
         } else {
             $adjustedParameters = $this->adjustCompositeParameter($parameters);
         }
     }
     return $adjustedParameters;
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:14,代码来源:DataQueryControllerRequestCleaner.php

示例3: mergeWith

 public static function mergeWith(&$instance, $source, $mergeCompositeProperty = FALSE)
 {
     if (isset($source)) {
         if (is_object($source) || is_array($source)) {
             foreach ($source as $name => $value) {
                 // source does not have value for the property
                 if (!isset($value)) {
                     continue;
                 }
                 // we do not support composite properties
                 if (is_object($value) || is_array($value)) {
                     if ($mergeCompositeProperty) {
                         if (!isset($instance->{$name})) {
                             $instance->{$name} = NULL;
                         }
                         if (is_object($value)) {
                             // support for an object
                             self::mergeWith($instance->{$name}, $value, TRUE);
                         } else {
                             if (ArrayHelper::isIndexedArray($value)) {
                                 // support for an indexed array
                                 $a = NULL;
                                 foreach ($value as $index => $v) {
                                     $o = NULL;
                                     self::mergeWith($o, $v, TRUE);
                                     $a[$index] = $o;
                                 }
                                 $instance->{$name} = $a;
                             } else {
                                 // support for an associative array
                                 self::mergeWith($instance->{$name}, $value, TRUE);
                             }
                         }
                     }
                     continue;
                 }
                 // overriding is not allowed
                 if (isset($instance->{$name}) && $instance->{$name} != $value) {
                     LogHelper::log_error(t("'@propertyName' property already contains value: @existingPropertyValue. Merge cannot be performed with new value: @newPropertyValue", array('@propertyName' => $name, '@existingPropertyValue' => $instance->{$name}, '@newPropertyValue' => $value)));
                     throw new UnsupportedOperationException(t("'@propertyName' property already contains value. Merge cannot be performed", array('@propertyName' => $name)));
                 }
                 $instance->{$name} = $value;
             }
         } else {
             $instance = $source;
         }
     }
     return $instance;
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:49,代码来源:ObjectHelper.php

示例4: addCompositeQueryValues

 public function addCompositeQueryValues($compositeQuery)
 {
     if (!isset($compositeQuery)) {
         return;
     }
     $isIndexedArray = ArrayHelper::isIndexedArray($compositeQuery);
     if ($isIndexedArray && count($compositeQuery) === 1) {
         $compositeQuery = $compositeQuery[0];
         $isIndexedArray = FALSE;
     }
     if ($isIndexedArray) {
         foreach ($compositeQuery as $query) {
             $this->addCompositeQueryValues($query);
         }
     } else {
         $index = count($this->queries);
         foreach ($compositeQuery as $name => $value) {
             $this->addQueryValues($index, $name, $value);
         }
     }
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:21,代码来源:AbstractDatasetQueryRequest.php

示例5: parseParameters

 public static function parseParameters(array $parameters = NULL)
 {
     if (!isset($parameters)) {
         return NULL;
     }
     $adjustedParameters = NULL;
     foreach ($parameters as $parameterIndex => $parameterProperties) {
         if (!is_array($parameterProperties)) {
             $parameterProperties = array($parameterProperties);
         }
         $isParameterPropertyDetected = FALSE;
         $parameterName = NULL;
         if (is_int($parameterIndex)) {
             if (!isset($parameterProperties[self::$QUERY_PARAMETER__COLUMN_NAME])) {
                 throw new IllegalArgumentException(t('Could not find corresponding column name for the parameter: @parameterIndex', array('@parameterIndex' => $parameterIndex)));
             }
             $parameterName = $parameterProperties[self::$QUERY_PARAMETER__COLUMN_NAME];
             unset($parameterProperties[self::$QUERY_PARAMETER__COLUMN_NAME]);
             $isParameterPropertyDetected = TRUE;
         } else {
             $parameterName = $parameterIndex;
         }
         $operatorName = NULL;
         if (isset($parameterProperties[self::$QUERY_PARAMETER__OPERATOR_NAME])) {
             $operatorName = $parameterProperties[self::$QUERY_PARAMETER__OPERATOR_NAME];
             unset($parameterProperties[self::$QUERY_PARAMETER__OPERATOR_NAME]);
             $isParameterPropertyDetected = TRUE;
         } else {
             $operatorName = EqualOperatorHandler::$OPERATOR__NAME;
         }
         $parameterValues = NULL;
         if (isset($parameterProperties[self::$QUERY_PARAMETER__OPERATOR_VALUE])) {
             $parameterValues = $parameterProperties[self::$QUERY_PARAMETER__OPERATOR_VALUE];
             unset($parameterProperties[self::$QUERY_PARAMETER__OPERATOR_VALUE]);
             $isParameterPropertyDetected = TRUE;
         }
         if (!$isParameterPropertyDetected) {
             $parameterValues = $parameterProperties;
             // marking that all properties are processed in the variable
             $parameterProperties = NULL;
         }
         // some properties are left and we do not know what to do with them
         if (count($parameterProperties) > 0) {
             throw new IllegalArgumentException(t('Unsupported keys for parameter definition: @unsupportedKeys', array('@unsupportedKeys' => implode(', ', array_keys($parameterProperties)))));
         }
         $operatorValues = NULL;
         if (isset($parameterValues)) {
             if (ArrayHelper::isIndexedArray($parameterValues)) {
                 $operatorValues = $parameterValues;
             } else {
                 // named operator value parameters are provided
                 // we need to order the values in the same order as the parameters defined for the operator
                 $operatorMetaData = OperatorFactory::getInstance()->getOperatorMetaData($operatorName);
                 $operatorParameterMetaDatas = $operatorMetaData->getParameters();
                 if (isset($operatorParameterMetaDatas)) {
                     foreach ($operatorParameterMetaDatas as $operatorParameterMetaData) {
                         $name = $operatorParameterMetaData->name;
                         $value = NULL;
                         if (isset($parameterValues[$name])) {
                             $value = $parameterValues[$name];
                             unset($parameterValues[$name]);
                         }
                         $operatorValues[] = $value;
                     }
                 }
                 // some named parameters are not recognized
                 if (count($parameterValues) > 0) {
                     throw new IllegalArgumentException(t('Unsupported keys for parameter value definition: @unsupportedKeys', array('@unsupportedKeys' => implode(', ', array_keys($parameterValues)))));
                 }
             }
         }
         $operator = OperatorFactory::getInstance()->initiateHandler($operatorName, $operatorValues);
         if (isset($adjustedParameters[$parameterName])) {
             $previousOperator = $adjustedParameters[$parameterName];
             if (is_array($previousOperator)) {
                 $adjustedParameters[$parameterName][] = $operator;
             } else {
                 $adjustedParameters[$parameterName] = array($previousOperator, $operator);
             }
         } else {
             $adjustedParameters[$parameterName] = $operator;
         }
     }
     return $adjustedParameters;
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:85,代码来源:DataQueryControllerUIRequestPreparer.php


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