Example #1
0
 /**
  * Parses a given text block (for internal use)
  *
  * @param  \stdClass  $json the json bit retrieved from the API that represents a text block.
  *
  * @return \Prismic\Fragment\ParsedText  the parsed information for that text block.
  */
 public static function parseText($json)
 {
     $text = $json->text;
     $spans = array();
     foreach ($json->spans as $spanJson) {
         $span = StructuredText::parseSpan($spanJson);
         if (isset($span)) {
             array_push($spans, $span);
         }
     }
     return new ParsedText($text, $spans);
 }