| @@ 230-235 (lines=6) @@ | ||
| 227 | $frontMatter = array(); |
|
| 228 | preg_match('/---(.*?)---(.*)/s', $rawFileContents, $frontMatter); |
|
| 229 | ||
| 230 | if (count($frontMatter) != 3) |
|
| 231 | { |
|
| 232 | throw new IOException(sprintf("'%s' is not a valid ContentItem", |
|
| 233 | $this->fs->getFileName($this->filePath)) |
|
| 234 | ); |
|
| 235 | } |
|
| 236 | ||
| 237 | if (empty(trim($frontMatter[2]))) |
|
| 238 | { |
|
| @@ 237-242 (lines=6) @@ | ||
| 234 | ); |
|
| 235 | } |
|
| 236 | ||
| 237 | if (empty(trim($frontMatter[2]))) |
|
| 238 | { |
|
| 239 | throw new IOException(sprintf('A ContentItem (%s) must have a body to render', |
|
| 240 | $this->fs->getFileName($this->filePath)) |
|
| 241 | ); |
|
| 242 | } |
|
| 243 | ||
| 244 | $this->frontMatter = Yaml::parse($frontMatter[1]); |
|
| 245 | $this->bodyContent = trim($frontMatter[2]); |
|