當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Config\Config類代碼示例

本文整理匯總了PHP中Zend\Config\Config的典型用法代碼示例。如果您正苦於以下問題:PHP Config類的具體用法?PHP Config怎麽用?PHP Config使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Config類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUp

 /**
  * @return void
  */
 public function setUp()
 {
     $iniReader = new Ini();
     $config = new Config($iniReader->fromFile('../../../local/config/vufind/config.ini'));
     $this->url = $config->get('Index')->get('url') . '/' . $config->get('Index')->get('default_core');
     $this->urlAdmin = $config->get('Index')->get('url') . '/admin';
 }
開發者ID:htw-pk15,項目名稱:vufind,代碼行數:10,代碼來源:BackendTest.php

示例2: isRemoved

 /**
  * @param Config $specs
  * @return boolean
  */
 private function isRemoved(Config $specs)
 {
     if ($remove = $specs->get('remove')) {
         return filter_var($remove, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
     }
     return false;
 }
開發者ID:hummer2k,項目名稱:conlayout,代碼行數:11,代碼來源:BlocksGenerator.php

示例3: generateViewHelpers

 /**
  * @param Config $helpers
  * @throws BadMethodCallException
  */
 private function generateViewHelpers(Config $helpers)
 {
     foreach ($this->helperConfig as $helper => $config) {
         if (!$helpers->get($helper)) {
             continue;
         }
         $helperProxy = false;
         if (isset($config['proxy']) && $this->viewHelperManager->has($config['proxy'])) {
             $helperProxy = $this->viewHelperManager->get($config['proxy']);
         }
         $viewHelper = $this->viewHelperManager->get($helper);
         $instructions = $helpers[$helper]->toArray();
         $sortedInstructions = $this->sort($instructions);
         foreach ($sortedInstructions as $id => $instruction) {
             if ($this->isRemoved($instruction)) {
                 continue;
             }
             $mergedInstruction = ArrayUtils::merge($config, (array) $instruction);
             if ($this->isDebug() && isset($mergedInstruction['debug'])) {
                 $mergedInstruction[$mergedInstruction['debug']]['data-layout-id'] = $id;
             }
             $method = isset($mergedInstruction['method']) ? $mergedInstruction['method'] : '__invoke';
             $args = $this->filterArgs($mergedInstruction);
             if (method_exists($viewHelper, $method)) {
                 $this->invokeArgs($viewHelper, $method, $args);
             } elseif (false !== $helperProxy && method_exists($helperProxy, $method)) {
                 $this->invokeArgs($helperProxy, $method, $args);
             } else {
                 throw new BadMethodCallException(sprintf('Call to undefined helper method %s::%s()', get_class($viewHelper), $method));
             }
         }
     }
 }
開發者ID:hummer2k,項目名稱:conlayout,代碼行數:37,代碼來源:ViewHelperGenerator.php

示例4: buildHydrator

 protected function buildHydrator($product, $direction)
 {
     $this->assertOptionsValid();
     $config = $this->options->getConfig();
     $class = $this->options->getClass();
     $hydrator = new ClassMethods();
     if (!isset($config[$this->options->getClass()][$product])) {
         return $hydrator;
     }
     $tmp = new Config(array());
     if (isset($config[$class]['*'])) {
         $tmp = new Config($config[$class]['*']);
     }
     if (isset($config[$class][$product])) {
         $productConfig = new Config($config[$class][$product]);
         $tmp = $productConfig->merge($tmp);
     }
     $config = $tmp['shared'];
     if (isset($tmp[$direction])) {
         $config->merge($tmp[$direction]);
     }
     $config = $config->toArray();
     if (!empty($config['map'])) {
         $hydrator->setNamingStrategy(new ArrayMapNamingStrategy($config['map']));
     }
     if (!empty($config['strategy'])) {
         foreach ($config['strategy'] as $name => $strategyCallback) {
             $hydrator->addStrategy($name, $strategyCallback());
         }
     }
     if (!empty($config['options'])) {
         $this->options->setFromArray($config['options']);
     }
     return $hydrator;
 }
開發者ID:pay4later,項目名稱:php-task,代碼行數:35,代碼來源:AbstractClassAdapter.php

示例5: _getConfig

 protected function _getConfig()
 {
     $config = new Config(include 'config/module.config.global.php');
     if (file_exists('config/module.config.local.php')) {
         $config->merge(new Config(include 'config/module.config.local.php'));
     }
     return $config['jvandemo_ogone'];
 }
開發者ID:jvandemo,項目名稱:ogone,代碼行數:8,代碼來源:FormTest.php

示例6: update

 /**
  * Обновить запись.
  * Метод PUT для RESTfull.
  */
 public function update($id, $data)
 {
     $result = new JsonModel();
     $lincutConfigPath = $_SERVER["DOCUMENT_ROOT"] . "/lincut.config.php";
     // Создаем в памяти новый конфигурационный файл с новыми настройками
     $lincutConfigNew = new Config(array(), true);
     $lincutConfigNew->lincut = array();
     $lincutConfigNew->lincut->wkhtmltopdf = array();
     $lincutConfigNew->lincut->restriction = array();
     if (array_key_exists("wkhtmltopdf_path", $data)) {
         $lincutConfigNew->lincut->wkhtmltopdf->path = $data["wkhtmltopdf_path"];
     }
     if (array_key_exists("restriction_mode", $data)) {
         $lincutConfigNew->lincut->restriction->mode = $data["restriction_mode"];
     }
     if (array_key_exists("restriction_up_time", $data)) {
         $lincutConfigNew->lincut->restriction->uptime = $data["restriction_up_time"];
     }
     if (array_key_exists("restriction_up_count", $data)) {
         $lincutConfigNew->lincut->restriction->upcount = $data["restriction_up_count"];
     }
     if (array_key_exists("saw", $data)) {
         $lincutConfigNew->lincut->saw = $data["saw"];
     }
     if (array_key_exists("waste", $data)) {
         $lincutConfigNew->lincut->waste = $data["waste"];
     }
     $dbwcad = "db/wcad";
     $lincutConfigNew->db = array();
     $lincutConfigNew->db->adapters = array();
     $lincutConfigNew->db->adapters->{$dbwcad} = array();
     if (array_key_exists("db_wcad_servername", $data)) {
         $lincutConfigNew->db->adapters->{$dbwcad}->servername = $data["db_wcad_servername"];
     }
     if (array_key_exists("db_wcad_database", $data)) {
         $lincutConfigNew->db->adapters->{$dbwcad}->database = $data["db_wcad_database"];
     }
     if (array_key_exists("db_wcad_username", $data)) {
         $lincutConfigNew->db->adapters->{$dbwcad}->username = $data["db_wcad_username"];
     }
     if (array_key_exists("db_wcad_password", $data)) {
         $lincutConfigNew->db->adapters->{$dbwcad}->password = $data["db_wcad_password"];
     }
     // Открываем существующий файл настроек, если он имеется в наличии
     $lincutConfig = array();
     if (is_file($lincutConfigPath)) {
         $lincutConfig = \Zend\Config\Factory::fromFile($lincutConfigPath);
     }
     $lincutConfig = new Config($lincutConfig, true);
     $lincutConfig->merge($lincutConfigNew);
     // Сохраняем настройки
     $writer = new \Zend\Config\Writer\PhpArray();
     $writer->toFile($lincutConfigPath, $lincutConfig);
     // Возвращаем результат операции
     $result->success = true;
     return $result;
 }
開發者ID:khusamov-dump,項目名稱:dump,代碼行數:61,代碼來源:ConfigController.php

示例7: process

 /**
  * Process the whole config structure with each parser in the queue.
  *
  * @param  Config $config
  * @return Config
  * @throws Exception\InvalidArgumentException
  */
 public function process(Config $config)
 {
     if ($config->isReadOnly()) {
         throw new Exception\InvalidArgumentException('Cannot process config because it is read-only');
     }
     foreach ($this as $parser) {
         /** @var $parser ProcessorInterface */
         $parser->process($config);
     }
 }
開發者ID:leonardovn86,項目名稱:zf2_basic2013,代碼行數:17,代碼來源:Queue.php

示例8: collect

 /**
  * @inheritDoc
  */
 public function collect($handle, $area = null)
 {
     $areas = [LayoutUpdaterInterface::AREA_GLOBAL, $area];
     $structure = new Config([], true);
     foreach ($areas as $area) {
         $config = isset($this->config[$area][$handle]) ? (array) $this->config[$area][$handle] : [];
         $structure->merge(new Config($config, true));
     }
     return $structure;
 }
開發者ID:hummer2k,項目名稱:conlayout,代碼行數:13,代碼來源:ConfigCollector.php

示例9: 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

示例10: 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

示例11: 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

示例12: getFileAsConfig

 /**
  * Get result from cache or read from php file
  *
  * @param string $file path to file and filename
  * @param string $key template file ident
  * @param ServiceLocatorInterface $sl
  */
 protected function getFileAsConfig($file, $key, $sl)
 {
     $cache = $sl->get(static::CONTENTINUM_CACHE);
     if (!($result = $cache->getItem($key))) {
         $result = new Config(include $file);
         if (is_file(CON_ROOT_PATH . '/data/opt/customer.config.php')) {
             $result->merge(new Config(include CON_ROOT_PATH . '/data/opt/customer.config.php'));
         }
         $cache->setItem($key, $result);
     }
     return $result;
 }
開發者ID:jochum-mediaservices,項目名稱:contentinum5.5,代碼行數:19,代碼來源:CustomerServiceFactory.php

示例13: get

 /**
  * Get circuit breaker instance by command key for given command config
  *
  * @param string $commandKey
  * @param Config $commandConfig
  * @param CommandMetrics $metrics
  * @return CircuitBreakerInterface
  */
 public function get($commandKey, Config $commandConfig, CommandMetrics $metrics)
 {
     if (!isset($this->circuitBreakersByCommand[$commandKey])) {
         $circuitBreakerConfig = $commandConfig->get('circuitBreaker');
         if ($circuitBreakerConfig->get('enabled')) {
             $this->circuitBreakersByCommand[$commandKey] = new CircuitBreaker($commandKey, $metrics, $commandConfig, $this->stateStorage);
         } else {
             $this->circuitBreakersByCommand[$commandKey] = new NoOpCircuitBreaker();
         }
     }
     return $this->circuitBreakersByCommand[$commandKey];
 }
開發者ID:fhferreira,項目名稱:phystrix,代碼行數:20,代碼來源:CircuitBreakerFactory.php

示例14: get

 /**
  * Get command metrics instance by command key for given command config
  *
  * @param string $commandKey
  * @param Config $commandConfig
  * @return CommandMetrics
  */
 public function get($commandKey, Config $commandConfig)
 {
     if (!isset($this->commandMetricsByCommand[$commandKey])) {
         $metricsConfig = $commandConfig->get('metrics');
         $statisticalWindow = $metricsConfig->get('rollingStatisticalWindowInMilliseconds');
         $windowBuckets = $metricsConfig->get('rollingStatisticalWindowBuckets');
         $snapshotInterval = $metricsConfig->get('healthSnapshotIntervalInMilliseconds');
         $counter = new MetricsCounter($commandKey, $this->stateStorage, $statisticalWindow, $windowBuckets);
         $this->commandMetricsByCommand[$commandKey] = new CommandMetrics($counter, $snapshotInterval);
     }
     return $this->commandMetricsByCommand[$commandKey];
 }
開發者ID:fhferreira,項目名稱:phystrix,代碼行數:19,代碼來源:CommandMetricsFactory.php

示例15: getCommandConfig

 /**
  * Gets the config for given command key
  *
  * @param string $commandKey
  * @return Config
  */
 protected function getCommandConfig($commandKey)
 {
     if (isset($this->configsPerCommandKey[$commandKey])) {
         return $this->configsPerCommandKey[$commandKey];
     }
     $config = new Config($this->config->get('default')->toArray(), true);
     if ($this->config->__isset($commandKey)) {
         $commandConfig = $this->config->get($commandKey);
         $config->merge($commandConfig);
     }
     $this->configsPerCommandKey[$commandKey] = $config;
     return $config;
 }
開發者ID:odesk,項目名稱:phystrix-dashboard,代碼行數:19,代碼來源:ApcMetricsPoller.php


注:本文中的Zend\Config\Config類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。