]> git.datanom.net - omvzfs.git/commitdiff
Latest version
authorMichael Rasmussen <mir@datanom.net>
Sun, 23 Feb 2014 23:36:10 +0000 (00:36 +0100)
committerMichael Rasmussen <mir@datanom.net>
Sun, 23 Feb 2014 23:36:10 +0000 (00:36 +0100)
OMVModulePoolAction.php [new file with mode: 0644]

diff --git a/OMVModulePoolAction.php b/OMVModulePoolAction.php
new file mode 100644 (file)
index 0000000..06d5195
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+/*
+ * OMVModulePoolAction.php
+ *
+ * Copyright 2013 Michael Rasmussen <mir@datanom.net>
+ *
+ * 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.
+ */
+
+
+class OMVModulePoolAction {
+       const OMVModulePoolAction_TYPE_CREATE   = 0;
+       const OMVModulePoolAction_TYPE_ADD              = 1;
+
+       /**
+        * Return pool action
+        * @param type An OMVModulePoolAction.
+        * @return action
+        * @throws Exception
+        */
+       public static function getAction($action) {
+               if ($action === self::OMVModulePoolAction_TYPE_CREATE) {
+                       return 'create';
+               } else if ($action === self::OMVModulePoolAction_TYPE_ADD) {
+                       return 'add';
+               } else {
+                       throw new Exception("$action: Unknown OMVModulePoolType");
+               }
+       }
+
+       /**
+        * Return OMVModulePoolAction as string.
+        * @param type An OMVModulePoolAction.
+        * @return type as string.
+        * @throws Exception.
+        */
+       public static function toString($type) {
+               if ($type === self::OMVModulePoolAction_TYPE_CREATE) {
+                       return 'OMVModulePoolAction_TYPE_CREATE';
+               } else if ($type === self::OMVModulePoolAction_TYPE_ADD) {
+                       return 'OMVModulePoolAction_TYPE_ADD';
+               } else {
+                       throw new Exception("$type: Unknown OMVModulePoolType");
+               }
+       }
+}
This page took 0.032107 seconds and 5 git commands to generate.