| @@ 317-322 (lines=6) @@ | ||
| 314 | $frontMatter = array(); |
|
| 315 | preg_match('/---(.*?)---(.*)/s', $rawFileContents, $frontMatter); |
|
| 316 | ||
| 317 | if (count($frontMatter) != 3) |
|
| 318 | { |
|
| 319 | throw new IOException(sprintf("'%s' is not a valid ContentItem", |
|
| 320 | $this->fs->getFileName($this->filePath)) |
|
| 321 | ); |
|
| 322 | } |
|
| 323 | ||
| 324 | if (empty(trim($frontMatter[2]))) |
|
| 325 | { |
|
| @@ 324-329 (lines=6) @@ | ||
| 321 | ); |
|
| 322 | } |
|
| 323 | ||
| 324 | if (empty(trim($frontMatter[2]))) |
|
| 325 | { |
|
| 326 | throw new IOException(sprintf('A ContentItem (%s) must have a body to render', |
|
| 327 | $this->fs->getFileName($this->filePath)) |
|
| 328 | ); |
|
| 329 | } |
|
| 330 | ||
| 331 | $this->frontMatter = Yaml::parse($frontMatter[1]); |
|
| 332 | $this->bodyContent = trim($frontMatter[2]); |
|