about summary refs log tree commit diff stats
path: root/wiki/vendor/splitbrain/php-cli/src/Exception.php
diff options
context:
space:
mode:
authorahriman <ahriman@falte.red>2018-12-03 19:22:25 -0500
committerahriman <ahriman@falte.red>2018-12-03 19:22:25 -0500
commit0ae8cbf5c0b1a198b963490985b7738392ebcb97 (patch)
treeb2c77ae72c6b717e2b97492065196ac5ffb2d9e2 /wiki/vendor/splitbrain/php-cli/src/Exception.php
parentf57f6cc5a2d159f90168d292437dc4bd8cd7f934 (diff)
downloadsite-0ae8cbf5c0b1a198b963490985b7738392ebcb97.tar.gz
installed dokuwiki, added to navbar, updated news
Diffstat (limited to 'wiki/vendor/splitbrain/php-cli/src/Exception.php')
-rw-r--r--wiki/vendor/splitbrain/php-cli/src/Exception.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/wiki/vendor/splitbrain/php-cli/src/Exception.php b/wiki/vendor/splitbrain/php-cli/src/Exception.php
new file mode 100644
index 0000000..b2aa981
--- /dev/null
+++ b/wiki/vendor/splitbrain/php-cli/src/Exception.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace splitbrain\phpcli;
+
+/**
+ * Class Exception
+ *
+ * The code is used as exit code for the CLI tool. This should probably be extended. Many cases just fall back to the
+ * E_ANY code.
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ * @license MIT
+ */
+class Exception extends \Exception
+{
+    const E_ANY = -1; // no error code specified
+    const E_UNKNOWN_OPT = 1; //Unrecognized option
+    const E_OPT_ARG_REQUIRED = 2; //Option requires argument
+    const E_OPT_ARG_DENIED = 3; //Option not allowed argument
+    const E_OPT_ABIGUOUS = 4; //Option abiguous
+    const E_ARG_READ = 5; //Could not read argv
+
+    /**
+     * @param string $message The Exception message to throw.
+     * @param int $code The Exception code
+     * @param \Exception $previous The previous exception used for the exception chaining.
+     */
+    public function __construct($message = "", $code = 0, \Exception $previous = null)
+    {
+        if (!$code) {
+            $code = self::E_ANY;
+        }
+        parent::__construct($message, $code, $previous);
+    }
+}