| @@ 350-355 (lines=6) @@ | ||
| 347 | $frontMatter = array(); |
|
| 348 | preg_match('/---(.*?)---(.*)/s', $rawFileContents, $frontMatter); |
|
| 349 | ||
| 350 | if (count($frontMatter) != 3) |
|
| 351 | { |
|
| 352 | throw new IOException(sprintf("'%s' is not a valid ContentItem", |
|
| 353 | $this->fs->getFileName($this->filePath)) |
|
| 354 | ); |
|
| 355 | } |
|
| 356 | ||
| 357 | if (empty(trim($frontMatter[2]))) |
|
| 358 | { |
|
| @@ 357-362 (lines=6) @@ | ||
| 354 | ); |
|
| 355 | } |
|
| 356 | ||
| 357 | if (empty(trim($frontMatter[2]))) |
|
| 358 | { |
|
| 359 | throw new IOException(sprintf('A ContentItem (%s) must have a body to render', |
|
| 360 | $this->fs->getFileName($this->filePath)) |
|
| 361 | ); |
|
| 362 | } |
|
| 363 | ||
| 364 | $this->frontMatter = Yaml::parse($frontMatter[1]); |
|
| 365 | $this->bodyContent = trim($frontMatter[2]); |
|