本文整理汇总了PHP中Config::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::has方法的具体用法?PHP Config::has怎么用?PHP Config::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: has
/**
* Check if an item exists by key.
*
* @param string $key
*
* @return bool
*/
public function has($key)
{
if (array_key_exists($key, $this->settings)) {
return true;
}
return $this->fallback instanceof Config ? $this->fallback->has($key) : false;
}
示例2: __construct
/**
* Create Kafka producer.
*
* @param array $params
*/
public function __construct(array $params)
{
parent::__construct($params);
$this->config = new HashConfig($params);
if (!$this->config->has('KafkaEventHost')) {
throw new InvalidArgumentException("KafkaEventHost must be configured");
}
}
示例3: __construct
/**
* Gateway constructor.
* @param null $config
* @param null $port
*/
public function __construct($config = null, $port = null)
{
$this->config = app('config');
$this->request = app('request');
if ($this->config->has('gateway.timezone')) {
date_default_timezone_set($this->config->get('gateway.timezone'));
}
if (!is_null($port)) {
$this->make($port);
}
}
示例4: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->package('opensolutions/doctrine2bridge', 'doctrine2bridge');
$this->app['config']->package('opensolutions/doctrine2bridge', __DIR__ . '/../config');
$this->app->singleton('d2cachebridge', function ($app) {
$cacheClass = "\\Doctrine\\Common\\Cache\\" . \Config::get('doctrine2bridge::cache.type');
if (!class_exists($cacheClass)) {
throw new Exception\ImplementationNotFound($cacheClass);
}
$cache = new $cacheClass();
if (\Config::has('doctrine2bridge::cache.namespace')) {
$cache->setNamespace(\Config::get('doctrine2bridge::cache.namespace'));
}
switch (\Config::get('doctrine2bridge::cache.type')) {
case 'MemcacheCache':
$memcache = new \Memcache();
if (!\Config::has('doctrine2bridge::cache.memcache.servers') || !count(\Config::get('doctrine2bridge::cache.memcache.servers'))) {
throw new Exception\Configuration('No servers defined for Doctrine2Bridge\\Doctrine2CacheBridgeServiceProvider - Memcache');
}
foreach (\Config::get('doctrine2bridge::cache.memcache.servers') as $server) {
$memcache->addServer($server['host'], isset($server['port']) ? $server['port'] : 11211, isset($server['persistent']) ? $server['persistent'] : false, isset($server['weight']) ? $server['weight'] : 1, isset($server['timeout']) ? $server['timeout'] : 1, isset($server['retry_int']) ? $server['retry_int'] : 15);
$cache->setMemcache($memcache);
}
break;
}
return $cache;
});
// Shortcut so developers don't need to add an Alias in app/config/app.php
\App::booting(function () {
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('D2Cache', 'Doctrine2Bridge\\Support\\Facades\\Doctrine2Cache');
});
}
示例5: curl_init
/**
* Initializes a cURL session with common options
* @param String $url
* @param int $timeout
* @return resource
*/
private static function curl_init($url)
{
$ch = curl_init($url);
if (Config::has('solder.md5_connect_timeout')) {
$timeout = Config::get('solder.md5_connect_timeout');
if (is_int($timeout)) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
}
} else {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
}
if (Config::has('solder.md5_file_timeout')) {
$timeout = Config::get('solder.md5_file_timeout');
if (is_int($timeout)) {
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
}
} else {
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'TechnicSolder/0.7 (https://github.com/TechnicPack/TechnicSolder)');
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
return $ch;
}
示例6: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
/**
* Build data for the sidebar block.
*/
view()->composer('laraboard::*', function ($view) {
$view->with('messaging', \Config::has('messenger'));
});
view()->composer('laraboard::category.show', function ($view) {
$data = $view->getData();
$view->with('crumbs', [['name' => $data['category']->name, 'url' => route('category.show', [$data['category']->slug])]]);
});
view()->composer('laraboard::board.show', function ($view) {
$data = $view->getData();
$view->with('crumbs', [['name' => $data['board']->category->name, 'url' => route('category.show', $data['board']->category->slug)], ['name' => $data['board']->name, 'url' => route('board.show', [$data['board']->category->slug, $data['board']->slug])]]);
});
view()->composer('laraboard::thread.show', function ($view) {
$data = $view->getData();
$view->with('crumbs', [['name' => $data['thread']->board->category->name, 'url' => route('category.show', $data['thread']->board->category->slug)], ['name' => $data['thread']->board->name, 'url' => route('board.show', [$data['thread']->board->category->slug, $data['thread']->board->slug])], ['name' => $data['thread']->name, 'url' => route('thread.show', [$data['thread']->board->category->slug, $data['thread']->board->slug, $data['thread']->slug, $data['thread']->name_slug])]]);
});
view()->composer('laraboard::post.edit', function ($view) {
$data = $view->getData();
$thread = $data['post']->thread;
$view->with('crumbs', [['name' => $thread->board->category->name, 'url' => route('category.show', $thread->board->category->slug)], ['name' => $thread->board->name, 'url' => route('board.show', [$thread->board->category->slug, $thread->board->slug])], ['name' => $thread->name, 'url' => route('thread.show', [$thread->board->category->slug, $thread->board->slug, $thread->slug, $thread->name_slug])]]);
});
}
示例7: validate
/**
* Validate parameters and options with syncle command.
*
* @param array $options A merged options and parameters arrays.
* @return string Error message.
*/
public function validate($options)
{
if (!empty($options['by']) and !\Config::has('syncle::DeployMethod.' . $options['by'])) {
return \Lang::get('syncle::SyncleCommand.MethodNotFound');
}
return '';
}
示例8: attempt
/**
* Attempt to log a user into the application.
*
* @param array $arguments
* @return void
*/
public function attempt($arguments = array())
{
$username = Config::get('auth.username');
if (!Config::has('auth.username')) {
throw new Exception('The username in application/config/auth.php must be defined.');
}
$model = Config::get('auth.model');
// Add the username to the query
$query = array('$or' => array(array(Config::get('auth.username') => $arguments[Config::get('auth.username')])));
// If we've specified an 'username_alt' field in the config, add that to the $OR
if (Config::has('auth.username_alt')) {
$query['$or'][] = array(Config::get('auth.username_alt') => $arguments[Config::get('auth.username')]);
}
$user = Epic_Mongo::db('user')->findOne($query);
// This driver uses a basic username and password authentication scheme
// so if the credentials match what is in the database we will just
// log the user into the application and remember them if asked.
$password = $arguments[Config::get('auth.password')];
// if ( ! is_null($user) and Hash::check($password, $user->password))
if (!is_null($user) and Hash::check($password, $user->password)) {
return $this->login($user->_id, array_get($arguments, 'remember'));
} else {
if (!is_null($user) and md5($password) == $user->password) {
return $this->login($user->_id, array_get($arguments, 'remember'));
}
}
return false;
}
示例9: run
public static function run()
{
// Jump ship if no key has been specified
if (!Config::has('locate::options.maxmind_key')) {
return false;
}
$options = array('l' => Config::get('locate::options.maxmind_key'), 'i' => Locate::ip());
$response = @file_get_contents('http://geoip.maxmind.com/b?' . http_build_query($options));
if ($response !== false) {
$response = explode(',', $response);
// Verify fields
if (isset($response[5]) && $response[5] == 'IP_NOT_FOUND') {
return false;
}
$required_fields = array(1, 2, 3, 4);
foreach ($required_fields as $field) {
if (!isset($response[$field]) || empty($response[$field])) {
return false;
}
}
$states = Config::get('locate::abbrevs.states');
return array('city' => $response[2], 'state' => isset($states[$response[1]]) ? $states[$response[1]] : null, 'state_code' => $response[1], 'country' => $response[0], 'country_code' => $response[0], 'zipcode' => null, 'lat' => $response[3], 'lng' => $response[4]);
}
return false;
}
示例10: __construct
public function __construct()
{
// Initialize Dropbox Application configuration
if (Config::has('queue.postfix')) {
$this->file_queue_id .= '.' . Config::get('queue.postfix');
$this->listing_queue_id .= '.' . Config::get('queue.postfix');
}
}
示例11: getElasticSearchClient
/**
* Get ElasticSearch Client
*
* @return \Elasticsearch\Client
*/
public function getElasticSearchClient()
{
$config = array();
if (\Config::has('elasticquent.config')) {
$config = \Config::get('elasticquent.config');
}
return \Elasticsearch\ClientBuilder::fromConfig($config, true);
}
示例12: getElasticSearchClient
/**
* Get ElasticSearch Client
*
* @return \Elasticsearch\Client
*/
public function getElasticSearchClient()
{
$config = array();
if (\Config::has('elasticquent.config')) {
$config = \Config::get('elasticquent.config');
}
return new \Elasticsearch\Client($config);
}
示例13: __construct
public function __construct(ThrottleCacheMgrInterface $cache_mgr)
{
if (!\Config::has('throttle.keys')) {
throw new \RuntimeException('Missing throttle keys config');
}
$this->throttle_keys = \Config::get('throttle.keys');
$this->cache_mgr = $cache_mgr;
}
示例14: __construct
public function __construct()
{
$this->contextIO = new ContextIO(Config::get('contextIO.key'), Config::get('contextIO.secret'));
$this->accountIDs = [];
if (Config::has('queue.postfix')) {
$this->sync_queue_id .= '.' . Config::get('queue.postfix');
$this->file_queue_id .= '.' . Config::get('queue.postfix');
}
}
示例15: __construct
/**
*
* @param string $config_id A valid configuration id to autolist configuration
* @param function $query_modifier An optional function to modify the model query just before result retrieval
* @throws Exception
*/
function __construct($config_id, $query_modifier = NULL)
{
$this->config_id = $config_id;
if (!Config::has($config_id) || !Config::has("{$config_id}.model")) {
throw new Exception('Model must be defined in autolist config');
}
$this->config = Config::get($config_id);
$this->set_query_modifier($query_modifier);
}