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


PHP Config::get方法代码示例

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


在下文中一共展示了Config::get方法的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: convert

 /**
  * @param String $string
  *
  * @return String
  * @author Fabian Köstring
  */
 private function convert(string $string)
 {
     if (!$this->config->offsetExists('chars')) {
         return $string;
     }
     $chars = $this->config->get('chars')->toArray();
     $from = array_keys($chars);
     $to = array_values($chars);
     return preg_replace($from, $to, $string);
 }
开发者ID:aubiplus,项目名称:seo,代码行数:16,代码来源:Url.php

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

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

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

示例6: detectTarget

 /**
  * Get target to be used for the client's IP range + sub domain
  *
  * @param String $overrideIP   Simulate request from given
  *                             instead of detecting real IP
  * @param String $overrideHost Simulate request from given
  *                             instead of detecting from real URL
  *
  * @return Boolean Target detected or not?
  */
 public function detectTarget($overrideIP = '', $overrideHost = '')
 {
     $this->targetKey = false;
     // Key of detected target config
     $this->targetApiId = false;
     $this->targetApiKey = false;
     $targetKeys = explode(',', $this->config->get('TargetsProxy')->get('targetKeys' . $this->searchClass));
     // Check whether the current IP address matches against any of the
     // configured targets' IP / sub domain patterns
     $ipAddress = !empty($overrideIP) ? $overrideIP : $this->getClientIpV4();
     if (empty($overrideHost)) {
         $url = $this->getClientUrl();
     } else {
         $url = new \Zend\Uri\Http();
         $url->setHost($overrideHost);
     }
     $IpMatcher = new IpMatcher();
     $UrlMatcher = new UrlMatcher();
     foreach ($targetKeys as $targetKey) {
         $isMatchingIP = false;
         $isMatchingUrl = false;
         /**
          * Config
          *
          * @var \Zend\Config\Config $targetConfig
          */
         $targetConfig = $this->config->get($targetKey);
         $patternsIP = '';
         $patternsURL = '';
         // Check match of IP address if any pattern configured.
         // If match is found, set corresponding keys and continue matching
         if ($targetConfig->offsetExists('patterns_ip')) {
             $patternsIP = $targetConfig->get('patterns_ip');
             if (!empty($patternsIP)) {
                 $targetPatternsIp = explode(',', $patternsIP);
                 $isMatchingIP = $IpMatcher->isMatching($ipAddress, $targetPatternsIp);
                 if ($isMatchingIP === true) {
                     $this->_setConfigKeys($targetKey);
                 }
             }
         }
         // Check match of URL hostname if any pattern configured.
         // If match is found, set corresponding keys and exit immediately
         if ($targetConfig->offsetExists('patterns_url')) {
             $patternsURL = $targetConfig->get('patterns_url');
             if (!empty($patternsURL)) {
                 $targetPatternsUrl = explode(',', $patternsURL);
                 $isMatchingUrl = $UrlMatcher->isMatching($url->getHost(), $targetPatternsUrl);
                 if ($isMatchingUrl === true) {
                     $this->_setConfigKeys($targetKey);
                     return true;
                 }
             }
         }
     }
     return $this->targetKey != "" ? true : false;
 }
开发者ID:guenterh,项目名称:vufind,代码行数:67,代码来源:TargetsProxy.php

示例7: allowRequest

 /**
  * Whether the request is allowed
  *
  * @return boolean
  */
 public function allowRequest()
 {
     if ($this->config->get('circuitBreaker')->get('forceOpen')) {
         return false;
     }
     if ($this->config->get('circuitBreaker')->get('forceClosed')) {
         return true;
     }
     return !$this->isOpen() || $this->allowSingleTest();
 }
开发者ID:fhferreira,项目名称:phystrix,代码行数:15,代码来源:CircuitBreaker.php

