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


PHP Config::toArray方法代码示例

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


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

示例1: connect

 /**
  *
  * @throws \Exception
  * @return boolean
  */
 public function connect()
 {
     $this->session = ssh2_connect($this->config->host, $this->config->port);
     if (false === $this->session) {
         throw new \Exception("Echec de la connexion ssh " . print_r($this->config->toArray(), true));
     }
     $auth = ssh2_auth_pubkey_file($this->session, $this->config->username, $this->config->pubkeyfile, $this->config->privkeyfile);
     if (true !== $auth) {
         throw new \Exception("Echec de l'authentification ssh " . print_r($this->config->toArray(), true));
     }
     return true;
 }
开发者ID:dsi-agpt,项目名称:minibus,代码行数:17,代码来源:ScpClient.php

示例2: getDocumentManager

 /**
  * @return DocumentManager
  */
 public function getDocumentManager()
 {
     $factory = new DocumentManagerFactory();
     $sm = Bootstrap::getServiceManager();
     $sm->setAllowOverride(true);
     $config = $sm->get('Config');
     $c = new Config(['eoko' => ['odm' => ['hydrator' => ['class' => 'Zend\\Stdlib\\Hydrator\\ClassMethods', 'strategies' => ['Eoko\\ODM\\Metadata\\Annotation\\DateTime' => new DateTimeFormatterStrategy()]]]]]);
     $c->merge(new Config($config));
     $sm->setService('Config', $c->toArray());
     return $factory->createService($sm);
 }
开发者ID:eoko,项目名称:odm-documentmanager,代码行数:14,代码来源:BaseTestCase.php

示例3: init

 /**
  * Merges the app config with the siteaccess config
  */
 public function init()
 {
     // Add siteaccess specific config
     $configHandler = new Config($this->serviceManager->get('config'));
     $configHandler->merge($this->addConfig());
     $this->serviceManager->setAllowOverride(true);
     $this->serviceManager->setService('config', $configHandler->toArray());
     $this->serviceManager->setAllowOverride(false);
     // not needed I think
     #$this->baseXMSServices->setService( 'siteaccess', $this );
 }
开发者ID:pkamps,项目名称:basexms,代码行数:14,代码来源:SiteAccess.php

示例4: process

 /**
  * Process
  *
  * @param  Config $config
  * @return Config
  * @throws InvalidArgumentException
  */
 public function process(Config $config)
 {
     $data = $config->toArray();
     array_walk_recursive($data, function (&$value, $key) {
         if (preg_match('/callable\\((.*)\\)/', $value, $matches)) {
             list($class, $method) = array_map('trim', explode(',', $matches[1]));
             $value = [new $class(), $method];
         }
     });
     return new Config($data, true);
 }
开发者ID:alex-oleshkevich,项目名称:zf-extras,代码行数:18,代码来源:CallableProperty.php

示例5: getFormatsForRecord

 /**
  * Get an array of strings representing formats in which a specified record's
  * data may be exported (empty if none).  Legal values: "BibTeX", "EndNote",
  * "MARC", "MARCXML", "RDF", "RefWorks".
  *
  * @param \VuFind\RecordDriver\AbstractBase $driver Record driver
  *
  * @return array Strings representing export formats.
  */
 public function getFormatsForRecord($driver)
 {
     // Get an array of enabled export formats (from config, or use defaults
     // if nothing in config array).
     $active = isset($this->mainConfig->Export) ? $this->mainConfig->Export->toArray() : ['RefWorks' => true, 'EndNote' => true];
     // Loop through all possible formats:
     $formats = [];
     foreach (array_keys($this->exportConfig->toArray()) as $format) {
         if (isset($active[$format]) && $active[$format] && $this->recordSupportsFormat($driver, $format)) {
             $formats[] = $format;
         }
     }
     // Send back the results:
     return $formats;
 }
开发者ID:guenterh,项目名称:vufind,代码行数:24,代码来源:Export.php

示例6: getFormatsForRecord

 /**
  * Get an array of strings representing formats in which a specified record's
  * data may be exported (empty if none).  Legal values: "BibTeX", "EndNote",
  * "MARC", "MARCXML", "RDF", "RefWorks".
  *
  * @param \VuFind\RecordDriver\AbstractBase $driver Record driver
  *
  * @return array Strings representing export formats.
  */
 public function getFormatsForRecord($driver)
 {
     // Get an array of enabled export formats (from config, or use defaults
     // if nothing in config array).
     $active = $this->getActiveFormats('record');
     // Loop through all possible formats:
     $formats = [];
     foreach (array_keys($this->exportConfig->toArray()) as $format) {
         if (in_array($format, $active) && $this->recordSupportsFormat($driver, $format)) {
             $formats[] = $format;
         }
     }
     // Send back the results:
     return $formats;
 }
