summaryrefslogtreecommitdiff
path: root/www/wiki/includes/shell/Result.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/includes/shell/Result.php')
-rw-r--r--www/wiki/includes/shell/Result.php76
1 files changed, 76 insertions, 0 deletions
diff --git a/www/wiki/includes/shell/Result.php b/www/wiki/includes/shell/Result.php
new file mode 100644
index 00000000..a105cd12
--- /dev/null
+++ b/www/wiki/includes/shell/Result.php
@@ -0,0 +1,76 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Shell;
+
+/**
+ * Returned by MediaWiki\Shell\Command::execute()
+ *
+ * @since 1.30
+ */
+class Result {
+ /** @var int */
+ private $exitCode;
+
+ /** @var string */
+ private $stdout;
+
+ /** @var string|null */
+ private $stderr;
+
+ /**
+ * @param int $exitCode
+ * @param string $stdout
+ * @param string|null $stderr
+ */
+ public function __construct( $exitCode, $stdout, $stderr = null ) {
+ $this->exitCode = $exitCode;
+ $this->stdout = $stdout;
+ $this->stderr = $stderr;
+ }
+
+ /**
+ * Returns exit code of the process
+ *
+ * @return int
+ */
+ public function getExitCode() {
+ return $this->exitCode;
+ }
+
+ /**
+ * Returns stdout of the process
+ *
+ * @return string
+ */
+ public function getStdout() {
+ return $this->stdout;
+ }
+
+ /**
+ * Returns stderr of the process or null if the Command was configured to add stderr to stdout
+ * with includeStderr( true )
+ *
+ * @return string|null
+ */
+ public function getStderr() {
+ return $this->stderr;
+ }
+}