| Total Complexity | 8 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 12 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | abstract class PublishableView implements PublishableContract |
||
| 10 | { |
||
| 11 | protected static string $title; |
||
| 12 | protected static string $desc; |
||
| 13 | protected static string $path; |
||
| 14 | protected static ?string $outputPath; |
||
| 15 | |||
| 16 | public static function publish(bool $force = false): bool |
||
| 17 | { |
||
| 18 | $path = static::getOutputPath(); |
||
| 19 | |||
| 20 | if (file_exists($path) && ! $force) { |
||
| 21 | return false; |
||
| 22 | } |
||
| 23 | |||
| 24 | return copy(static::getSourcePath(), $path); |
||
| 25 | } |
||
| 26 | |||
| 27 | public static function getTitle(): string |
||
| 28 | { |
||
| 29 | return static::$title; |
||
| 30 | } |
||
| 31 | |||
| 32 | public static function getDescription(): string |
||
| 33 | { |
||
| 34 | return static::$desc; |
||
| 35 | } |
||
| 36 | |||
| 37 | public static function getOutputPath(): string |
||
| 43 | } |
||
| 44 | |||
| 45 | protected static function getSourcePath(): string |
||
| 48 | } |
||
| 49 | |||
| 50 | public static function toArray(): array |
||
| 55 | ]; |
||
| 56 | } |
||
| 57 | } |
||
| 58 |