File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ function setParameters( $parm_array )
37
37
38
38
// Store values of optional parameters
39
39
$ this ->limit = isset ( $ parm_array [ 'limit ' ] ) ? intval ( $ parm_array [ 'limit ' ] ) : -1 ;
40
- $ this ->offset = intval ( $ parm_array [ 'offset ' ] );
41
- $ this ->depth = intval ( $ parm_array [ 'depth ' ] );
40
+ $ this ->offset = isset ( $ parm_array [ ' offset ' ] ) ? intval ( $ parm_array [ 'offset ' ] ) : 0 ;
41
+ $ this ->depth = isset ( $ parm_array [ ' depth ' ] ) ? intval ( $ parm_array [ 'depth ' ] ) : 1 ;
42
42
if ( $ this ->depth == 0 )
43
43
$ this ->depth = 1 ;
44
44
$ this ->ignore_visibility = isset ( $ parm_array [ 'ignore_visibility ' ] ) ? true : false ;
Original file line number Diff line number Diff line change @@ -14,11 +14,25 @@ function getHelpText()
14
14
15
15
function setParameters ( $ parm_array )
16
16
{
17
- $ this ->available = ( $ parm_array [ 'available ' ] == 'true ' ) ? 1 : -1 ;
18
- if ( $ parm_array [ 'available ' ] == 'false ' )
19
- $ this ->available = 0 ;
20
- if ( $ this ->available == -1 )
21
- return 'Missing or illegal availability value ' ;
17
+ if ( !isset ( $ parm_array [ 'available ' ] ) )
18
+ {
19
+ return 'Missing availability value ' ;
20
+ }
21
+
22
+ switch ( $ parm_array [ 'available ' ] )
23
+ {
24
+ case 'true ' :
25
+ $ this ->available = 1 ;
26
+ break ;
27
+
28
+ case 'false ' :
29
+ $ this ->available = 0 ;
30
+ break ;
31
+
32
+ default :
33
+ return 'Illegal availability value ' ;
34
+ }
35
+
22
36
return true ;
23
37
}
24
38
You can’t perform that action at this time.
0 commit comments