\IncludesInput

Functions for receiving input from User.

Summary

Methods
Properties
Constants
getFileSize()
getFilename()
getBytesFromString()
getNumber()
getUserConfirm()
isFilenameWrong()
getExistsFilename()
dieOnDenyUserConfirm()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

getFileSize()

getFileSize(string  $message, string  $default = '1MB') : integer|string

Get file size from User.

Parameters

string $message

Message for User what he must type

string $default

Default file size for empty input. Default is '1MB'

Returns

integer|string —

Inserted file size in bytes

getFilename()

getFilename(string  $message, string  $default = 'output') : string

Get valid filename from User.

Parameters

string $message

Message for User what he must type

string $default

Default filename for empty input. Default is 'output'

Returns

string —

Inserted filename

getBytesFromString()

getBytesFromString(string  $input, integer  $notation = 1024) : array

Get bytes number from unit conversation.

Parameters

string $input

User input e.g. '5B', '5MB'

integer $notation

Notation type for kilo

Returns

array

getNumber()

getNumber(string  $message, integer|float  $default) : float

Get number from User.

Parameters

string $message

Message for User what he must type

integer|float $default

Default number for empty input. Default is 0

Returns

float —

Inserted number

getUserConfirm()

getUserConfirm() : boolean

Get User confirmation. Default is YES.

Returns

boolean —

Confirmation result

isFilenameWrong()

isFilenameWrong(string  $input) : boolean

Check for wrong filename based on OS.

Parameters

string $input

User filename input

Returns

boolean —

Is filename wrong?

getExistsFilename()

getExistsFilename(string  $message, string  $default = 'output', string  $fileExtension = '.dat') : string

Get exists filename.

Parameters

string $message

Message for User what he must type

string $default

Default filename for empty input. Default is 'output'

string $fileExtension

File extension. Default is '.dat'

Returns

string

dieOnDenyUserConfirm()

dieOnDenyUserConfirm() 

Terminate script if User denied on confirmation.