示例8: getConfigList

 /**
  * Get list items from config
  *
  * @param    String        $configKey
  * @param    Boolean        $toLower
  * @param    Boolean        $trim
  * @param    String        $delimiter
  * @return    String[]
  */
 protected function getConfigList($configKey, $trim = true, $delimiter = ',')
 {
     $data = array();
     if ($this->config->offsetExists($configKey)) {
         $configValue = $this->config->get($configKey);
         $data = explode($delimiter, $configValue);
         if ($trim) {
             $data = array_map('trim', $data);
         }
     }
     return $data;
 }
开发者ID:htw-pk15,项目名称:vufind,代码行数:21,代码来源:CustomizedMethods.php

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

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

示例11: initNetworks

 /**
  * Initialize networks from config
  *
  */
 protected function initNetworks()
 {
     $networkNames = array('Aleph', 'Virtua');
     foreach ($networkNames as $networkName) {
         $configName = ucfirst($networkName) . 'Networks';
         /** @var Config $networkConfigs */
         $networkConfigs = $this->configHoldings->get($configName);
         foreach ($networkConfigs as $networkCode => $networkConfig) {
             list($domain, $library) = explode(',', $networkConfig, 2);
             $this->networks[$networkCode] = array('domain' => $domain, 'library' => $library, 'type' => $networkName);
         }
     }
 }
开发者ID:htw-pk15,项目名称:vufind,代码行数:17,代码来源:Holdings.php

示例12: setConfig

 /**
  * Set a global config
  *
  * @param \Zend\Config\Config $config
  */
 public static function setConfig(\Zend\Config\Config $config)
 {
     self::$_config = $config;
     if (null !== ($broker = $config->get('adapter_broker'))) {
         self::setAdapterBroker($broker);
     }
     if (null !== ($broker = $config->get('scrolling_style_broker'))) {
         self::setScrollingStyleBroker($broker);
     }
     $scrollingStyle = $config->get('scrolling_style');
     if ($scrollingStyle != null) {
         self::setDefaultScrollingStyle($scrollingStyle);
     }
 }
开发者ID:GrifiS,项目名称:Symfony2CMS,代码行数:19,代码来源:Paginator.php

示例13: testZF1417_DefaultValues

 public function testZF1417_DefaultValues()
 {
     $config = new Config($this->all);
     $value = $config->get('notthere', 'default');
     $this->assertTrue($value === 'default');
     $this->assertTrue($config->notThere === null);
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:7,代码来源:ConfigTest.php

示例14: setOptions

 /**
  * Set options
  *
  * @param Config $options Options
  */
 protected function setOptions(Config $options)
 {
     if ($options->offsetExists('name')) {
         $this->setName($options->get('name'));
     }
     if ($options->offsetExists('description')) {
         $this->setDescription($options->get('description'));
     }
     if ($options->offsetExists('fields')) {
         $this->setFields($options->get('fields'));
     }
 }
开发者ID:back-2-95,项目名称:fields,代码行数:17,代码来源:EntityConfiguration.php

示例15: toArray

 public function toArray(array $opts = null)
 {
     if (empty($opts)) {
         $opts = array();
     }
     $config = new Config($opts);
     if ($config->get('strings-only')) {
         $array = array('id' => $this->getId(), 'neighborhood_name' => $this->getNeighborhood()->getName(), 'datetime_added' => $this->getDateTimeAdded());
     } else {
         $hydrator = new \Zend\Stdlib\Hydrator\ClassMethods();
         $array = $hydrator->extract($this);
         unset($array['iterator_class']);
         unset($array['iterator']);
         unset($array['flags']);
         unset($array['array_copy']);
         unset($array['polygon']);
         unset($array['whathood_user']);
         // for geojson, we want to merge the polygon
         $array = array_merge($array, $this->polygonToGeoJsonArray($this->polygon));
         if ($this->getNeighborhood() != null) {
             $array['neighborhood'] = $this->getNeighborhood()->toArray();
         }
         if ($this->getWhathoodUser() != null) {
             $array['user'] = $this->getWhathoodUser()->toArray();
         }
     }
     return $array;
 }
开发者ID:KGalley,项目名称:whathood,代码行数:28,代码来源:UserPolygon.php


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