ObjectsProvider.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Console\Tests\Descriptor;
  11. use Symfony\Component\Console\Input\InputArgument;
  12. use Symfony\Component\Console\Input\InputDefinition;
  13. use Symfony\Component\Console\Input\InputOption;
  14. use Symfony\Component\Console\Tests\Fixtures\DescriptorApplication1;
  15. use Symfony\Component\Console\Tests\Fixtures\DescriptorApplication2;
  16. use Symfony\Component\Console\Tests\Fixtures\DescriptorCommand1;
  17. use Symfony\Component\Console\Tests\Fixtures\DescriptorCommand2;
  18. /**
  19. * @author Jean-François Simon <contact@jfsimon.fr>
  20. */
  21. class ObjectsProvider
  22. {
  23. public static function getInputArguments()
  24. {
  25. return array(
  26. 'input_argument_1' => new InputArgument('argument_name', InputArgument::REQUIRED),
  27. 'input_argument_2' => new InputArgument('argument_name', InputArgument::IS_ARRAY, 'argument description'),
  28. 'input_argument_3' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value'),
  29. 'input_argument_4' => new InputArgument('argument_name', InputArgument::REQUIRED, "multiline\nargument description"),
  30. 'input_argument_with_style' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', '<comment>style</>'),
  31. );
  32. }
  33. public static function getInputOptions()
  34. {
  35. return array(
  36. 'input_option_1' => new InputOption('option_name', 'o', InputOption::VALUE_NONE),
  37. 'input_option_2' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', 'default_value'),
  38. 'input_option_3' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description'),
  39. 'input_option_4' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'option description', array()),
  40. 'input_option_5' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, "multiline\noption description"),
  41. 'input_option_6' => new InputOption('option_name', array('o', 'O'), InputOption::VALUE_REQUIRED, 'option with multiple shortcuts'),
  42. 'input_option_with_style' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description', '<comment>style</>'),
  43. 'input_option_with_style_array' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'option description', array('<comment>Hello</comment>', '<info>world</info>')),
  44. );
  45. }
  46. public static function getInputDefinitions()
  47. {
  48. return array(
  49. 'input_definition_1' => new InputDefinition(),
  50. 'input_definition_2' => new InputDefinition(array(new InputArgument('argument_name', InputArgument::REQUIRED))),
  51. 'input_definition_3' => new InputDefinition(array(new InputOption('option_name', 'o', InputOption::VALUE_NONE))),
  52. 'input_definition_4' => new InputDefinition(array(
  53. new InputArgument('argument_name', InputArgument::REQUIRED),
  54. new InputOption('option_name', 'o', InputOption::VALUE_NONE),
  55. )),
  56. );
  57. }
  58. public static function getCommands()
  59. {
  60. return array(
  61. 'command_1' => new DescriptorCommand1(),
  62. 'command_2' => new DescriptorCommand2(),
  63. );
  64. }
  65. public static function getApplications()
  66. {
  67. return array(
  68. 'application_1' => new DescriptorApplication1(),
  69. 'application_2' => new DescriptorApplication2(),
  70. );
  71. }
  72. }