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


PHP ArrayHelper::printArray方法代码示例

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


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

示例1: formatRecord

 public function formatRecord(array &$records = NULL, $record)
 {
     $result = parent::formatRecord($records, $record);
     if ($result) {
         $this->errorUnsupportedChainOfResultFormatters();
     }
     $recordKey = NULL;
     foreach ($this->keyColumnNames as $columnName) {
         $recordKey[] = isset($record[$columnName]) ? $record[$columnName] : NULL;
     }
     $key = ArrayHelper::prepareCompositeKey($recordKey);
     if (isset($records[$key])) {
         if ($this->isColumnValueUnique) {
             throw new IllegalArgumentException(t('Found several records for the key: @key', array('@key' => ArrayHelper::printArray($recordKey, ', ', TRUE, TRUE))));
         }
         $records[$key][] = $record;
     } else {
         if ($this->isColumnValueUnique) {
             $records[$key] = $record;
         } else {
             $records[$key][] = $record;
         }
     }
     return TRUE;
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:25,代码来源:QueryKeyResultFormatter.php

示例2: getValues

 public function getValues(array $names)
 {
     $timeStart = microtime(TRUE);
     $values = parent::getValues($names);
     $nameCount = count($names);
     $loadedValueCount = count($values);
     LogHelper::log_debug(t('[@cacheType] Requested entries: @entryNames', array('@cacheType' => $this->getCacheType(), '@entryNames' => ArrayHelper::printArray(array_values($names), ', ', TRUE, FALSE))));
     LogHelper::log_debug(t('[@cacheType] Retrieved entries: @entryNames', array('@cacheType' => $this->getCacheType(), '@entryNames' => $nameCount == $loadedValueCount ? 'ALL' : (isset($values) ? ArrayHelper::printArray(array_keys($values), ', ', TRUE, FALSE) : 'NONE'))));
     LogHelper::log_info(t('[@cacheType] Execution time for retrieving @entryCount entries is !executionTime. @successFlag', array('@cacheType' => $this->getCacheType(), '@entryCount' => $nameCount, '!executionTime' => ExecutionPerformanceHelper::formatExecutionTime($timeStart), '@successFlag' => isset($values) ? $nameCount == $loadedValueCount ? 'Cache HIT' : "Cache hit for ONLY {$loadedValueCount} entries out of {$nameCount}" : 'Cache NOT hit')));
     return $values;
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:11,代码来源:AbstractSharedCacheHandler.php

示例3: selectDataType

 public function selectDataType(array $datatypes, $selectCompatible = TRUE)
 {
     // eliminating null records from the array
     if (isset($datatypes)) {
         foreach ($datatypes as $index => $datatype) {
             if (!isset($datatype)) {
                 unset($datatypes[$index]);
             }
         }
         if (count($datatypes) == 0) {
             $datatypes = NULL;
         }
     }
     if (!isset($datatypes)) {
         return NULL;
     }
     // checking if all elements are equal
     $selectedDataType = NULL;
     foreach ($datatypes as $datatype) {
         if (isset($selectedDataType)) {
             if ($selectedDataType != $datatype) {
                 $selectedDataType = NULL;
                 break;
             }
         } else {
             $selectedDataType = $datatype;
         }
     }
     if (isset($selectedDataType)) {
         return $selectedDataType;
     }
     // checking if we need to return compatible type
     if (!$selectCompatible) {
         // if some types are not compatible we need to return the lowest compatible type
         if (!$this->areCompatible($datatypes)) {
             $selectCompatible = TRUE;
         }
     }
     $selectedDataTypes = $datatypes;
     if ($selectCompatible) {
         do {
             $initialDataTypeCount = count($selectedDataTypes);
             $selectedDataTypes = $this->selectCompatible($selectedDataTypes);
             $selectedDataTypeCount = count($selectedDataTypes);
             if ($initialDataTypeCount > 1 && $initialDataTypeCount == $selectedDataTypeCount) {
                 throw new IncompatibleDataTypeException(t('Data types are inter-compatible. Single type could not be selected: @datatypes', array('@datatypes' => ArrayHelper::printArray($datatypes, ',', TRUE, FALSE))));
             }
         } while ($selectedDataTypeCount > 1);
     } else {
         // it is expected that we have only 2 types here
         while (($datatypeCount = count($selectedDataTypes)) >= 2) {
             $datatypeA = $selectedDataTypes[0];
             $datatypeB = $selectedDataTypes[1];
             $selectedByDataTypeA = $this->getHandler($datatypeA)->selectCompatible($datatypeB);
             $selectedByDataTypeB = $this->getHandler($datatypeB)->selectCompatible($datatypeA);
             $selectedDataType = NULL;
             if (isset($selectedByDataTypeA)) {
                 if (isset($selectedByDataTypeB)) {
                     throw new IncompatibleDataTypeException(t("Data types '@datatypeA' and '@datatypeB' are inter-compatible. Single type could not be selected", array('@datatypeA' => $datatypeA, '@datatypeB' => $datatypeB)));
                 } else {
                     $selectedDataType = $selectedByDataTypeA;
                 }
             } elseif (isset($selectedByDataTypeB)) {
                 $selectedDataType = $selectedByDataTypeB;
             } else {
                 throw new UnsupportedOperationException();
             }
             $selectedDataTypes = array_slice($selectedDataTypes, 2);
             // selecting opposite data type. We do not need the lowest compatible type
             $selectedDataTypes[] = $selectedDataType == $datatypeA ? $datatypeB : $datatypeA;
         }
     }
     if (count($selectedDataTypes) == 1) {
         return $selectedDataTypes[0];
     } else {
         throw new IncompatibleDataTypeException(t('Incompatible data types: @datatypes', array('@datatypes' => ArrayHelper::printArray($datatypes, ',', TRUE, FALSE))));
     }
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:78,代码来源:DefaultDataTypeFactory.php

示例4: findNestedLinkByDatasetNameAndParentColumnNames

 public function findNestedLinkByDatasetNameAndParentColumnNames($datasetName, $parentColumnNames)
 {
     $selectedNestedLink = NULL;
     if (isset($this->nestedLinks)) {
         $parentColumnCount = count($parentColumnNames);
         foreach ($this->nestedLinks as $nestedLink) {
             if ($nestedLink->dataset->name !== $datasetName) {
                 continue;
             }
             $nestedLinkParentColumnCount = count($nestedLink->parentColumnNames);
             if ($nestedLinkParentColumnCount != $parentColumnCount) {
                 continue;
             }
             foreach ($nestedLink->parentColumnNames as $parentColumnIndex => $nestedLinkParentColumnName) {
                 if (!isset($parentColumnNames[$parentColumnIndex])) {
                     continue 2;
                 }
                 if ($nestedLinkParentColumnName != $parentColumnNames[$parentColumnIndex]) {
                     continue 2;
                 }
             }
             if (isset($selectedNestedLink)) {
                 throw new UnsupportedOperationException(t("Found several nested reference links for '@datasetName' dataset by the parent columns: @parentColumns", array('@datasetName' => $datasetName, '@parentColumns' => ArrayHelper::printArray($parentColumnNames, ', ', TRUE, FALSE))));
             }
             $selectedNestedLink = $nestedLink;
         }
     }
     return $selectedNestedLink;
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:29,代码来源:ReferenceLink.php


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