ConsoleServiceProvider.php 810 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Knp\Provider;
  3. use Silex\ServiceProviderInterface;
  4. use Silex\Application;
  5. use Knp\Console\Application as ConsoleApplication;
  6. use Knp\Console\ConsoleEvents;
  7. use Knp\Console\ConsoleEvent;
  8. class ConsoleServiceProvider implements ServiceProviderInterface
  9. {
  10. public function register(Application $app)
  11. {
  12. $app['console'] = $app->share(function() use ($app) {
  13. $application = new ConsoleApplication(
  14. $app,
  15. $app['console.project_directory'],
  16. $app['console.name'],
  17. $app['console.version']
  18. );
  19. $app['dispatcher']->dispatch(ConsoleEvents::INIT, new ConsoleEvent($application));
  20. return $application;
  21. });
  22. }
  23. public function boot(Application $app)
  24. {
  25. }
  26. }