PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/config/default.php

https://bitbucket.org/harikt/aura.cli
PHP | 37 lines | 34 code | 0 blank | 3 comment | 0 complexity | 6dc669672f850c18d51f14d140c8e810 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * Package prefix for autoloader.
  4. */
  5. $loader->add('Aura\Cli\\', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'src');
  6. /**
  7. * Instance params and setter values.
  8. */
  9. // Getopt
  10. $di->params['Aura\Cli\Getopt']['option_factory'] = $di->lazyNew('Aura\Cli\OptionFactory');
  11. // Command
  12. $di->params['Aura\Cli\AbstractCommand']['context'] = $di->lazyGet('cli_context');
  13. $di->params['Aura\Cli\AbstractCommand']['stdio'] = $di->lazyGet('cli_stdio');
  14. $di->params['Aura\Cli\AbstractCommand']['getopt'] = $di->lazyNew('Aura\Cli\Getopt');
  15. $di->params['Aura\Cli\AbstractCommand']['signal'] = $di->lazyGet('signal_manager');
  16. /**
  17. * Dependency services.
  18. */
  19. $di->set('cli_context', function() use ($di) {
  20. return $di->newInstance('Aura\Cli\Context', array(
  21. 'globals' => $GLOBALS,
  22. ));
  23. });
  24. $di->set('cli_stdio', function() use ($di) {
  25. $vt100 = $di->newInstance('Aura\Cli\Vt100');
  26. return $di->newInstance('Aura\Cli\Stdio', [
  27. 'stdin' => fopen('php://stdin', 'r'),
  28. 'stdout' => fopen('php://stdout', 'w+'),
  29. 'stderr' => fopen('php://stderr', 'w+'),
  30. 'vt100' => $vt100,
  31. ]);
  32. });