/**
* Parses the body of /index_wstatus1.asp and returns extracted values.
+ * If no connection is established, the values are NULL.
*
* @param string $body HTML document to parse
*
* @return array Array of key-value pairs, probably with
- * - "type"
- * - "network"
- * - "signal strength"
+ * - "type" - i.e. "GPRS"
+ * - "network" - Carrier network name, i.e. "BASE DE"
+ * - "signal strength" - good, excellent, poor
*/
public function index_wstatus1($body)
{
if (isset(self::$arTranslations[$value])) {
$value = self::$arTranslations[$value];
}
+ if ($value == 'aquiring') {
+ $value = null;
+ }
$arRetval[$key] = $value;
next($arMatches);
}
--TEST--
-test Wrt3g_HtmlParser::index_wstatus1() when aquiring
+test Wrt3g_HtmlParser::index_wstatus1() when we have no connection
--FILE--
<?php
chdir(dirname(__FILE__));
--EXPECT--
array(3) {
["type"]=>
- string(8) "aquiring"
+ NULL
["network"]=>
- string(8) "aquiring"
+ NULL
["signal strength"]=>
- string(8) "aquiring"
+ NULL
}