예제 #1
0
 /**
  * Ensures that data (JSON String, Objects) are turned into arrays for processing
  *
  * @param $dataToFilter
  *
  * @return array
  */
 protected static function dataToArray(&$dataToFilter)
 {
     if (!is_array($dataToFilter) && $dataToFilter !== null) {
         if (is_object($dataToFilter)) {
             $dataToFilter = (array) $dataToFilter;
         } else {
             if (Core::isJson($dataToFilter)) {
                 $dataToFilter = json_decode($dataToFilter, true);
             } else {
                 trigger_error("Tried to filter Malformed data");
             }
         }
     }
     return $dataToFilter;
 }
예제 #2
0
 /**
  * @dataProvider inputJson
  */
 public function testCheckIsJson($jsonString, $expected)
 {
     $this->assertEquals($expected, Core::isJson($jsonString));
 }