| @@ 306-311 (lines=6) @@ | ||
| 303 | $frontMatter = array(); |
|
| 304 | preg_match('/---(.*?)---(.*)/s', $rawFileContents, $frontMatter); |
|
| 305 | ||
| 306 | if (count($frontMatter) != 3) |
|
| 307 | { |
|
| 308 | throw new IOException(sprintf("'%s' is not a valid ContentItem", |
|
| 309 | $this->fs->getFileName($this->filePath)) |
|
| 310 | ); |
|
| 311 | } |
|
| 312 | ||
| 313 | if (empty(trim($frontMatter[2]))) |
|
| 314 | { |
|
| @@ 313-318 (lines=6) @@ | ||
| 310 | ); |
|
| 311 | } |
|
| 312 | ||
| 313 | if (empty(trim($frontMatter[2]))) |
|
| 314 | { |
|
| 315 | throw new IOException(sprintf('A ContentItem (%s) must have a body to render', |
|
| 316 | $this->fs->getFileName($this->filePath)) |
|
| 317 | ); |
|
| 318 | } |
|
| 319 | ||
| 320 | $this->frontMatter = Yaml::parse($frontMatter[1]); |
|
| 321 | $this->bodyContent = trim($frontMatter[2]); |
|