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


PHP DeploymentConfig::getSegment方法代码示例

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


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

示例1: testGetters

 public function testGetters()
 {
     $this->reader->expects($this->once())->method('load')->willReturn(self::$fixture);
     $this->assertSame(self::$flattenedFixture, $this->_deploymentConfig->get());
     // second time to ensure loader will be invoked only once
     $this->assertSame(self::$flattenedFixture, $this->_deploymentConfig->get());
     $this->assertSame('scalar_value', $this->_deploymentConfig->getSegment('segment1'));
     $this->assertSame(self::$fixture['segment2'], $this->_deploymentConfig->getSegment('segment2'));
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:9,代码来源:DeploymentConfigTest.php

示例2: _getCacheSettings

 /**
  * Retrieve settings for all cache front-ends known to the system
  *
  * @return array Format: array('<frontend_id>' => array(<cache_settings>), ...)
  */
 protected function _getCacheSettings()
 {
     /*
      * Merging is intentionally implemented through array_merge() instead of array_replace_recursive()
      * to avoid "inheritance" of the default settings that become irrelevant as soon as cache storage type changes
      */
     $cacheInfo = $this->_deploymentConfig->getSegment(CacheConfig::CONFIG_KEY);
     if (null !== $cacheInfo) {
         $cacheConfig = new CacheConfig($cacheInfo);
         return array_merge($this->_frontendSettings, $cacheConfig->getCacheFrontendSettings());
     }
     return $this->_frontendSettings;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:Pool.php

示例3: toOptionArray

 /**
  * Returns list of available resources
  *
  * @return array
  */
 public function toOptionArray()
 {
     $resourceOptions = [];
     $resourceInfo = $this->_deploymentConfig->getSegment(ResourceConfig::CONFIG_KEY);
     if (null !== $resourceInfo) {
         $resourceConfig = new ResourceConfig($resourceInfo);
         foreach (array_keys($resourceConfig->getData()) as $resourceName) {
             $resourceOptions[] = ['value' => $resourceName, 'label' => $resourceName];
         }
         sort($resourceOptions);
         reset($resourceOptions);
     }
     return $resourceOptions;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:19,代码来源:Database.php

示例4: _getCacheFrontendId

 /**
  * Retrieve cache frontend identifier, associated with a cache type
  *
  * @param string $cacheType
  * @return string
  */
 protected function _getCacheFrontendId($cacheType)
 {
     $result = null;
     $cacheInfo = $this->_deploymentConfig->getSegment(CacheConfig::CONFIG_KEY);
     if (null !== $cacheInfo) {
         $cacheConfig = new CacheConfig($cacheInfo);
         $result = $cacheConfig->getCacheTypeFrontendId($cacheType);
     }
     if (!$result) {
         if (isset($this->_typeFrontendMap[$cacheType])) {
             $result = $this->_typeFrontendMap[$cacheType];
         } else {
             $result = \Magento\Framework\App\Cache\Frontend\Pool::DEFAULT_FRONTEND_ID;
         }
     }
     return $result;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:23,代码来源:FrontendPool.php

示例5: __construct

 /**
  * @param Config\Reader $reader
  * @param \Magento\Framework\Config\ScopeInterface $configScope
  * @param \Magento\Framework\Config\CacheInterface $cache
  * @param \Magento\Framework\App\DeploymentConfig $deploymentConfig
  * @param string $cacheId
  * @throws \InvalidArgumentException
  */
 public function __construct(Config\Reader $reader, \Magento\Framework\Config\ScopeInterface $configScope, \Magento\Framework\Config\CacheInterface $cache, \Magento\Framework\App\DeploymentConfig $deploymentConfig, $cacheId = 'resourcesCache')
 {
     parent::__construct($reader, $configScope, $cache, $cacheId);
     foreach ($deploymentConfig->getSegment('resource') as $resourceName => $resourceData) {
         if (!isset($resourceData['connection'])) {
             throw new \InvalidArgumentException('Invalid initial resource configuration');
         }
         $this->_connectionNames[$resourceName] = $resourceData['connection'];
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:Config.php

示例6: load

 /**
  * Load statuses (enabled/disabled) of cache types
  *
  * @return void
  */
 private function load()
 {
     if (null === $this->statuses) {
         $this->statuses = [];
         if ($this->banAll) {
             return;
         }
         $this->statuses = $this->config->getSegment(ConfigSegment::SEGMENT_KEY) ?: [];
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:15,代码来源:State.php

示例7: deselectDisabledModules

 /**
  * Marks modules that are disabled in deploymentConfig as unselected.
  *
  * @return void
  */
 private function deselectDisabledModules()
 {
     $existingModules = $this->deploymentConfig->getSegment(ModuleDeployment::CONFIG_KEY);
     if (isset($existingModules)) {
         foreach ($existingModules as $module => $value) {
             if (!$value) {
                 $this->allModules[$module]['selected'] = false;
             }
         }
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:16,代码来源:ModuleStatus.php

示例8: getConnectionByName

 /**
  * Retrieve connection by $connectionName
  *
  * @param string $connectionName
  * @return bool|\Magento\Framework\DB\Adapter\AdapterInterface
  */
 public function getConnectionByName($connectionName)
 {
     if (isset($this->_connections[$connectionName])) {
         return $this->_connections[$connectionName];
     }
     $dbInfo = $this->deploymentConfig->getSegment(DbConfig::CONFIG_KEY);
     if (null === $dbInfo) {
         return false;
     }
     $dbConfig = new DbConfig($dbInfo);
     $connectionConfig = $dbConfig->getConnection($connectionName);
     if ($connectionConfig) {
         $connection = $this->_connectionFactory->create($connectionConfig);
     }
     if (empty($connection)) {
         return false;
     }
     $this->_connections[$connectionName] = $connection;
     return $connection;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:26,代码来源:Resource.php

示例9: loadConfigData

 /**
  * Loads configuration data only
  *
  * @return void
  */
 private function loadConfigData()
 {
     if (null === $this->configData) {
         $this->configData = $this->config->getSegment(ModuleList\DeploymentConfig::CONFIG_KEY);
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:11,代码来源:ModuleList.php

示例10: assertDbAccessible

 /**
  * Validates that MySQL is accessible and MySQL version is supported
  *
  * @return void
  */
 private function assertDbAccessible()
 {
     $segment = $this->deploymentConfig->getSegment(DbConfig::CONFIG_KEY);
     $dbConfig = new DbConfig($segment);
     $config = $dbConfig->getConnection(\Magento\Framework\App\Resource\Config::DEFAULT_SETUP_CONNECTION);
     $this->checkDatabaseConnection($config[DbConfig::KEY_NAME], $config[DbConfig::KEY_HOST], $config[DbConfig::KEY_USER], $config[DbConfig::KEY_PASS]);
     if (isset($config[DbConfig::KEY_PREFIX])) {
         $this->checkDatabaseTablePrefix($config[DbConfig::KEY_PREFIX]);
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:15,代码来源:Installer.php

示例11: getDbInstance

 /**
  * Retrieve the database adapter instance
  *
  * @return \Magento\TestFramework\Db\AbstractDb
  */
 public function getDbInstance()
 {
     if (null === $this->_db) {
         if ($this->isInstalled()) {
             $deploymentConfig = new DeploymentConfig(new \Magento\Framework\App\DeploymentConfig\Reader($this->dirList), []);
             $dbConfig = new DbConfig($deploymentConfig->getSegment(DbConfig::CONFIG_KEY));
             $dbInfo = $dbConfig->getConnection('default');
             $host = $dbInfo['host'];
             $user = $dbInfo['username'];
             $password = $dbInfo['password'];
             $dbName = $dbInfo['dbname'];
         } else {
             $installConfig = $this->getInstallConfig();
             $host = $installConfig['db_host'];
             $user = $installConfig['db_user'];
             $password = $installConfig['db_pass'];
             $dbName = $installConfig['db_name'];
         }
         $this->_db = new Db\Mysql($host, $user, $password, $dbName, $this->getTempDir(), $this->_shell);
     }
     return $this->_db;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:27,代码来源:Application.php


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