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