Result.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License along
  14. * with this program; if not, write to the Free Software Foundation, Inc.,
  15. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. * http://www.gnu.org/copyleft/gpl.html
  17. *
  18. * @file
  19. */
  20. namespace MediaWiki\Shell;
  21. /**
  22. * Returned by MediaWiki\Shell\Command::execute()
  23. *
  24. * @since 1.30
  25. */
  26. class Result {
  27. /** @var int */
  28. private $exitCode;
  29. /** @var string */
  30. private $stdout;
  31. /** @var string|null */
  32. private $stderr;
  33. /**
  34. * @param int $exitCode
  35. * @param string $stdout
  36. * @param string|null $stderr
  37. */
  38. public function __construct( $exitCode, $stdout, $stderr = null ) {
  39. $this->exitCode = $exitCode;
  40. $this->stdout = $stdout;
  41. $this->stderr = $stderr;
  42. }
  43. /**
  44. * Returns exit code of the process
  45. *
  46. * @return int
  47. */
  48. public function getExitCode() {
  49. return $this->exitCode;
  50. }
  51. /**
  52. * Returns stdout of the process
  53. *
  54. * @return string
  55. */
  56. public function getStdout() {
  57. return $this->stdout;
  58. }
  59. /**
  60. * Returns stderr of the process or null if the Command was configured to add stderr to stdout
  61. * with includeStderr( true )
  62. *
  63. * @return string|null
  64. */
  65. public function getStderr() {
  66. return $this->stderr;
  67. }
  68. }