當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。