PHP Class YaLinqo\Utils

显示文件 Open project: athari/yalinqo Class Usage Examples

Public Methods

Method Description
createComparer ( callable | integer | null $closure, integer $sortOrder, boolean &$isReversed ) : callable | string | null Convert string lambda or SORT_ flags to callable function. Sets isReversed to false if descending is reversed.
createLambda ( callable | null $closure, string $closureArgs, Closure | callable | null $default = null ) : callable | null Convert string lambda to callable function. If callable is passed, return as is.
init ( )
lambdaToSortFlagsAndOrder ( callable | string | integer | null $closure, integer | boolean &$sortOrder ) : callable | string | integer | null Convert string lambda to SORT_ flags. Convert sortOrder from bool to SORT_ order.

Private Methods

Method Description
createLambdaFromString ( string $closure, string $closureArgs ) : string | null Convert string lambda to callable function.

Method Details

createComparer() public static method

Convert string lambda or SORT_ flags to callable function. Sets isReversed to false if descending is reversed.
public static createComparer ( callable | integer | null $closure, integer $sortOrder, boolean &$isReversed ) : callable | string | null
$closure callable | integer | null
$sortOrder integer
$isReversed boolean
return callable | string | null

createLambda() public static method

Convert string lambda to callable function. If callable is passed, return as is.
public static createLambda ( callable | null $closure, string $closureArgs, Closure | callable | null $default = null ) : callable | null
$closure callable | null
$closureArgs string
$default Closure | callable | null
return callable | null

init() public static method

public static init ( )

lambdaToSortFlagsAndOrder() public static method

Convert string lambda to SORT_ flags. Convert sortOrder from bool to SORT_ order.
public static lambdaToSortFlagsAndOrder ( callable | string | integer | null $closure, integer | boolean &$sortOrder ) : callable | string | integer | null
$closure callable | string | integer | null
$sortOrder integer | boolean
return callable | string | integer | null