\Inhere\Console\UtilHelper

Class Helper

Summary

Methods
Properties
Constants
isSupportCoroutine()
inCoroutine()
hasMode()
isAbsPath()
mkdir()
directoryIterator()
commandSearch()
findSimilar()
getKeyMaxWidth()
throwInvalidArgument()
formatOptions()
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

isSupportCoroutine()

isSupportCoroutine() : boolean

Returns

boolean

inCoroutine()

inCoroutine() : boolean

Returns

boolean

hasMode()

hasMode(integer  $haystack, integer  $value) : boolean

Parameters

integer $haystack
integer $value

Returns

boolean

isAbsPath()

isAbsPath(string  $path) : boolean

Parameters

string $path

Returns

boolean

mkdir()

mkdir(string  $dir, integer  $mode = 509) 

Parameters

string $dir
integer $mode

Throws

\RuntimeException

directoryIterator()

directoryIterator(string  $srcDir, callable  $filter, integer  $flags = \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO) : \RecursiveIteratorIterator

Parameters

string $srcDir
callable $filter
integer $flags

Throws

\InvalidArgumentException

Returns

\RecursiveIteratorIterator

commandSearch()

commandSearch(string  $command, array  $map) 

Parameters

string $command
array $map

findSimilar()

findSimilar(string  $need, \Iterator|array  $iterator, integer  $similarPercent = 45) : array

find similar text from an array|Iterator

Parameters

string $need
\Iterator|array $iterator
integer $similarPercent

Returns

array

getKeyMaxWidth()

getKeyMaxWidth(array  $data, boolean  $expectInt = false) : integer

get key Max Width

Parameters

array $data

[ 'key1' => 'value1', 'key2-test' => 'value2', ]

boolean $expectInt

Returns

integer

throwInvalidArgument()

throwInvalidArgument(string  $format, mixed  ...$args) 

Parameters

string $format
mixed $args variadic

formatOptions()

formatOptions(string  $optsStr) 

Parameters

string $optsStr