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


PHP ArrayUtility::flatten方法代码示例

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


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

示例1: mergeWithExistingConfiguration

 /**
  * Merge current local configuration over default configuration
  *
  * @param array $defaultConfiguration Default configuration from ext_conf_template.txt
  * @param string $extensionKey the extension information
  * @return array
  */
 protected function mergeWithExistingConfiguration(array $defaultConfiguration, $extensionKey)
 {
     try {
         $currentExtensionConfig = unserialize($this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class)->getConfigurationValueByPath('EXT/extConf/' . $extensionKey));
         if (!is_array($currentExtensionConfig)) {
             $currentExtensionConfig = array();
         }
     } catch (\RuntimeException $e) {
         $currentExtensionConfig = array();
     }
     $flatExtensionConfig = ArrayUtility::flatten($currentExtensionConfig);
     $valuedCurrentExtensionConfig = array();
     foreach ($flatExtensionConfig as $key => $value) {
         $valuedCurrentExtensionConfig[$key]['value'] = $value;
     }
     ArrayUtility::mergeRecursiveWithOverrule($defaultConfiguration, $valuedCurrentExtensionConfig);
     return $defaultConfiguration;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:25,代码来源:ConfigurationItemRepository.php

示例2: flattenCalculatesExpectedResult

 /**
  * @test
  * @param array $array
  * @param array $expected
  * @dataProvider flattenCalculatesExpectedResultDataProvider
  */
 public function flattenCalculatesExpectedResult(array $array, array $expected)
 {
     $this->assertEquals($expected, ArrayUtility::flatten($array));
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:10,代码来源:ArrayUtilityTest.php

示例3: generateBackendLayoutFromTsConfig

 /**
  * Generates a Backend Layout from PageTsConfig array
  *
  * @return mixed
  */
 protected function generateBackendLayoutFromTsConfig($identifier, $data)
 {
     if (!empty($data['config.']['backend_layout.']) && is_array($data['config.']['backend_layout.'])) {
         $backendLayout['uid'] = substr($identifier, 0, -1);
         $backendLayout['title'] = $data['title'] ? $data['title'] : $backendLayout['uid'];
         $backendLayout['icon'] = $data['icon'] ? $data['icon'] : '';
         /* Convert PHP array back to plain TypoScript so it can be procecced */
         $config = \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($data['config.']);
         $backendLayout['config'] = '';
         foreach ($config as $row => $value) {
             $backendLayout['config'] .= $row . " = " . $value . "\r\n";
         }
         return $backendLayout;
     }
     return NULL;
 }
开发者ID:neufeind,项目名称:bootstrap_package,代码行数:21,代码来源:BackendLayoutDataProvider.php

示例4: mergeWithExistingConfiguration

 /**
  * Merge new configuration with existing configuration
  *
  * @param array $configuration the new configuration array
  * @param array $extension the extension information
  * @return array
  */
 protected function mergeWithExistingConfiguration(array $configuration, array $extension)
 {
     try {
         $currentExtensionConfig = unserialize($this->configurationManager->getConfigurationValueByPath('EXT/extConf/' . $extension['key']));
     } catch (\RuntimeException $e) {
         $currentExtensionConfig = array();
     }
     $flatExtensionConfig = \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($currentExtensionConfig);
     $valuedCurrentExtensionConfig = array();
     foreach ($flatExtensionConfig as $key => $value) {
         $valuedCurrentExtensionConfig[$key]['value'] = $value;
     }
     $configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($configuration, $valuedCurrentExtensionConfig);
     return $configuration;
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:22,代码来源:ConfigurationItemRepository.php

示例5: arrayIsFlat

 /**
  * @param array $array
  * @param array $expected
  * @test
  * @dataProvider arrayIsFlatDataProvider
  */
 public function arrayIsFlat(array $array, array $expected)
 {
     $this->assertEquals($expected, \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($array));
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:10,代码来源:class.t3lib_utility_arrayTest.php

示例6: convertNestedToValuedConfiguration

 /**
  * Convert a nested configuration to a valued configuration
  *
  * array('first.' => array('second' => 1))
  * will become
  * array('first.second' => array('value' => 1)
  * @param array $nestedConfiguration
  * @return array
  */
 public function convertNestedToValuedConfiguration(array $nestedConfiguration)
 {
     $flatExtensionConfig = \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($nestedConfiguration);
     $valuedCurrentExtensionConfig = array();
     foreach ($flatExtensionConfig as $key => $value) {
         $valuedCurrentExtensionConfig[$key]['value'] = $value;
     }
     return $valuedCurrentExtensionConfig;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:18,代码来源:ConfigurationUtility.php

示例7: mergeWithExistingConfiguration

 /**
  * Merge new configuration with existing configuration
  *
  * @param array $configuration the new configuration array
  * @param array $extension the extension information
  * @return array
  */
 protected function mergeWithExistingConfiguration(array $configuration, array $extension)
 {
     $currentExtensionConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extension['key']]);
     $flatExtensionConfig = \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($currentExtensionConfig);
     $valuedCurrentExtensionConfig = array();
     foreach ($flatExtensionConfig as $key => $value) {
         $valuedCurrentExtensionConfig[$key]['value'] = $value;
     }
     if (is_array($currentExtensionConfig)) {
         $configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($configuration, $valuedCurrentExtensionConfig);
     }
     return $configuration;
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:20,代码来源:ConfigurationItemRepository.php


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