开发者ID:datavoyager,项目名称:vufind,代码行数:24,代码来源:Export.php

示例7: getNavigation

 /**
  * @throws \ErrorException
  *
  * @return array
  */
 public function getNavigation()
 {
     try {
         $navigationDefinition = Factory::fromFile($this->rootNavigationFile, true);
     } catch (\Exception $e) {
         $navigationDefinition = new Config([]);
     }
     foreach ($this->navigationSchemaFinder->getSchemaFiles() as $moduleNavigationFile) {
         if (!file_exists($moduleNavigationFile->getPathname())) {
             throw new ErrorException('Navigation-File does not exist: ' . $moduleNavigationFile);
         }
         $configFromFile = Factory::fromFile($moduleNavigationFile->getPathname(), true);
         $navigationDefinition->merge($configFromFile);
     }
     return $navigationDefinition->toArray();
 }
开发者ID:spryker,项目名称:Application,代码行数:21,代码来源:NavigationCollector.php

示例8: substituteVars

 /**
  * Substitute defined variables, if any found and return the new configuration object
  *
  * @param Config $config
  * @param string $prefix
  * @param string $suffix
  * @return Config
  */
 protected function substituteVars(Config $config, $prefix = '{', $suffix = '}')
 {
     $arrayConfig = $config->toArray();
     if (isset($arrayConfig['variables'])) {
         $vars = array_map(function ($x) use($prefix, $suffix) {
             return $prefix . $x . $suffix;
         }, array_keys($arrayConfig['variables']));
         $vals = array_values($arrayConfig['variables']);
         $tokens = array_combine($vars, $vals);
         $processor = new Token();
         $processor->setTokens($tokens);
         $processor->process($config);
         // Remove variables node
         unset($config->variables);
     }
     return $config;
 }
开发者ID:ripaclub,项目名称:zf2-sphinxsearch-tool,代码行数:25,代码来源:SphinxConf.php

示例9: __construct

 /**
  * 构造函数
  *
  * @param Config $config            
  * @param string $collection            
  * @param string $database            
  * @param string $cluster            
  * @param string $collectionOptions            
  * @throws \Exception
  */
 public function __construct(Config $config, $collection = null, $database = DEFAULT_DATABASE, $cluster = DEFAULT_CLUSTER, $collectionOptions = null)
 {
     // 检测是否加载了FirePHP
     if (!class_exists("FirePHP")) {
         throw new \Exception('请安装FirePHP');
     }
     if (!class_exists("MongoClient")) {
         throw new \Exception('请安装MongoClient');
     }
     if ($collection === null) {
         throw new \Exception('$collection集合为空');
     }
     $this->_collection = $collection;
     $this->_database = $database;
     $this->_cluster = $cluster;
     $this->_collectionOptions = $collectionOptions;
     $this->_configInstance = $config;
     $this->_config = $config->toArray();
     if (!isset($this->_config[$this->_cluster])) {
         throw new \Exception('Config error:no cluster key');
     }
     if (!isset($this->_config[$this->_cluster]['dbs'][$this->_database])) {
         throw new \Exception('Config error:no database init');
     }
     if (!isset($this->_config[$this->_cluster]['dbs'][DB_ADMIN])) {
         throw new \Exception('Config error:admin database init');
     }
     if (!isset($this->_config[$this->_cluster]['dbs'][DB_BACKUP])) {
         throw new \Exception('Config error:backup database init');
     }
     if (!isset($this->_config[$this->_cluster]['dbs'][DB_MAPREDUCE])) {
         throw new \Exception('Config error:mapreduce database init');
     }
     $this->_db = $this->_config[$this->_cluster]['dbs'][$this->_database];
     if (!$this->_db instanceof \MongoDB) {
         throw new \Exception('$this->_db is not instanceof \\MongoDB');
     }
     $this->_admin = $this->_config[$this->_cluster]['dbs'][DB_ADMIN];
     if (!$this->_admin instanceof \MongoDB) {
         throw new \Exception('$this->_admin is not instanceof \\MongoDB');
     }
     $this->_backup = $this->_config[$this->_cluster]['dbs'][DB_BACKUP];
     if (!$this->_backup instanceof \MongoDB) {
         throw new \Exception('$this->_backup is not instanceof \\MongoDB');
     }
     $this->_mapreduce = $this->_config[$this->_cluster]['dbs'][DB_MAPREDUCE];
     if (!$this->_mapreduce instanceof \MongoDB) {
         throw new \Exception('$this->_mapreduce is not instanceof \\MongoDB');
     }
     $this->_fs = new \MongoGridFS($this->_db, GRIDFS_PREFIX);
     // 默认执行几个操作
     // 第一个操作,判断集合是否创建,如果没有创建,则进行分片处理(目前采用_ID作为片键)
     if (APPLICATION_ENV === 'production') {
         $this->shardingCollection();
     }
     parent::__construct($this->_db, $this->_collection);
     /**
      * 设定读取优先级
      * MongoClient::RP_PRIMARY 只读取主db
      * MongoClient::RP_PRIMARY_PREFERRED 读取主db优先
      * MongoClient::RP_SECONDARY 只读从db优先
      * MongoClient::RP_SECONDARY_PREFERRED 读取从db优先
      */
     // $this->db->setReadPreference(\MongoClient::RP_SECONDARY_PREFERRED);
     $this->db->setReadPreference(\MongoClient::RP_PRIMARY_PREFERRED);
 }
