本文整理汇总了PHP中Illuminate\Config\Repository::package方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::package方法的具体用法?PHP Repository::package怎么用?PHP Repository::package使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Config\Repository
的用法示例。
在下文中一共展示了Repository::package方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Creates new instance of Image Manager
*
* @param \Illuminate\Config\Repository $config
*/
public function __construct(\Illuminate\Config\Repository $config = null)
{
// create configurator
if (is_a($config, '\\Illuminate\\Config\\Repository')) {
$this->config = $config;
} else {
$config_path = __DIR__ . '/../../config';
$env = 'production';
$file = new Filesystem();
$loader = new FileLoader($file, $config_path);
$this->config = new Config($loader, $env);
$this->config->package('intervention/image', $config_path, 'image');
}
}
示例2: getApplication
public function getApplication()
{
$app = new Application();
$app->instance('path', __DIR__);
$app['path.storage'] = __DIR__ . '/storage';
// Monolog
$log = m::mock('Illuminate\\Log\\Writer');
$log->shouldReceive('getMonolog')->andReturn(m::mock('Monolog\\Logger'));
$app['log'] = $log;
// Config
$config = new Repository(m::mock('Illuminate\\Config\\LoaderInterface'), 'production');
$config->getLoader()->shouldReceive('addNamespace')->with('laravel-sentry', __DIR__);
$config->getLoader()->shouldReceive('cascadePackage')->andReturnUsing(function ($env, $package, $group, $items) {
return $items;
});
$config->getLoader()->shouldReceive('exists')->with('environments', 'laravel-sentry')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('dsn', 'laravel-sentry')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('level', 'laravel-sentry')->andReturn(false);
$config->getLoader()->shouldReceive('load')->with('production', 'config', 'laravel-sentry')->andReturn(array('environments' => array('prod', 'production'), 'dsn' => '', 'level' => 'error'));
$config->package('foo/laravel-sentry', __DIR__);
$app['config'] = $config;
// Env
$app['env'] = 'production';
return $app;
}
示例3: registerModule
/**
* Register a module
*/
public function registerModule($module)
{
// Register the module as a package
$this->config->package('app/' . $module, str_finish($this->modulesDirectory, '/') . $module . '/config');
// Add routes
$routes = str_finish($this->modulesDirectory, '/') . $module . '/routes.php';
if ($this->filesystem->exists($routes)) {
$this->filesystem->getRequire($routes);
}
// Run module boot
$boot = str_finish($this->modulesDirectory, '/') . $module . '/boot.php';
if ($this->filesystem->exists($boot)) {
$this->filesystem->getRequire($boot);
}
}
示例4: getLoader
private function getLoader()
{
// Mock application
$functions = array('functions' => array('array_get', 'fooBar' => function () {
return 'FOOBAR';
}));
$filters = array('filters' => array('camel_case', 'snakeCase' => function () {
return 'snakeCASE';
}));
$app = new Application();
$app->instance('path', __DIR__);
$config = new Repository(m::mock('Illuminate\\Config\\LoaderInterface'), 'production');
$config->getLoader()->shouldReceive('addNamespace')->with('twigbridge', __DIR__);
$config->getLoader()->shouldReceive('cascadePackage')->andReturnUsing(function ($env, $package, $group, $items) {
return $items;
});
$config->getLoader()->shouldReceive('exists')->with('functions', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('filters', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('load')->with('production', 'config', 'twigbridge')->andReturn(array_merge($functions, $filters));
$config->package('foo/twigbridge', __DIR__);
$app['config'] = $config;
// Get instance of HelperLoader
return new HelperLoader($app, new Twig_Environment());
}
示例5: package
/**
* Register a package for cascading configuration.
*
* @param string $package
* @param string $hint
* @param string $namespace
* @return void
* @static
*/
public static function package($package, $hint, $namespace = null)
{
\Illuminate\Config\Repository::package($package, $hint, $namespace);
}
示例6: registerConfigRepository
/**
* Register config repository
*/
public function registerConfigRepository()
{
$this->getContainer()->bindIf('config', function () {
$dir = __DIR__ . '/../../config';
$config = new Repository(new FileLoader($this->getFilesystem(), $dir), 'development');
$config->package('anomaly/lexicon', $dir);
return $config;
}, true);
}
示例7: getApplication
public function getApplication(array $twig_options = array(), array $paths = array(), array $hints = array())
{
$app = new Application();
$app->instance('path', __DIR__);
$app['path.storage'] = __DIR__ . '/storage';
$finder = m::mock('Illuminate\\View\\ViewFinderInterface');
$finder->shouldReceive('getPaths')->andReturn($paths);
$finder->shouldReceive('getHints')->andReturn($hints);
$app['view'] = new Environment(m::mock('Illuminate\\View\\Engines\\EngineResolver'), $finder, m::mock('Illuminate\\Events\\Dispatcher'));
$config = new Repository(m::mock('Illuminate\\Config\\LoaderInterface'), 'production');
$twig_options or $twig_options = array('egg' => 'fried');
$config->getLoader()->shouldReceive('addNamespace')->with('twigbridge', __DIR__);
$config->getLoader()->shouldReceive('cascadePackage')->andReturnUsing(function ($env, $package, $group, $items) {
return $items;
});
$config->getLoader()->shouldReceive('exists')->with('extension', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('extensions', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('delimiters', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('twig', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('load')->with('production', 'config', 'twigbridge')->andReturn(array('extension' => 'twig', 'twig' => $twig_options, 'extensions' => array('TwigBridge\\Extensions\\Html')));
$config->package('foo/twigbridge', __DIR__);
$app['config'] = $config;
return $app;
}
示例8: __construct
/**
* constructor
*/
private function __construct()
{
$hint = realpath(__DIR__ . '/../config');
$this->config = new Repository(new FileLoader(new Filesystem(), $hint), 'test');
$this->config->package('eviweb/laravel4-workbench', $hint, 'workbench');
}
示例9: package
/**
* Register a package for cascading configuration.
*
* @param string $package
* @param string $hint
* @param string $namespace
* @return void
*/
public function package($package, $hint, $namespace = null)
{
parent::package($package, $hint, $namespace);
$namespaceAppPath = app_path() . '/config/' . str_replace('.', '/', $namespace);
$this->appRepository->package($package, $namespaceAppPath, $namespace);
}
示例10: registerConfigNamespace
/**
* Register Config Namespace
*
* Adds a namespace to the 'Config' instance for use with the double colon.
*
* @return void
*/
protected function registerConfigNamespace()
{
$this->configManager->package(strtolower($this->name), $this->directory, strtolower($this->name));
$this->configManager->addNamespace(strtolower($this->name), $this->directory . '/config');
}
示例11: testAddHandlerEnabled
public function testAddHandlerEnabled()
{
$app = new Application();
// Monolog
$log = m::mock('Illuminate\\Log\\Writer');
$monolog = m::mock('Monolog\\Logger');
$monolog->shouldReceive('pushHandler')->once();
$log->shouldReceive('getMonolog')->andReturn($monolog);
$app['log'] = $log;
// Config
$config = new Repository(m::mock('Illuminate\\Config\\LoaderInterface'), 'production');
$config->getLoader()->shouldReceive('addNamespace')->with('laravel-sentry', __DIR__);
$config->getLoader()->shouldReceive('cascadePackage')->andReturnUsing(function ($env, $package, $group, $items) {
return $items;
});
$config->getLoader()->shouldReceive('exists')->with('environments', 'laravel-sentry')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('dsn', 'laravel-sentry')->andReturn(false);
$config->getLoader()->shouldReceive('exists')->with('level', 'laravel-sentry')->andReturn(false);
$config->getLoader()->shouldReceive('load')->with('production', 'config', 'laravel-sentry')->andReturn(array('environments' => array('prod', 'production'), 'dsn' => 'http://example.com', 'level' => 'error'));
$config->package('foo/laravel-sentry', __DIR__);
$app['config'] = $config;
$app['env'] = 'production';
$log = new Log($app);
// Raven
$raven = m::mock('Raven_Client');
$raven->shouldReceive('getFoo')->andReturn('BAR');
$log->setRaven($raven);
$log->addHandler();
}
示例12: getLoader
private function getLoader()
{
// Mock application
$aliases = array('aliases' => array('Auth' => 'Illuminate\\Support\\Facades\\Auth', 'Lookup' => 'TwigBridgeTests\\Fixtures\\Extension\\Lookup'));
$shortcuts = array('alias_shortcuts' => array('URL' => 'URL_TO', 'logged_in' => 'auth_check'));
$app = new Application();
$app->instance('path', __DIR__);
$config = new Repository(m::mock('Illuminate\\Config\\LoaderInterface'), 'production');
$config->getLoader()->shouldReceive('load')->once()->with('production', 'app', null)->andReturn($aliases);
$config->getLoader()->shouldReceive('addNamespace')->with('twigbridge', __DIR__);
$config->getLoader()->shouldReceive('cascadePackage')->andReturnUsing(function ($env, $package, $group, $items) {
return $items;
});
$config->getLoader()->shouldReceive('exists')->once()->with('alias_shortcuts', 'twigbridge')->andReturn(false);
$config->getLoader()->shouldReceive('load')->once()->with('production', 'config', 'twigbridge')->andReturn($shortcuts);
$config->package('foo/twigbridge', __DIR__);
$app['config'] = $config;
// Get instance of AliasLoader
return new AliasLoader($app, new Twig_Environment());
}