本文整理汇总了PHP中Symfony\Component\HttpKernel\HttpKernel::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpKernel::__construct方法的具体用法?PHP HttpKernel::__construct怎么用?PHP HttpKernel::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpKernel\HttpKernel
的用法示例。
在下文中一共展示了HttpKernel::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($routes, Request $request, EventDispatcher $dispatcher, ControllerResolver $resolver)
{
$this->deflRes = new NodeResponse();
$this->context = new RequestContext($request->getBaseUrl(), $request->getMethod(), $request->getHost(), $request->getScheme(), $request->getPort(), $request->getPort());
$this->matcher = new UrlMatcher($routes, $this->context);
parent::__construct($dispatcher, $resolver);
}
示例2: __construct
public function __construct($environment = 'prod', $debug = false)
{
// dev, prod or schell
define('Ki_ENVIRONMENT', $environment);
define('Ki_DEBUG', is_bool($debug) ? $debug : false);
if (Ki_DEBUG) {
Debug::enable();
} else {
ini_set('display_errors', 0);
}
if (!in_array(Ki_ENVIRONMENT, array('dev', 'prod', 'shell'))) {
throw new \Exception("El entorno '" . Ki_ENVIRONMENT . "' no está permitido en el sistema.");
}
// Agrega la instancia del kernel al contenedor de servicios.
// Util para ser usada cuando de desde realizar una sub peticion dende en controlador.
Service::instance('kernel', $this);
// Registra la bolsa temporal en la session
$session = Service::get('session');
$session->registerBag(Service::get('temporary_bag'));
$session->start();
// Carga la configuracion del proyecto
Service::get('config')->loadConfigGlobal();
// Carga la configuracion de los bundles
$this->registerBundles();
// Carga la clase translator
Service::get('translator')->loader(Service::get('session')->getLocale());
$this->registerProviders();
$this->registerListeners();
if (Ki_ENVIRONMENT == 'shell') {
Service::get('shell')->console();
return;
}
parent::__construct(Service::get('event'), Service::get('kernel.resolver'));
}
示例3: __construct
public function __construct($body, $status, $headers, \Closure $customizer = null)
{
$this->body = $body;
$this->status = $status;
$this->headers = $headers;
$this->customizer = $customizer;
parent::__construct(new EventDispatcher(), $this);
}
示例4: __construct
/**
* Constructor.
*
* @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance
* @param ContainerInterface $container A ContainerInterface instance
* @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance
*/
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver)
{
parent::__construct($dispatcher, $controllerResolver);
$this->container = $container;
// the request scope might have been created before (see FrameworkBundle)
if (!$container->hasScope('request')) {
$container->addScope(new Scope('request'));
}
}
示例5: __construct
public function __construct($responses)
{
foreach ($responses as $response) {
$this->bodies[] = $response['body'];
$this->statuses[] = $response['status'];
$this->headers[] = $response['headers'];
}
parent::__construct(new EventDispatcher(), $this);
}
示例6: __construct
/**
* Constructor
*
* @param ServiceContainer container
* @param ApplicationInterface $app
* @param ControllerResolverInterface $resolver
*/
public function __construct(ServiceContainer $container, ApplicationInterface $app, ControllerResolverInterface $resolver)
{
$this->container = $container;
$this->resolver = $resolver;
$this->container->setApp($app);
$this->loadConfig()->loadRouting();
$this->container->setConfig($app->getConfig());
$this->dispatchEvent(KernelEvents::APP_LOADED, new KernelEvent($container));
$this->container['kernel'] = $this;
parent::__construct($this->container['core']['dispatcher'], $resolver);
}
示例7: __construct
/**
* Constructor.
*
* @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance
* @param ContainerInterface $container A ContainerInterface instance
* @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance
* @param RequestStack $requestStack A stack for master/sub requests
* @param bool $triggerDeprecation Whether or not to trigger the deprecation warning for the ContainerAwareHttpKernel
*/
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null, $triggerDeprecation = true)
{
parent::__construct($dispatcher, $controllerResolver, $requestStack);
if ($triggerDeprecation) {
@trigger_error('The ' . __CLASS__ . ' class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\\Component\\HttpKernel\\HttpKernel class instead.', E_USER_DEPRECATED);
}
$this->container = $container;
// the request scope might have been created before (see FrameworkBundle)
if (!$container->hasScope('request')) {
$container->addScope(new Scope('request'));
}
}
示例8: __construct
public function __construct()
{
$this->shared = array();
$this->providers = array();
$resolver = new ControllerResolver($this);
$env = $this->getEnvironment();
$this->dispatcher = new EventDispatcher();
$this->dispatcher->addSubscriber(new EventListener\RedirectListener());
$this->dispatcher->addSubscriber(new HttpKernel\EventListener\ResponseListener('UTF-8'));
$this->dispatcher->addSubscriber(new ExceptionHandler($env == 'dev'));
parent::__construct($this->dispatcher, $resolver);
}
示例9: __construct
public function __construct()
{
$this->container = new Container();
$this->initConfigs();
$this->container->init($this);
$this->initRoutes();
$this->initModules();
$this->initEnvironment();
$this->initTimezone();
$this->initUnicode();
$this->container['kernel'] = $this;
parent::__construct($this->container['dispatcher'], $this->container['resolver']);
}
示例10: __construct
public function __construct($map)
{
$this->routes = new RouteCollection();
foreach ($map as $pattern => $to) {
if (false !== strpos($pattern, ' ')) {
list($method, $pattern) = explode(' ', $pattern, 2);
$requirements = array('_method' => $method);
} else {
$requirements = array();
}
$route = new Route($pattern, array('_controller' => $to), $requirements);
$this->routes->add(str_replace(array('/', ':'), '_', $pattern), $route);
}
$dispatcher = new EventDispatcher();
$dispatcher->connect('core.request', array($this, 'parseRequest'));
$resolver = new ControllerResolver();
parent::__construct($dispatcher, $resolver);
}
示例11: __construct
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver)
{
parent::__construct($dispatcher, $controllerResolver);
$this->container = $container;
}
示例12: __construct
public function __construct()
{
parent::__construct(new EventDispatcher(), $this);
}
示例13: __construct
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null)
{
parent::__construct($dispatcher, $controllerResolver, $requestStack);
$this->container = $container;
if (!$container->hasScope('request')) {
$container->addScope(new Scope('request'));
}
}
示例14: __construct
public function __construct()
{
$this->container = Container::getInstance();
parent::__construct($this->container->get('dispatcher'), $this->container->get('resolver'));
}
示例15: __construct
/**
* Constructor.
*
* @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance
* @param ContainerInterface $container A ContainerInterface instance
* @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance
*/
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver)
{
parent::__construct($dispatcher, $controllerResolver);
$this->container = $container;
$container->addScope(new Scope('request'));
}