@@ -16,16 +16,16 @@ class Serial {
16
16
public $ xonxoff ;
17
17
public $ rtscts ;
18
18
19
- private function _testRange ($ v , $ va , $ vb )
19
+ private function testRange ($ v , $ va , $ vb )
20
20
{
21
21
if (($ v >= $ va ) && ($ v <= $ vb )) return TRUE ;
22
22
else return FALSE ;
23
23
}
24
24
25
- private function _testArray ($ v , $ r )
25
+ private function testArray ($ v , $ r )
26
26
{
27
27
foreach ($ r as $ b ) {
28
- if ($ r == $ v )
28
+ if ($ b == $ v )
29
29
return TRUE ;
30
30
}
31
31
return FALSE ;
@@ -41,20 +41,20 @@ public function __construct()
41
41
public function open ($ device , $ baudrate = 9600 , $ databits = 8 , $ parity = "none " , $ stopbits = 1 , $ xonxoff = 0 , $ rtscts = 0 )
42
42
{
43
43
$ bd_ref = array (50 , 75 , 110 , 134 , 150 , 200 , 300 , 600 , 1200 , 1800 , 2400 , 4800 , 9600 , 19200 , 38400 , 57600 , 115200 , 230400 , 460800 , 500000 , 576000 , 921600 , 1000000 , 1152000 , 1500000 , 2000000 );
44
- if (! empty ($ device )) {
44
+ if (empty ($ device )) {
45
45
$ this ->device = NULL ;
46
46
return FALSE ;
47
47
} else {
48
48
$ this ->device = $ device ;
49
49
}
50
- if ($ this ->_testArray ($ baudrate , $ br_ref ) == TRUE )
50
+ if ($ this ->testArray ($ baudrate , $ bd_ref ) == TRUE )
51
51
{
52
52
$ this ->baudrate = $ baudrate ;
53
53
} else {
54
54
$ this ->baudrate = NULL ;
55
55
return FALSE ;
56
56
}
57
- if ($ this ->_testRange ($ databits , 5 , 8 ) == TRUE )
57
+ if ($ this ->testRange ($ databits , 5 , 8 ) == TRUE )
58
58
{
59
59
$ this ->databits = $ databits ;
60
60
} else {
@@ -68,21 +68,21 @@ public function open($device, $baudrate = 9600, $databits = 8, $parity = "none",
68
68
$ this ->parity = NULL ;
69
69
return FALSE ;
70
70
}
71
- if (_testRange ($ stopbits , 1 , 2 ) == TRUE )
71
+ if ($ this -> testRange ($ stopbits , 1 , 2 ) == TRUE )
72
72
{
73
73
$ this ->stopbits = $ stopbits ;
74
74
} else {
75
75
$ this ->stopbits = NULL ;
76
76
return FALSE ;
77
77
}
78
- if ($ this ->_testRange ($ xonxoff , 0 , 1 ) == TRUE )
78
+ if ($ this ->testRange ($ xonxoff , 0 , 1 ) == TRUE )
79
79
{
80
80
$ this ->xonoff = $ xonxoff ;
81
81
} else {
82
82
$ this ->xonoff = NULL ;
83
83
return FALSE ;
84
84
}
85
- if ($ this ->_testRange ($ rtscts , 0 , 1 ) == TRUE )
85
+ if ($ this ->testRange ($ rtscts , 0 , 1 ) == TRUE )
86
86
{
87
87
$ this ->rtscts = $ rtscts ;
88
88
} else {
0 commit comments