| @@ 294-299 (lines=6) @@ | ||
| 291 | $frontMatter = array(); |
|
| 292 | preg_match('/---(.*?)---(.*)/s', $rawFileContents, $frontMatter); |
|
| 293 | ||
| 294 | if (count($frontMatter) != 3) |
|
| 295 | { |
|
| 296 | throw new IOException(sprintf("'%s' is not a valid ContentItem", |
|
| 297 | $this->fs->getFileName($this->filePath)) |
|
| 298 | ); |
|
| 299 | } |
|
| 300 | ||
| 301 | if (empty(trim($frontMatter[2]))) |
|
| 302 | { |
|
| @@ 301-306 (lines=6) @@ | ||
| 298 | ); |
|
| 299 | } |
|
| 300 | ||
| 301 | if (empty(trim($frontMatter[2]))) |
|
| 302 | { |
|
| 303 | throw new IOException(sprintf('A ContentItem (%s) must have a body to render', |
|
| 304 | $this->fs->getFileName($this->filePath)) |
|
| 305 | ); |
|
| 306 | } |
|
| 307 | ||
| 308 | $this->frontMatter = Yaml::parse($frontMatter[1]); |
|
| 309 | $this->bodyContent = trim($frontMatter[2]); |
|