]> git.datanom.net - omvzfs.git/blob - old/OMVModulePoolAction.php
Fix some bugs. Implement methods needed by zfs.inc. Zpool.php completed
[omvzfs.git] / old / OMVModulePoolAction.php
1 <?php
2 /*
3 * OMVModulePoolAction.php
4 *
5 * Copyright 2013 Michael Rasmussen <mir@datanom.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 * MA 02110-1301, USA.
21 */
22
23
24 class OMVModulePoolAction {
25 const OMVModulePoolAction_TYPE_CREATE = 0;
26 const OMVModulePoolAction_TYPE_ADD = 1;
27
28 /**
29 * Return pool action
30 * @param type An OMVModulePoolAction.
31 * @return action
32 * @throws Exception
33 */
34 public static function getAction($action) {
35 if ($action === self::OMVModulePoolAction_TYPE_CREATE) {
36 return 'create';
37 } else if ($action === self::OMVModulePoolAction_TYPE_ADD) {
38 return 'add';
39 } else {
40 throw new Exception("$action: Unknown OMVModulePoolType");
41 }
42 }
43
44 /**
45 * Return OMVModulePoolAction as string.
46 * @param type An OMVModulePoolAction.
47 * @return type as string.
48 * @throws Exception.
49 */
50 public static function toString($type) {
51 if ($type === self::OMVModulePoolAction_TYPE_CREATE) {
52 return 'OMVModulePoolAction_TYPE_CREATE';
53 } else if ($type === self::OMVModulePoolAction_TYPE_ADD) {
54 return 'OMVModulePoolAction_TYPE_ADD';
55 } else {
56 throw new Exception("$type: Unknown OMVModulePoolType");
57 }
58 }
59 }
This page took 0.13152 seconds and 6 git commands to generate.