Documentation

FilechooserHelper extends Helper

Class FilechooserHelper

Tags
author

MacFJA

license

MIT

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

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
throws
RuntimeException

If there is no data to read in the input stream

throws
Exception

In case the max number of attempts has been reached and no valid response has been given

Return values
string

The user answer

formatMemory()

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
resource

getName()

Returns the canonical name of this helper.

public getName() : string
APIYes
Return values
string

The canonical name

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
throws
InvalidArgumentException

In case the stream is not a resource

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

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

displaySuggestion()

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
throws
Exception

In case the max number of attempts has been reached and no valid response has been given

Return values
string

The validated response


        
On this page

Search results