SampleShell.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SampleShell file
  5. *
  6. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  7. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  8. *
  9. * Licensed under The MIT License
  10. * For full copyright and license information, please see the LICENSE.txt
  11. * Redistributions of files must retain the above copyright notice
  12. *
  13. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  14. * @link https://cakephp.org CakePHP(tm) Project
  15. * @since 1.2.0
  16. * @license https://opensource.org/licenses/mit-license.php MIT License
  17. */
  18. /**
  19. * SampleShell
  20. */
  21. namespace TestApp\Shell;
  22. use Cake\Console\ConsoleOptionParser;
  23. use Cake\Console\Shell;
  24. class SampleShell extends Shell
  25. {
  26. public $tasks = ['Sample'];
  27. /**
  28. * main method
  29. *
  30. * @return void
  31. */
  32. public function main()
  33. {
  34. $this->out('This is the main method called from SampleShell');
  35. }
  36. /**
  37. * derp method
  38. *
  39. * @return void
  40. */
  41. public function derp()
  42. {
  43. $this->out('This is the example method called from TestPlugin.SampleShell');
  44. }
  45. public function withAbort()
  46. {
  47. $this->abort('Bad things');
  48. }
  49. public function returnValue()
  50. {
  51. return 99;
  52. }
  53. /**
  54. * @inheritDoc
  55. */
  56. public function runCommand(array $argv, bool $autoMethod = false, array $extra = [])
  57. {
  58. return parent::runCommand($argv, $autoMethod, $extra);
  59. }
  60. /**
  61. * @inheritDoc
  62. */
  63. public function getOptionParser(): ConsoleOptionParser
  64. {
  65. return parent::getOptionParser();
  66. }
  67. }