protected function _changeApn(\Application\Proto\Subscription\ChangeApnQuery $query)
 {
     $response = new PB\Response();
     $result = new PB\Result();
     $result->setCode(0);
     $response->setResult($result);
     return $response;
 }
Esempio n. 2
0
 protected function _DiagnosisHistory(\Application\Proto\SupSpotlight\Sim\SimHistoryRequest $req)
 {
     $resp = new \Application\Proto\SupSpotlight\Diagnosis\DiagnosisHistoryListResponse();
     $result = new PB\Result();
     $result->setCode(0);
     $result->setReason('Ok');
     $resp->setResult($result);
     $id = new \Application\Proto\SupProvision\Sim\SimId();
     $id->setImsi('MOCK');
     $resp->setSimId($id);
     // Compute start and end times
     $start = strtotime($req->getDateInterval()->getStartDate()) ?: mktime(0, 0, 0, 1, 1, 2011);
     $end = strtotime($req->getDateInterval()->getEndDate()) ?: time();
     // Extract start date parts to build new times over them
     $year = date('Y', $start);
     $month = date('n', $start);
     $day = date('d', $start);
     $hour = rand(0, 23);
     $statuses = array(\Application\Proto\SupSpotlight\Diagnosis\DiagnosisDetail\DiagResponseType::GSM_UP, \Application\Proto\SupSpotlight\Diagnosis\DiagnosisDetail\DiagResponseType::GSM_DOWN, \Application\Proto\SupSpotlight\Diagnosis\DiagnosisDetail\DiagResponseType::IP_UP, \Application\Proto\SupSpotlight\Diagnosis\DiagnosisDetail\DiagResponseType::IP_DOWN);
     $limit = rand(10, 30);
     for ($i = 0; $i < $limit; $i++) {
         // Build a new timestamp using random values
         $time = mktime($hour, rand(0, 59), rand(0, 59), $month, $day, $year);
         if ($time > $end) {
             continue;
         }
         $hour += rand(1, 36);
         $row = new Application\Proto\SupSpotlight\Diagnosis\DiagnosisDetail();
         $row->setDescription($statuses[array_rand($statuses)]);
         $row->setEndDate(gmdate('Y-m-d\\TH:i:s\\Z', $time));
         $resp->addDiagnosisDetail($row);
     }
     return $resp;
 }