Captures the current working tree after theme slots, ArticleAccess, and the payment / paid-content plugins so subsequent work has a reviewable git history.
30 lines
607 B
PHP
30 lines
607 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Domain\Blog;
|
|
|
|
final class ContentFormat
|
|
{
|
|
public const HTML = 'html';
|
|
|
|
public const MARKDOWN = 'markdown';
|
|
|
|
public static function all(): array
|
|
{
|
|
return [self::HTML, self::MARKDOWN];
|
|
}
|
|
|
|
public static function isValid(string $format): bool
|
|
{
|
|
return in_array($format, self::all(), true);
|
|
}
|
|
|
|
public static function normalize(?string $format, string $fallback = self::HTML): string
|
|
{
|
|
$format = strtolower(trim((string) $format));
|
|
|
|
return self::isValid($format) ? $format : $fallback;
|
|
}
|
|
}
|