Example #1
0
 /**
  * Parse Document Content
  *
  * @return  void
  */
 public function parse()
 {
     // check to make sure we have content
     if (!$this->get('document')) {
         App::abort(406, '\\Components\\Groups\\Helpers\\Document: Requires document to parse');
     }
     // parse content
     // get all group includes
     if (preg_match_all('#<group:include([^>]*)/>#', $this->get('document'), $matches)) {
         // get number of matches
         $count = count($matches[1]);
         //loop through each match
         for ($i = 0; $i < $count; $i++) {
             $attribs = String::parseAttributes($matches[1][$i]);
             $type = isset($attribs['type']) ? strtolower(trim($attribs['type'])) : null;
             $name = isset($attribs['name']) ? $attribs['name'] : $type;
             unset($attribs['type']);
             $params = $attribs;
             $this->_tags[$matches[0][$i]] = array('type' => $type, 'name' => $name, 'params' => $params);
         }
     }
     // return this
     return $this;
 }