FilechooserHelper
extends Helper
in package
Class FilechooserHelper
Tags
Table of Contents
Properties
- $helperSet : mixed
- $inputStream : mixed
Methods
- ask() : string
- Asks a question to the user.
- doAsk() : bool|mixed|null|string
- Asks the question to the user.
- formatMemory() : mixed
- formatTime() : mixed
- getHelperSet() : HelperSet
- Gets the helper set associated with this helper.
- getInputStream() : resource
- Returns the helper's input stream
- getName() : string
- Returns the canonical name of this helper.
- removeDecoration() : mixed
- setHelperSet() : mixed
- Sets the helper set associated with this helper.
- setInputStream() : mixed
- Sets the input stream to read from when interacting with the user.
- strlen() : int
- Returns the length of a string, using mb_strwidth if it is available.
- strlenWithoutDecoration() : mixed
- substr() : string
- Returns the subset of a string, using mb_substr if it is available.
- autocomplete() : string
- Autocompletes a question.
- displaySuggestion() : mixed
- Display the suggestion $ofs of the list matches
- searchCompletion() : mixed
- Find all valid completion
- validateAttempts() : string
- Validates an attempt.
Properties
$helperSet
protected
mixed
$helperSet
= null
$inputStream
private
mixed
$inputStream
Methods
ask()
Asks a question to the user.
public
ask(InputInterface $input, OutputInterface $output, FileFilter $filter) : string
Parameters
- $input : InputInterface
-
An InputInterface instance
- $output : OutputInterface
-
An OutputInterface instance
- $filter : FileFilter
-
The question to ask
Tags
Return values
string —The user answer
doAsk()
Asks the question to the user.
public
doAsk(OutputInterface $output, FileFilter $filter) : bool|mixed|null|string
This method is public for PHP 5.3 compatibility, it should be private.
Parameters
- $output : OutputInterface
- $filter : FileFilter
Tags
Return values
bool|mixed|null|stringformatMemory()
public
static formatMemory(mixed $memory) : mixed
Parameters
- $memory : mixed
formatTime()
public
static formatTime(mixed $secs) : mixed
Parameters
- $secs : mixed
getHelperSet()
Gets the helper set associated with this helper.
public
getHelperSet() : HelperSet
Return values
HelperSet —A HelperSet instance
getInputStream()
Returns the helper's input stream
public
getInputStream() : resource
Return values
resourcegetName()
Returns the canonical name of this helper.
public
getName() : string
Return values
string —The canonical name
removeDecoration()
public
static removeDecoration(OutputFormatterInterface $formatter, mixed $string) : mixed
Parameters
- $formatter : OutputFormatterInterface
- $string : mixed
setHelperSet()
Sets the helper set associated with this helper.
public
setHelperSet([HelperSet $helperSet = null ]) : mixed
Parameters
- $helperSet : HelperSet = null
setInputStream()
Sets the input stream to read from when interacting with the user.
public
setInputStream(resource $stream) : mixed
This is mainly useful for testing purpose.
Parameters
- $stream : resource
-
The input stream
Tags
strlen()
Returns the length of a string, using mb_strwidth if it is available.
public
static strlen(string $string) : int
Parameters
- $string : string
-
The string to check its length
Return values
int —The length of the string
strlenWithoutDecoration()
public
static strlenWithoutDecoration(OutputFormatterInterface $formatter, mixed $string) : mixed
Parameters
- $formatter : OutputFormatterInterface
- $string : mixed
substr()
Returns the subset of a string, using mb_substr if it is available.
public
static substr(string $string, int $from[, int|null $length = null ]) : string
Parameters
- $string : string
-
String to subset
- $from : int
-
Start offset
- $length : int|null = null
-
Length to read
Return values
string —The string subset
autocomplete()
Autocompletes a question.
private
autocomplete(OutputInterface $output, FileFilter $filter, mixed $inputStream) : string
Parameters
- $output : OutputInterface
- $filter : FileFilter
- $inputStream : mixed
Return values
stringdisplaySuggestion()
Display the suggestion $ofs of the list matches
private
displaySuggestion(OutputInterface $output, array<string|int, mixed> $matches, int $numMatches, int $ofs, int $partialLength) : mixed
Parameters
- $output : OutputInterface
- $matches : array<string|int, mixed>
- $numMatches : int
- $ofs : int
- $partialLength : int
searchCompletion()
Find all valid completion
private
searchCompletion(string $partial, FileFilter $filter, int &$ofs, array<string|int, mixed> &$matches, int &$numMatches) : mixed
Parameters
- $partial : string
- $filter : FileFilter
- $ofs : int
- $matches : array<string|int, mixed>
- $numMatches : int
validateAttempts()
Validates an attempt.
private
validateAttempts(callable $interviewer, OutputInterface $output, FileFilter $filter) : string
Parameters
- $interviewer : callable
-
A callable that will ask for a question and return the result
- $output : OutputInterface
-
An Output instance
- $filter : FileFilter
-
A Question instance
Tags
Return values
string —The validated response