开发者ID:im286er,项目名称:ent,代码行数:76,代码来源:MongoCollection.php

示例10: testSetOptionsOmitsAccessorsRequiringObjectsOrMultipleParams

 public function testSetOptionsOmitsAccessorsRequiringObjectsOrMultipleParams()
 {
     $options = $this->getOptions();
     $config = new Config($options);
     $options['config'] = $config;
     $options['options'] = $config->toArray();
     $options['pluginLoader'] = true;
     $options['view'] = true;
     $options['translator'] = true;
     $options['attrib'] = true;
     $this->group->setOptions($options);
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:12,代码来源:DisplayGroupTest.php

示例11: _sortRootElements

 /**
  * Root elements that are not assigned to any section needs to be
  * on the top of config.
  * 
  * @see    http://framework.zend.com/issues/browse/ZF-6289
  * @param  Zend\Config
  * @return Zend\Config
  */
 protected function _sortRootElements(\Zend\Config\Config $config)
 {
     $configArray = $config->toArray();
     $sections = array();
     // remove sections from config array
     foreach ($configArray as $key => $value) {
         if (is_array($value)) {
             $sections[$key] = $value;
             unset($configArray[$key]);
         }
     }
     // readd sections to the end
     foreach ($sections as $key => $value) {
         $configArray[$key] = $value;
     }
     return new \Zend\Config\Config($configArray);
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:25,代码来源:Ini.php

示例12: dumpConfig

 /**
  * Export config in a format to be stored to config file
  *
  * @param Config $config
  * @return string
  */
 private static function dumpConfig(Config $config)
 {
     return '<' . "?php\nreturn " . var_export($config->toArray(), 1) . ";\n";
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:10,代码来源:class.setup.php

示例13: testZF6995_toArrayDoesNotDisturbInternalIterator

 public function testZF6995_toArrayDoesNotDisturbInternalIterator()
 {
     $config = new Config(range(1, 10));
     $config->rewind();
     $this->assertEquals(1, $config->current());
     $config->toArray();
     $this->assertEquals(1, $config->current());
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:8,代码来源:ConfigTest.php

示例14: getMapTreeElement

 /**
  * Return from element with system map tree
  * @return \Zly\Form\Element\Tree 
  */
 public function getMapTreeElement()
 {
     $sysmap = $this->getSysmap();
     $root = $this->getRoot();
     $root->name = 'Modules';
     $root->_childrens = $sysmap;
     $rootedSysmap = new Config($root->toArray(), true);
     $formElement = new \Zly\Form\Element\Tree('sysmap_id');
     $formElement->setValueKey('hash');
     $formElement->setTitleKey('name');
     $formElement->setChildrensKey('_childrens');
     $formElement->setMultiOptions(array($rootedSysmap->toArray()));
     return $formElement;
 }
开发者ID:zendmaniacs,项目名称:zly-sysmap,代码行数:18,代码来源:Map.php

示例15: process

 /**
  * 
  * @param Config $value
  * @return Config
  */
 public function process(Config $value)
 {
     return new Config($this->interpolator->interpolate($value->toArray(), $this->variables));
 }
开发者ID:alex-oleshkevich,项目名称:zf-extras,代码行数:9,代码来源:Interpolator.php


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