public function __invoke(Container $container)
 {
     $container->set(Filesystem::class, function () {
         return new Filesystem();
     });
     $container->set(OutputFormatter::class, function () {
         return new OutputFormatter();
     });
 }
Exemplo n.º 2
0
 public function __invoke(Container $container)
 {
     $container->set(Cli::class, function (Container $c) {
         $cli = new Cli();
         foreach ($c->get('commands') as $class) {
             $class::register($cli);
         }
         return $cli;
     });
     $container->set(Args::class, function (Container $c) {
         return $c->get(Cli::class)->parse($c->get('argv'), true);
     });
 }
 protected function setEntry(Container $container, $option, $env, $default = null, $type = null)
 {
     $container->set($option, function (Container $c) use($option, $env, $default, $type) {
         $defaultValue = $this->env($env, $default);
         if ($type !== null) {
             $defaultValue = filter_var($defaultValue, $type);
         }
         return $c->get(Args::class)->getOpt($option, $defaultValue);
     });
 }
 protected function registerCommand(Container $container, $class, callable $factory)
 {
     $container->set($class, $factory);
     return ['name' => $class::$name, 'class' => $class];
 }
 protected function setMigrationCreator(Container $c)
 {
     $c->set(MigrationCreator::class, function (Container $c) {
         return new MigrationCreator($c->get(Filesystem::class));
     });
 }