/**
  * This will read the $name file and parse it to the PageTemplate
  *
  * @param string $name
  * @return PageTemplateInterface
  * @throws \Exception
  */
 public function parse($name)
 {
     $rawData = $this->getRawData($name);
     $result = new PageTemplate();
     $result->setName($rawData['name']);
     $rows = [];
     foreach ($rawData['rows'] as $rawRow) {
         $regions = [];
         foreach ($rawRow['regions'] as $rawRegion) {
             $region = $this->buildRegion($rawRegion);
             $regions[] = $region;
         }
         $rows[] = new Row($regions);
     }
     $result->setRows($rows);
     $result->setTemplate($rawData["template"]);
     return $result;
 }
 /**
  * This will read the $name file and parse it to the PageTemplate
  *
  * @param string $name
  * @return PageTemplate
  * @throws \Exception
  */
 public function parse($name)
 {
     if (false === ($pos = strpos($name, ':'))) {
         throw new \Exception(sprintf('Malformed namespaced configuration name "%s" (expecting "namespace:pagename.yml").', $name));
     }
     $namespace = substr($name, 0, $pos);
     $name = substr($name, $pos + 1);
     $result = new PageTemplate();
     $path = $this->kernel->locateResource('@' . $namespace . '/Resources/config/pagetemplates/' . $name . '.yml');
     $rawData = Yaml::parse($path);
     $result->setName($rawData['name']);
     $rows = array();
     foreach ($rawData['rows'] as $rawRow) {
         $regions = array();
         foreach ($rawRow['regions'] as $rawRegion) {
             $region = $this->buildRegion($rawRegion);
             $regions[] = $region;
         }
         $rows[] = new Row($regions);
     }
     $result->setRows($rows);
     $result->setTemplate($rawData["template"]);
     return $result;
 }