本文整理汇总了PHP中Illuminate\Contracts\Config\Repository::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::has方法的具体用法?PHP Repository::has怎么用?PHP Repository::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Config\Repository
的用法示例。
在下文中一共展示了Repository::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Get setting by key
*
* @param $key
* @param null $default
* @param bool $save
* @return mixed
*/
public function get($key, $default = null, $save = false)
{
$this->load();
if ($this->has($key)) {
return Arr::get($this->settings, $key, $default);
}
if ($save) {
$this->set($key, $default);
}
if ($this->config->has($key)) {
return $this->config->get($key);
}
return $default;
}
示例2: Foo
function it_allows_for_dynamic_calls_to_providers_methods_with_the_given_decorator(Repository $config, ServiceFactory $serviceFactory)
{
$serviceFactory->createService('Foo', Argument::type(self::INTERFACE_CREDENTIALS), Argument::type(self::INTERFACE_STORAGE))->shouldBeCalledTimes(1)->willReturn(new Foo());
$config->has('oauth.providers.Foo')->willReturn(true);
$config->has('oauth.providers.Foo.class')->willReturn(false);
$config->has('oauth.providers.Foo.decorators')->willReturn(true);
$config->get('oauth.providers.Foo.decorators')->willReturn(['tests\\Pasadinhas\\LaravelOAuth\\Decorator1', 'tests\\Pasadinhas\\LaravelOAuth\\Decorator2']);
$config->get('oauth.providers.Foo.consumer_key')->willReturn('foo');
$config->get('oauth.providers.Foo.consumer_secret')->willReturn('bar');
$config->get('oauth.providers.Foo.callback_url')->willReturn('http://baz.com/login');
$foo = $this->make('Foo');
$foo->testDynamicMethods1()->shouldReturn('1');
$foo->testDynamicMethods2()->shouldReturn('2');
}
示例3: __construct
/**
* @param \DOMPDF $dompdf
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Illuminate\Filesystem\Filesystem $files
* @param \Illuminate\View\Factory $view
*/
public function __construct(DOMPDF $dompdf, ConfigRepository $config, ViewFactory $view)
{
$this->dompdf = $dompdf;
$this->config = $config;
$this->view = $view;
$this->showWarnings = $this->config->get('dompdf.show_warnings', false);
//To prevent old configs from not working..
if ($this->config->has('dompdf.paper')) {
$this->paper = $this->config->get('dompdf.paper');
} else {
$this->paper = DOMPDF_DEFAULT_PAPER_SIZE;
}
$this->orientation = $this->config->get('dompdf.orientation') ?: 'portrait';
}
示例4: __construct
/**
* MollieApiWrapper constructor.
*
* @param Repository $config
* @param Mollie_API_Client $client
*
* @return void
*/
public function __construct(Repository $config, Mollie_API_Client $client)
{
$this->config = $config;
$this->client = $client;
// Use only the 'live_' API key when 'test_mode' is DISABLED.
if (!$this->config->get('mollie.test_mode')) {
if ($this->config->has('mollie.keys.live')) {
$this->setApiKey($this->config->get('mollie.keys.live'));
}
} else {
if ($this->config->has('mollie.keys.test')) {
$this->setApiKey($this->config->get('mollie.keys.test'));
}
}
}
示例5: get
/**
* Creates new translation objects.
*
* @param array $languageIds List of two letter ISO language IDs
* @return \Aimeos\MW\Translation\Iface[] List of translation objects
*/
public function get(array $languageIds)
{
$i18nPaths = $this->aimeos->get()->getI18nPaths();
foreach ($languageIds as $langid) {
if (!isset($this->i18n[$langid])) {
$i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $langid, array('disableNotices' => true));
if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) {
$i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $this->config->get('shop.apc_prefix', 'laravel:'));
}
if ($this->config->has('shop.i18n.' . $langid)) {
$i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $this->config->get('shop.i18n.' . $langid));
}
$this->i18n[$langid] = $i18n;
}
}
return $this->i18n;
}
示例6: __construct
/**
*
* @param \Illuminate\Contracts\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('dompdf.show_warnings', false);
//To prevent old configs from not working..
if ($this->config->has('dompdf.paper')) {
$this->paper = $this->config->get('dompdf.paper');
} else {
$this->paper = DOMPDF_DEFAULT_PAPER_SIZE;
}
$this->orientation = $this->config->get('dompdf.orientation') ?: 'portrait';
$this->dompdf = new \DOMPDF();
$this->dompdf->set_base_path(realpath($publicPath));
}
示例7: getConnectionDriver
/**
* @param array $settings
*
* @return string|null
*/
protected function getConnectionDriver(array $settings = [])
{
$connection = array_get($settings, 'connection');
$key = 'database.connections.' . $connection;
if (!$this->config->has($key)) {
throw new InvalidArgumentException("Connection [{$connection}] has no configuration in [{$key}]");
}
return $this->config->get($key);
}
示例8: decorateProvider
/**
* @param ServiceInterface $provider
* @param $name
*
* @return ServiceInterface
*/
public function decorateProvider(ServiceInterface $provider, $name)
{
if ($this->config->has("oauth.providers.{$name}.decorators")) {
$decorators = $this->config->get("oauth.providers.{$name}.decorators");
foreach ($decorators as $decorator) {
$provider = $this->decorateProviderWith($provider, $decorator);
}
}
return $provider;
}
示例9: getTaxRateForCountry
/**
* Returns the tax rate for the given country.
*
* @param string $countryCode
* @param bool|false $company
*
* @return float
*/
public function getTaxRateForCountry($countryCode, $company = false)
{
if ($company && strtoupper($countryCode) !== strtoupper($this->businessCountryCode)) {
return 0;
}
$taxKey = 'vat_calculator.rules.' . strtoupper($countryCode);
if (isset($this->config) && $this->config->has($taxKey)) {
return $this->config->get($taxKey, 0);
}
return isset($this->taxRules[strtoupper($countryCode)]) ? $this->taxRules[strtoupper($countryCode)] : 0;
}
示例10: getLocale
/**
* Returns the locale item for the current request
*
* @param \MShop_Context_Item_Interface $context Context object
* @return \MShop_Locale_Item_Interface Locale item object
*/
protected function getLocale(\MShop_Context_Item_Interface $context)
{
if ($this->locale === null) {
$site = \Route::input('site', 'default');
$lang = \Route::input('locale', '');
$currency = \Route::input('currency', '');
$disableSites = $this->config->has('shop.disableSites');
$localeManager = \MShop_Locale_Manager_Factory::createManager($context);
$this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites);
}
return $this->locale;
}
示例11: setDefaults
/**
* Set defaults values to use
*/
private function setDefaults()
{
if ($this->config->has('meta::defaults')) {
if ($this->config->has('meta::defaults.title')) {
array_push($this->defaults, $this->pairedTag('title', $this->config->get('meta::defaults.title')));
}
if ($this->config->has('meta::defaults.keywords')) {
array_push($this->defaults, $this->unpairedTag('meta', ['name' => 'keywords', 'content' => $this->config->get('meta::defaults.keywords')]));
}
if ($this->config->has('meta::defaults.description')) {
array_push($this->defaults, $this->unpairedTag('meta', ['name' => 'description', 'content' => $this->config->get('meta::defaults.description')]));
}
}
}
示例12: getLocale
/**
* Returns the locale item for the current request
*
* @param \Aimeos\MShop\Context\Item\Iface $context Context object
* @return \Aimeos\MShop\Locale\Item\Iface Locale item object
*/
protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context)
{
if ($this->locale === null) {
if (\Route::current() !== null) {
$site = \Route::input('site', 'default');
$lang = \Route::input('locale', '');
$currency = \Route::input('currency', '');
} else {
$site = 'default';
$lang = $currency = '';
}
$disableSites = $this->config->has('shop.disableSites');
$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
$this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites);
}
return $this->locale;
}
示例13: getTaxRateForLocation
/**
* Returns the tax rate for the given country code.
* If a postal code is provided, it will try to lookup the different
* postal code exceptions that are possible.
*
* @param string $countryCode
* @param string|null $postalCode
* @param bool|false $company
*
* @return float
*/
public function getTaxRateForLocation($countryCode, $postalCode = null, $company = false)
{
if ($company && strtoupper($countryCode) !== strtoupper($this->businessCountryCode)) {
return 0;
}
$taxKey = 'vat_calculator.rules.' . strtoupper($countryCode);
if (isset($this->config) && $this->config->has($taxKey)) {
return $this->config->get($taxKey, 0);
}
if (isset($this->postalCodeExceptions[$countryCode]) && $postalCode !== null) {
foreach ($this->postalCodeExceptions[$countryCode] as $postalCodeException) {
if (!preg_match($postalCodeException['postalCode'], $postalCode)) {
continue;
}
if (isset($postalCodeException['name'])) {
return $this->taxRules[$postalCodeException['code']]['exceptions'][$postalCodeException['name']];
}
return $this->taxRules[$postalCodeException['code']]['rate'];
}
}
return isset($this->taxRules[strtoupper($countryCode)]['rate']) ? $this->taxRules[strtoupper($countryCode)]['rate'] : 0;
}
示例14: has
/**
* Determine if the given configuration value exists.
*
* @param string $key
*
* @return bool
*/
public function has($key)
{
return $this->repository->has($key);
}
示例15: resolveFromConfig
/**
* Resolve a given instance based on the concrete instance
* that is found in the configuration. If there is no
* instance that can be resolved from the config, then a
* default instance is attempted to be resolved
*
* @param string $entry Configuration or instance identifier
* @param Repository $config
* @param array $parameters [optional]
*
* @return mixed
*/
public function resolveFromConfig($entry, Repository $config, array $parameters = [])
{
if ($config->has($entry)) {
$instance = $config->get($entry);
return new $instance();
}
return $this->container()->make($entry, $parameters);
}