Пример #1
0
 public function exec(&$resp)
 {
     try {
         //$rsp_line = $resp->getLine();
         $type = $this->getPrm(0);
         if (0 === strcmp("*", $type)) {
             $item = new Crsp_item(array($this->getPrm(1)));
             #    echo "  exec:".$this->getPrm(1).PHP_EOL;
             $func = $item->getFunc();
             #    echo get_class($func).PHP_EOL;
             if (null === $func) {
                 throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . ')');
                 return;
             }
             try {
                 $func->exec($resp);
             } catch (NotmatchException $nmth) {
             }
         } else {
             throw new Exception("invalid type" . $type);
         }
     } catch (Exception $e) {
         throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
     }
 }
Пример #2
0
/**
 * @fn     Frsp_parseResp
 * @brief  parse responce
 * @param  resp : responce string (index array)
 * @param  item : item string (index array)
 * @return parsed object
 */
function Frsp_parseResp($resp, $item)
{
    try {
        global $Grsp_result;
        $resp = new Crsp_resp($resp);
        $item = new Crsp_item($item);
        for ($loop = 0; $loop < $resp->getRespCnt(); $loop++) {
            $func = $item->getFunc();
            if (null === $func) {
                break;
            }
            # echo get_class($func)." -> exec()".PHP_EOL;
            $func->exec($resp);
        }
        $Grsp_result["alz_ret"] = true;
        return $Grsp_result;
    } catch (EndRespExcp $end) {
        $Grsp_result["alz_ret"] = true;
        return $Grsp_result;
    } catch (NotMatchException $nmth) {
        $Grsp_result["alz_ret"] = false;
        $Grsp_result["alz_msg"] = $nmth->getMessage();
        return $Grsp_result;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
Пример #3
0
 public function exec(&$resp)
 {
     try {
         //    $rsp_line = $resp->getLine();
         //echo "  chk:".$rsp_line.PHP_EOL;
         $item = new Crsp_item(array($this->getPrm(0)));
         #    echo "  exec:".$this->getPrm(0).PHP_EOL;
         $func = $item->getFunc();
         #    echo get_class($func).PHP_EOL;
         if (null === $func) {
             throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . ')');
             return;
         }
         $func->exec($resp);
         $this->setReturn($func->getMatch());
     } catch (NotmatchException $nmth) {
         throw $nmth;
     } catch (Exception $e) {
         throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
     }
 }
Пример #4
0
 private function mainFunc(&$resp)
 {
     try {
         //echo $line;
         $item = new Crsp_item(array($this->getPrm(2)));
         #  echo "  exec:".$this->getPrm( 2 ).PHP_EOL;
         $func = $item->getFunc();
         #  echo get_class($func).PHP_EOL;
         if (null === $func) {
             $resp->getLine();
             return;
         }
         $func->exec($resp);
     } catch (Exception $e) {
         throw $e;
     }
 }