Exemple #1
0
 /**
  * Parses a given SliceZone fragment. Not meant to be used except for testing.
  *
  * @param  \stdClass                $json the json bit retrieved from the API that represents a SliceZone fragment.
  * @return \Prismic\Fragment\SliceZone  the manipulable object for that SliceZone fragment.
  */
 public static function parse($json)
 {
     $slices = array();
     foreach ($json as $slicejson) {
         if (property_exists($slicejson, "slice_type") && property_exists($slicejson, "slice_type")) {
             if (property_exists($slicejson, "slice_label")) {
                 $label = $slicejson->slice_label;
             } else {
                 $label = null;
             }
             array_push($slices, new Slice($slicejson->slice_type, $label, WithFragments::parseFragment($slicejson->value)));
         }
     }
     return new SliceZone($slices);
 }