|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/erp.theinteractive.co.in/vendor/laravel/prompts/src/ |
Upload File : |
<?php
namespace Laravel\Prompts;
use Closure;
class TextPrompt extends Prompt
{
use Concerns\TypedValue;
/**
* Create a new TextPrompt instance.
*/
public function __construct(
public string $label,
public string $placeholder = '',
public string $default = '',
public bool|string $required = false,
public ?Closure $validate = null,
public string $hint = ''
) {
$this->trackTypedValue($default);
}
/**
* Get the entered value with a virtual cursor.
*/
public function valueWithCursor(int $maxWidth): string
{
if ($this->value() === '') {
return $this->dim($this->addCursor($this->placeholder, 0, $maxWidth));
}
return $this->addCursor($this->value(), $this->cursorPosition, $maxWidth);
}
}