コード例 #1
0
ファイル: Service.php プロジェクト: paulinthought/service
 /**
  *
  * @param  string  $jsonString
  * @return boolean
  */
 public function parseTradeMessage($jsonString)
 {
     // TODO: Usually we'd use some sort of tradeMessage model here to validate
     // the data structure
     $messageData = Places\Transform::jsonToArray($jsonString);
     // TODO: We should also sanitize the content of the JSON by checking for expected types
     return $this->passMessageToSocketServer($messageData);
 }
コード例 #2
0
 /**
  * 
  * @dataProvider getJsonTestData
  * @test
  */
 public function jsonToArrayTest($testJson, $expectedPass)
 {
     $array = \PlaceFinder\Places\Transform::jsonToArray($testJson);
     if (!$expectedPass) {
         $this->assertEmpty($array);
     } else {
         $this->assertCount(1, $array);
     }
 }