File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 11
11
use Toolkit \Stdlib \Obj ;
12
12
use Toolkit \Stdlib \Obj \Traits \NameAliasTrait ;
13
13
use Toolkit \Stdlib \Obj \Traits \QuickInitTrait ;
14
+ use Toolkit \Stdlib \Str ;
14
15
use function array_merge ;
15
16
use function array_shift ;
16
17
use function array_values ;
@@ -375,6 +376,32 @@ public function __toString(): string
375
376
*/
376
377
abstract public function buildHelp (bool $ withColor = true ): string ;
377
378
379
+ /**
380
+ * @param string $name
381
+ * @param string $sep
382
+ *
383
+ * @return string[]
384
+ */
385
+ public function getOptStrAsArray (string $ name , string $ sep = ', ' ): array
386
+ {
387
+ $ str = $ this ->getOpt ($ name );
388
+
389
+ return $ str ? Str::toNoEmptyArray ($ str , $ sep ) : [];
390
+ }
391
+
392
+ /**
393
+ * @param string $name
394
+ * @param string $sep
395
+ *
396
+ * @return int[]
397
+ */
398
+ public function getOptStrAsInts (string $ name , string $ sep = ', ' ): array
399
+ {
400
+ $ str = $ this ->getOpt ($ name );
401
+
402
+ return $ str ? Str::toInts ($ str , $ sep ) : [];
403
+ }
404
+
378
405
/****************************************************************
379
406
* getter/setter methods
380
407
***************************************************************/
You can’t perform that action at this time.
0 commit comments