update readme
[linksys-wrt3g-tools.git] / Wrt3g / HtmlParser.php
index 17b46e5455588ac614c8648a2cb26e5a3fd12b93..ac4db350a799090b5698fba62f5e1c350c6c3630 100644 (file)
@@ -36,8 +36,10 @@ class Wrt3g_HtmlParser
      *
      * @param string $body HTML document to parse
      *
-     * @return array Array of key-value pairs, probably with "type", "network" and
-     *               "signal strength"
+     * @return array Array of key-value pairs, probably with
+     *               - "type"
+     *               - "network"
+     *               - "signal strength"
      */
     public function index_wstatus1($body)
     {
@@ -100,6 +102,9 @@ class Wrt3g_HtmlParser
     public function index_wstatus2($body)
     {
         preg_match('/var status2 = "(.+)"/', $body, $arMatches);
+        if (!isset($arMatches[1])) {
+            return array();
+        }
 
         $strStatus = $arMatches[1];
         //Connecting
@@ -126,6 +131,8 @@ class Wrt3g_HtmlParser
      *               - card revision
      *               - card firmware
      *               - IMSI
+     *
+     * @todo FIXME implement "connection" value as index_wstatus2() does it
      */
     public function status_noauth($body)
     {