File Manager Lite
Dir:
/home/codewavebd/public_html/vendor/laravel/prompts/src/Concerns
Upload
[..]
Colors.php (3.76 KB)
Edit
Rename
Del
Cursor.php (1.53 KB)
Edit
Rename
Del
Erase.php (611 B)
Edit
Rename
Del
Events.php (753 B)
Edit
Rename
Del
Fallback.php (1.4 KB)
Edit
Rename
Del
HasInfo.php (330 B)
Edit
Rename
Del
HasSpinner.php (606 B)
Edit
Rename
Del
Interactivity.php (761 B)
Edit
Rename
Del
Scrolling.php (2.92 KB)
Edit
Rename
Del
Termwind.php (525 B)
Edit
Rename
Del
Themes.php (4.87 KB)
Edit
Rename
Del
Truncation.php (502 B)
Edit
Rename
Del
TypedValue.php (6.93 KB)
Edit
Rename
Del
Edit: Fallback.php
<?php namespace Laravel\Prompts\Concerns; use Closure; use RuntimeException; trait Fallback { /** * Whether to fallback to a custom implementation */ protected static bool $shouldFallback = false; /** * The fallback implementations. * * @var array<class-string, Closure($this): mixed> */ protected static array $fallbacks = []; /** * Enable the fallback implementation. */ public static function fallbackWhen(bool $condition): void { static::$shouldFallback = $condition || static::$shouldFallback; } /** * Whether the prompt should fallback to a custom implementation. */ public static function shouldFallback(): bool { return static::$shouldFallback && isset(static::$fallbacks[static::class]); } /** * Set the fallback implementation. * * @param Closure($this): mixed $fallback */ public static function fallbackUsing(Closure $fallback): void { static::$fallbacks[static::class] = $fallback; } /** * Call the registered fallback implementation. */ public function fallback(): mixed { $fallback = static::$fallbacks[static::class] ?? null; if ($fallback === null) { throw new RuntimeException('No fallback implementation registered for ['.static::class.']'); } return $fallback($this); } }
Simpan