| @@ 240-245 (lines=6) @@ | ||
| 237 | $frontMatter = array(); |
|
| 238 | preg_match('/---(.*?)---(.*)/s', $rawFileContents, $frontMatter); |
|
| 239 | ||
| 240 | if (count($frontMatter) != 3) |
|
| 241 | { |
|
| 242 | throw new IOException(sprintf("'%s' is not a valid ContentItem", |
|
| 243 | $this->fs->getFileName($this->filePath)) |
|
| 244 | ); |
|
| 245 | } |
|
| 246 | ||
| 247 | if (empty(trim($frontMatter[2]))) |
|
| 248 | { |
|
| @@ 247-252 (lines=6) @@ | ||
| 244 | ); |
|
| 245 | } |
|
| 246 | ||
| 247 | if (empty(trim($frontMatter[2]))) |
|
| 248 | { |
|
| 249 | throw new IOException(sprintf('A ContentItem (%s) must have a body to render', |
|
| 250 | $this->fs->getFileName($this->filePath)) |
|
| 251 | ); |
|
| 252 | } |
|
| 253 | ||
| 254 | $this->frontMatter = Yaml::parse($frontMatter[1]); |
|
| 255 | $this->bodyContent = trim($frontMatter[2]); |
|