| @@ 261-266 (lines=6) @@ | ||
| 258 | $frontMatter = array(); |
|
| 259 | preg_match('/---(.*?)---(.*)/s', $rawFileContents, $frontMatter); |
|
| 260 | ||
| 261 | if (count($frontMatter) != 3) |
|
| 262 | { |
|
| 263 | throw new IOException(sprintf("'%s' is not a valid ContentItem", |
|
| 264 | $this->fs->getFileName($this->filePath)) |
|
| 265 | ); |
|
| 266 | } |
|
| 267 | ||
| 268 | if (empty(trim($frontMatter[2]))) |
|
| 269 | { |
|
| @@ 268-273 (lines=6) @@ | ||
| 265 | ); |
|
| 266 | } |
|
| 267 | ||
| 268 | if (empty(trim($frontMatter[2]))) |
|
| 269 | { |
|
| 270 | throw new IOException(sprintf('A ContentItem (%s) must have a body to render', |
|
| 271 | $this->fs->getFileName($this->filePath)) |
|
| 272 | ); |
|
| 273 | } |
|
| 274 | ||
| 275 | $this->frontMatter = Yaml::parse($frontMatter[1]); |
|
| 276 | $this->bodyContent = trim($frontMatter[2]); |
|