Пример #1
0
 /**
  * Instantiate a new Blocklyduino Application.
  * Objects and parameters can be passed as argument to the constructor.
  * @param array $values The parameters or objects.
  */
 function __construct(array $values = array())
 {
     parent::__construct();
     // Most of our configuration is actually in this YAML file
     $this->register(new YamlConfigServiceProvider(__DIR__ . '/../src/config/settings.yml'));
     // Set to false if you don't want debug messages
     $this['debug'] = $this['config']['debug']['is_on'];
     foreach ($values as $key => $value) {
         $this[$key] = $value;
     }
     Dependencies::configure($this);
     Routes::configure($this);
 }
Пример #2
0
 /**
  * Create a Kernel object from a request.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   The request.
  * @param $class_loader
  *   The class loader. Normally Composer's ClassLoader, as included by the
  *   front controller, but may also be decorated; e.g.,
  *   \Symfony\Component\ClassLoader\ApcClassLoader.
  * @param string $environment
  *   String indicating the environment, e.g. 'prod' or 'dev'.
  * @param bool $allow_dumping
  *   (optional) FALSE to stop the container from being written to or read
  *   from disk. Defaults to TRUE.
  *
  * @return static
  */
 public static function createFromRequest(Request $request, $class_loader)
 {
     static::initContainer();
     $routes = Routes::getAll();
     $context = new RequestContext();
     $context->fromRequest($request);
     $matcher = new UrlMatcher($routes, $context);
     $dispatcher = new EventDispatcher();
     $dispatcher->addSubscriber(new RouterListener($matcher));
     $resolver = new ControllerResolver();
     $kernel = new HttpKernel($dispatcher, $resolver);
     return $kernel;
 }
Пример #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  RouteRequest  $request
  * @return Response
  */
 public function store(RouteRequest $request)
 {
     Routes::create($request->all());
     Session::flash('success_message', 'Route Updated!!!');
     return redirect('route');
 }