Skip to content

Commit f90e05a

Browse files
committed
add explodeResponse
1 parent bb13c43 commit f90e05a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Ubiquity/devtools/cmd/Console.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ public static function question($prompt, array $propositions = null,array $optio
7272
public static function yesNoQuestion($prompt, array $propositions = ['yes','no'],array $options=[]){
7373
return self::question($prompt,$propositions,['ignoreCase'=>true,'hiddenProposals'=>['y','n']]);
7474
}
75+
76+
public static function explodeResponse(string $response, $callback='trim',string $separator=','){
77+
return \array_map($callback,\array_filter( \explode($separator, \trim($response)), 'strlen' ));
78+
}
7579

7680
/**
7781
* Returns true if the answer is yes or y.

0 commit comments

Comments
 (0)