本文整理汇总了PHP中Illuminate\Config\Repository::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::set方法的具体用法?PHP Repository::set怎么用?PHP Repository::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Config\Repository
的用法示例。
在下文中一共展示了Repository::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCacheConfiguredBy
/**
* Configures cache for test-suites.
*
* @param Repository $config
*/
protected function getCacheConfiguredBy(Repository $config)
{
// Configuration for Redis.
$config->set('cache.stores.redis', ['cluster' => false, 'test_connection' => ['host' => '127.0.0.1', 'port' => 6379, 'database' => 0]]);
// Configuration for Redis.
$config->set('yacache', ['driver' => 'redis', 'default' => 'redis', 'connection' => 'test_connection', 'prefix' => 'prefix', 'codec' => 'Illuminate\\YetAnother\\Cache\\Serializer\\Codec\\MsgPack']);
}
示例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: handle
/**
* Handle the event.
*/
public function handle()
{
if ($locale = $this->preferences->get('streams::locale')) {
$this->application->setLocale($locale);
$this->config->set('app.locale', $locale);
}
}
示例4: handleDetectionComplete
/**
* This is what happens, wenn the detection passes
*
* @param $lookup
*
* @return mixed
*/
protected function handleDetectionComplete($lookup)
{
debugger()->info('Language detected: ' . $this->detected->slug);
Cookie::queue($this->keys['cookie'], $this->detected->slug);
$this->session->set($this->keys['session'], $this->detected->slug);
$this->config->set('app.locale', $this->detected->slug);
return $this->detected;
}
示例5: validate
/**
* {@inheritdoc}
*/
public function validate()
{
$challenge = $this->request->get('recaptcha_challenge_field');
$value = $this->request->get('recaptcha_response_field');
if (empty($challenge) || empty($value)) {
return false;
}
// Dirty hack to make use of our key instead of the config one
$this->config->set('recaptcha.private_key', $this->settings->get('captcha.recaptcha_private_key'));
return $this->service->check($challenge, $value);
}
示例6: validate
/**
* {@inheritdoc}
*/
public function validate()
{
$value = $this->request->get('g-recaptcha-response');
if (empty($value)) {
return false;
}
// Dirty hack to make use of our key instead of the config one
$this->config->set('recaptcha.private_key', $this->settings->get('captcha.nocaptcha_private_key'));
$this->config->set('recaptcha.driver', 'curl');
return $this->service->check(null, $value);
}
示例7: handle
/**
* Handle the command.
*
* @param Application $app
* @param Repository $config
* @param Request $request
* @param PreferenceRepositoryInterface $preferences
*/
function handle(Application $app, Repository $config, Request $request, PreferenceRepositoryInterface $preferences)
{
// Set using admin locale if in admin.
if ($request->segment(1) === 'admin' && ($locale = $preferences->get('streams::admin_locale'))) {
$app->setLocale($locale->getValue());
$config->set('app.locale', $locale->getValue());
}
// Set using public locale if NOT in admin.
if (!defined('LOCALE') && $request->segment(1) !== 'admin' && ($locale = $preferences->get('streams::public_locale'))) {
$app->setLocale($locale->getValue());
$config->set('app.locale', $locale->getValue());
}
}
示例8: setUp
protected function setUp()
{
$this->config = new \Illuminate\Config\Repository();
$filesystem = new \Illuminate\Filesystem\Filesystem();
$items = $filesystem->getRequire(__DIR__ . '/config/config.php');
$this->config->set("ytake-laravel-smarty", $items);
new \Illuminate\Config\Repository();
$viewFinder = new \Illuminate\View\FileViewFinder($filesystem, ['views'], ['.tpl']);
$this->factory = new \Ytake\LaravelSmarty\SmartyFactory(new \Illuminate\View\Engines\EngineResolver(), $viewFinder, new \Illuminate\Events\Dispatcher(), new Smarty(), $this->config);
$this->factory->setSmartyConfigure();
$this->factory->addSmartyExtension();
$this->factory->resolveSmartyCache();
}
示例9: let
function let(Application $app, Repository $cfg)
{
$cfg->get(Argument::type('string'), Argument::any())->willReturn([]);
$cfg->set(Argument::type('string'), Argument::any())->willReturn([]);
$app->offsetGet('config')->willReturn($cfg);
$this->beConstructedWith($app);
}
示例10: handle
/**
* Handle the command.
*
* @param Repository $config
* @param PreferenceRepositoryInterface $preferences
*/
function handle(Repository $config, PreferenceRepositoryInterface $preferences)
{
// Set the timezone.
if ($timezone = $preferences->get('streams::timezone')) {
$config->set('app.timezone', $timezone->getValue());
$config->set('streams::datetime.timezone', $timezone->getValue());
}
// Set the date format.
if ($format = $preferences->get('streams::date_format')) {
$config->set('streams::datetime.date_format', $format->getValue());
}
// Set the time format.
if ($format = $preferences->get('streams::time_format')) {
$config->set('streams::datetime.time_format', $format->getValue());
}
}
示例11: globalTextStyle
/**
* Enables/Disables Global Text Styles
*
* @param boolean $enabled
* @param textStyle $globalTextStyle
*/
public static function globalTextStyle(boolean $enabled, textStyle $globalTextStyle = NULL)
{
$this->config->set('lavacharts::globalTextStyleEnabled', $enabled);
if (!is_null($globalTextStyle)) {
$this->config->set('lavacharts::globalTextStyle', $globalTextStyle);
}
}
示例12: getConfig
private function getConfig()
{
$applicationConfig = (include __DIR__ . '/AppConfig.php');
$packageConfig = (include __DIR__ . '/../../config/culpa.php');
$packageConfig['users']['classname'] = User::class;
$applicationRepository = new Repository($applicationConfig);
$applicationRepository->set('culpa', $packageConfig);
return $applicationRepository;
}
示例13: setUp
protected function setUp()
{
$this->config = new \Illuminate\Config\Repository();
$filesystem = new \Illuminate\Filesystem\Filesystem();
$items = $filesystem->getRequire(__DIR__ . '/config/config.php');
$this->config->set("ytake-laravel-smarty", $items);
new \Illuminate\Config\Repository();
$viewFinder = new \Illuminate\View\FileViewFinder($filesystem, ['views'], ['.tpl']);
$this->factory = new \Ytake\LaravelSmarty\SmartyFactory(new \Illuminate\View\Engines\EngineResolver(), $viewFinder, new \Illuminate\Events\Dispatcher(), new Smarty(), $this->config);
$this->factory->setSmartyConfigure();
$this->factory->resolveSmartyCache();
$extension = $this->config->get('ytake-laravel-smarty.extension', 'tpl');
$this->factory->addExtension($extension, 'smarty', function () {
// @codeCoverageIgnoreStart
return new \Ytake\LaravelSmarty\Engines\SmartyEngine($this->factory->getSmarty());
// @codeCoverageIgnoreEnd
});
}
示例14: set
/**
* @param string $key
* @param mixed $value
* @return $this|Larfing
*/
public function set($key, $value)
{
parent::set($key, $value);
if ($this->setting['queue'] === false) {
return $this->put($key);
}
$this->_put[implode('', array_slice($this->parseKey($key), 0, 2))] = $key;
return $this;
}
示例15: bindCoreClasses
/**
* Bind the core classes to the container
*/
protected function bindCoreClasses()
{
// Bind request
$this->app->bindIf('request', function () {
return Request::createFromGlobals();
});
// Bind config
$this->app->bindIf('config', function ($app) {
$fileloader = new ConfigLoader($app['files'], __DIR__ . '/../');
$config = new Repository($fileloader, 'config');
$config->set('cache.driver', 'file');
$config->set('cache.path', __DIR__ . '/../../cache');
return $config;
}, true);
// Bind cache
$this->app->bindIf('cache', function ($app) {
return new CacheManager($app);
});
}