本文整理汇总了PHP中Illuminate\Config\Repository::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::has方法的具体用法?PHP Repository::has怎么用?PHP Repository::has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Config\Repository
的用法示例。
在下文中一共展示了Repository::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
*
* @param \Illuminate\Config\Repository $config
* @param \Illuminate\Filesystem\Filesystem $files
* @param \Illuminate\View\Factory $view
* @param string $publicPath
*/
public function __construct(ConfigRepository $config, Filesystem $files, $view, $publicPath)
{
$this->config = $config;
$this->files = $files;
$this->view = $view;
$this->public_path = $publicPath;
$this->showWarnings = $this->config->get('laravel-dompdf::show_warnings', false);
//To prevent old configs from not working..
if ($this->config->has('laravel-dompdf::paper')) {
$this->paper = $this->config->get('laravel-dompdf::paper');
} else {
$this->paper = DOMPDF_DEFAULT_PAPER_SIZE;
}
$this->orientation = $this->config->get('laravel-dompdf::orientation') ?: 'portrait';
$this->dompdf = new \DOMPDF();
$this->dompdf->set_base_path(realpath($publicPath));
}
示例2: setUp
/**
* Setup
*
* @throws Exception
*/
private function setUp()
{
if (!$this->config->has('purifier')) {
if (!$this->config->has('mews.purifier')) {
throw new Exception('Configuration parameters not loaded!');
}
$this->config->set('purifier', $this->config->get('mews.purifier'));
}
$this->checkCacheDirectory();
// Create a new configuration object
$config = HTMLPurifier_Config::createDefault();
// Allow configuration to be modified
if (!$this->config->get('purifier.finalize')) {
$config->autoFinalize = false;
}
$config->loadArray($this->getConfig());
if ($def = $config->maybeGetRawHTMLDefinition()) {
if ($addElement = $this->config->get('purifier.addElement')) {
foreach ($addElement as $item) {
call_user_func_array(array($def, "addElement"), $item);
}
}
if ($addAttribute = $this->config->get('purifier.addAttribute')) {
foreach ($addAttribute as $item) {
call_user_func_array(array($def, "addAttribute"), $item);
}
}
}
// Create HTMLPurifier object
$this->purifier = new HTMLPurifier($config);
}
示例3: setEnvironment
protected function setEnvironment()
{
if ($this->config->has('custom.environment')) {
$this->environment = $this->config->get('custom.environment');
} else {
$this->environment = $this->config->get('general.environment');
}
}
示例4: configure
/**
* Init configuration
*
* @return void
*/
protected function configure()
{
if ($this->config->has('sphinx_search')) {
foreach ($this->config->get('sphinx_search') as $key => $val) {
$key = $this->camel($key);
$this->{$key} = $val;
}
}
}
示例5: store
/**
* Cache the passed response
*
* @param \Illuminate\Routing\Route $route
* @param \Illuminate\Http\Request $request
* @param \Symfony\Component\HttpFoundation\Response $response
*
* @return void
*/
public function store(Route $route, Request $request, Response $response)
{
if ($ttl = $this->ttl) {
$key = $this->makeCacheKey($request);
if (!$this->cache->has($key)) {
$cacheable = $this->serializeResponse($response);
$this->cache->put($key, $cacheable, $ttl);
}
}
}
示例6: loadSource
/**
* Load the messages for the given locale.
*
* @param string $locale
* @param string $group
* @param string $namespace
* @return array
*/
public function loadSource($locale, $group, $namespace = '*')
{
if ($this->cache->has($locale, $group, $namespace)) {
return $this->cache->get($locale, $group, $namespace);
} else {
$source = $this->fallback->load($locale, $group, $namespace);
$this->cache->put($locale, $group, $namespace, $source, $this->cacheTimeout);
return $source;
}
}
示例7: __construct
public function __construct(Config $config, SessionStore $session)
{
if ($config->has('ttwitter::config')) {
$this->tconfig = $config->get('ttwitter::config');
} else {
if ($config->get('ttwitter')) {
$this->tconfig = $config->get('ttwitter');
} else {
throw new Exception('No config found');
}
}
$this->debug = isset($this->tconfig['debug']) && $this->tconfig['debug'] ? true : false;
$this->parent_config = [];
$this->parent_config['consumer_key'] = $this->tconfig['CONSUMER_KEY'];
$this->parent_config['consumer_secret'] = $this->tconfig['CONSUMER_SECRET'];
$this->parent_config['token'] = $this->tconfig['ACCESS_TOKEN'];
$this->parent_config['secret'] = $this->tconfig['ACCESS_TOKEN_SECRET'];
if ($session->has('access_token')) {
$access_token = $session->get('access_token');
if (is_array($access_token) && isset($access_token['oauth_token']) && isset($access_token['oauth_token_secret']) && !empty($access_token['oauth_token']) && !empty($access_token['oauth_token_secret'])) {
$this->parent_config['token'] = $access_token['oauth_token'];
$this->parent_config['secret'] = $access_token['oauth_token_secret'];
}
}
$this->parent_config['use_ssl'] = $this->tconfig['USE_SSL'];
$this->parent_config['user_agent'] = 'LTTW ' . parent::VERSION;
$config = array_merge($this->parent_config, $this->tconfig);
parent::__construct($this->parent_config);
}
示例8: extractProperties
/**
* @param Repository $config
*/
protected function extractProperties(Repository $config)
{
if ($config->has(self::REPOSITORY_KEY)) {
$data = $config->get(self::REPOSITORY_KEY);
$this->properties = $data['properties'][$data['use']];
}
}
示例9: getCacheLocale
/**
* Retrieves a cached locale from the specified locale code.
*
* @param string $code
*
* @return bool
*/
protected function getCacheLocale($code)
{
$id = sprintf('translation.%s', $code);
if ($this->cache->has($id)) {
return $this->cache->get($id);
}
return false;
}
示例10: configure
/**
* @param string $config
* @return void
*/
protected function configure($config)
{
if ($this->config->has('captcha.' . $config)) {
foreach ($this->config->get('captcha.' . $config) as $key => $val) {
$this->{$key} = $val;
}
}
}
示例11: setUp
/**
* Setup
*
* @throws Exception
*/
private function setUp()
{
if (!$this->config->has('purifier')) {
if (!$this->config->has('mews.purifier')) {
throw new Exception('Configuration parameters not loaded!');
}
$this->config->set('purifier', $this->config->get('mews.purifier'));
}
$this->checkCacheDirectory();
// Create a new configuration object
$config = HTMLPurifier_Config::createDefault();
// Allow configuration to be modified
if (!$this->config->get('purifier.finalize')) {
$config->autoFinalize = false;
}
$config->loadArray($this->getConfig());
// Create HTMLPurifier object
$this->purifier = new HTMLPurifier($this->configure($config));
}
示例12: __call
/**
* Handle dynamic method calls into the model.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
$className = class_basename($this);
$config = implode('.', ['relationship', $className, $method]);
if (Config::has($config)) {
$function = Config::get($config);
return $function($this);
}
return parent::__call($method, $parameters);
}
示例13: availableLocales
/**
* Returns a list of all available locales.
*
* @return array
*/
public function availableLocales()
{
if ($this->config->has('translator.locales')) {
return $this->config->get('translator.locales');
}
if ($this->tableExists()) {
$locales = $this->model->distinct()->get()->pluck('locale')->toArray();
$this->config->set('translator.locales', $locales);
return $locales;
}
return $this->defaultAvailableLocales;
}
示例14: getLaravelConfigValue
/**
* Retrieves a configuration value from Laravel.
*
* @param $option
* @return mixed
*/
protected function getLaravelConfigValue($option)
{
$option = implode('.', (array) $option);
// Laravel 5
$optionKey = self::PACKAGE_CONFIG_NAMESPACE . '.' . $option;
if ($this->laravelConfig->has($optionKey)) {
return $this->laravelConfig->get($optionKey);
}
// Laravel 4
$optionKey = self::PACKAGE_CONFIG_NAMESPACE . '::' . $option;
return $this->laravelConfig->get($optionKey);
}
示例15: configure
/**
*
* @param string $config
* @return void
*/
protected function configure($config, $formId = false)
{
if ($this->config->has('captcha.' . $config)) {
foreach ($this->config->get('captcha.' . $config) as $key => $val) {
$this->{$key} = $val;
}
}
if ($formId !== false) {
$this->formId = $formId;
} elseif ($this->unique) {
$this->formId = $this->str->random(32);
}
}