Esempio n. 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);
 }
Esempio n. 2
0
 /**
  * Registers the application's providers
  * @param Blocklyduino $app The current application
  */
 static function configure(Blocklyduino $app)
 {
     // UrlGeneratorService
     $app->register(new UrlGeneratorServiceProvider());
     // CodebenderService
     $app->register(new CodebenderServiceProvider($app['config']['codebender_api']));
     // Twig
     $app->register(new TwigServiceProvider(), array('twig.path' => __DIR__ . '/../src/views'));
     $app['twig'] = $app->share($app->extend('twig', function (\Twig_Environment $twig) use($app) {
         Dependencies::addAppAssets($twig, $app);
         Dependencies::addBlocklyduinoAssets($twig, $app);
         return $twig;
     }));
 }