| Conditions | 3 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 43 | 52 | public function create(): string |
|
| 44 | { |
||
| 45 | 52 | $matter = Collection::make($this->matter) |
|
|
|
|||
| 46 | 52 | ->keysToSnakeCase() |
|
| 47 | 43 | ->toArray(); |
|
| 48 | 52 | ||
| 49 | 52 | $front_matter_string = ""; |
|
| 50 | |||
| 51 | 52 | if (count($matter) > 0) { |
|
| 52 | $front_matter_string = "---\n"; |
||
| 53 | 52 | $front_matter_string .= Yaml::dump($matter); |
|
| 54 | 43 | $front_matter_string .= "---\n"; |
|
| 55 | 43 | } |
|
| 56 | 43 | ||
| 57 | $content = ltrim($this->content, "\r\n"); |
||
| 58 | |||
| 59 | 52 | if (strlen($content) > 0) { |
|
| 60 | $front_matter_string .= "\n" . $content; |
||
| 61 | 52 | } |
|
| 62 | |||
| 63 | return $front_matter_string; |
||
| 64 | } |
||
| 66 |