本文整理汇总了PHP中Illuminate\Contracts\Foundation\Application::offsetGet方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::offsetGet方法的具体用法?PHP Application::offsetGet怎么用?PHP Application::offsetGet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Foundation\Application
的用法示例。
在下文中一共展示了Application::offsetGet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFormRequest
/**
* Creates and initializes an Form Request instance
*
* @param $class
* @return FormRequest
*/
protected function createFormRequest($class)
{
$formRequest = new $class();
$request = $this->container->offsetGet('request');
$formRequest->initialize($request->query->all(), $request->request->all(), $request->attributes->all(), $request->cookies->all(), array(), $request->server->all(), $request->getContent());
if ($session = $request->getSession()) {
$formRequest->setSession($session);
}
$formRequest->setUserResolver($request->getUserResolver());
$formRequest->setRouteResolver($request->getRouteResolver());
return $formRequest;
}
示例2: getConfig
/**
* @param string $providerName
*
* @return array
*/
protected function getConfig($providerName)
{
try {
/** @var Contracts\ConfigInterface $config */
$config = $this->app->make(self::SERVICE_CONTAINER_PREFIX . $providerName);
if (!$config instanceof Contracts\ConfigInterface) {
throw new InvalidArgumentException('Config class does not implement config contract');
}
return $config->get();
} catch (\ReflectionException $e) {
return $this->app->offsetGet('config')['services.' . $providerName] ?: (new Config('foobar', 'foobar', 'foobar'))->get();
}
}
示例3: getConfig
/**
* @param string $providerName
*
* @return array
*/
protected function getConfig($providerName)
{
return $this->app->offsetGet('config')['services.' . $providerName];
}