@@ -31,8 +31,12 @@ protected function setup(Options $options)
31
31
32
32
$ options ->registerCommand ('init ' , 'Initialize a new plugin or template in the current directory. ' );
33
33
$ options ->registerCommand ('addTest ' , 'Add the testing framework files and a test. (_test/) ' );
34
- $ options ->registerArgument ('test ' , 'Optional name of the new test. Defaults to the general test. ' , false ,
35
- 'addTest ' );
34
+ $ options ->registerArgument (
35
+ 'test ' ,
36
+ 'Optional name of the new test. Defaults to the general test. ' ,
37
+ false ,
38
+ 'addTest '
39
+ );
36
40
$ options ->registerCommand ('addConf ' , 'Add the configuration files. (conf/) ' );
37
41
$ options ->registerCommand ('addLang ' , 'Add the language files. (lang/) ' );
38
42
@@ -45,10 +49,18 @@ function (&$item) {
45
49
);
46
50
47
51
$ options ->registerCommand ('addComponent ' , 'Add a new plugin component. ' );
48
- $ options ->registerArgument ('type ' , 'Type of the component. Needs to be one of ' . join (', ' , $ types ), true ,
49
- 'addComponent ' );
50
- $ options ->registerArgument ('name ' , 'Optional name of the component. Defaults to a base component. ' , false ,
51
- 'addComponent ' );
52
+ $ options ->registerArgument (
53
+ 'type ' ,
54
+ 'Type of the component. Needs to be one of ' . implode (', ' , $ types ),
55
+ true ,
56
+ 'addComponent '
57
+ );
58
+ $ options ->registerArgument (
59
+ 'name ' ,
60
+ 'Optional name of the component. Defaults to a base component. ' ,
61
+ false ,
62
+ 'addComponent '
63
+ );
52
64
53
65
$ options ->registerCommand ('deletedFiles ' , 'Create the list of deleted files based on the git history. ' );
54
66
$ options ->registerCommand ('rmObsolete ' , 'Delete obsolete files. ' );
@@ -62,21 +74,41 @@ function (&$item) {
62
74
);
63
75
64
76
$ options ->registerCommand ('downloadSvg ' , 'Download an SVG file from a known icon repository. ' );
65
- $ options ->registerArgument ('prefix:name ' ,
66
- 'Colon-prefixed name of the icon. Available prefixes: ' . join (', ' , $ prefixes ), true , 'downloadSvg ' );
67
- $ options ->registerArgument ('output ' , 'File to save, defaults to <name>.svg in current dir ' , false ,
68
- 'downloadSvg ' );
69
- $ options ->registerOption ('keep-ns ' , 'Keep the SVG namespace. Use when the file is not inlined into HTML. ' , 'k ' ,
70
- false , 'downloadSvg ' );
77
+ $ options ->registerArgument (
78
+ 'prefix:name ' ,
79
+ 'Colon-prefixed name of the icon. Available prefixes: ' . implode (', ' , $ prefixes ),
80
+ true ,
81
+ 'downloadSvg '
82
+ );
83
+ $ options ->registerArgument (
84
+ 'output ' ,
85
+ 'File to save, defaults to <name>.svg in current dir ' ,
86
+ false ,
87
+ 'downloadSvg '
88
+ );
89
+ $ options ->registerOption (
90
+ 'keep-ns ' ,
91
+ 'Keep the SVG namespace. Use when the file is not inlined into HTML. ' ,
92
+ 'k ' ,
93
+ false ,
94
+ 'downloadSvg '
95
+ );
71
96
72
97
$ options ->registerCommand ('cleanSvg ' , 'Clean a existing SVG files to reduce their file size. ' );
73
98
$ options ->registerArgument ('files... ' , 'The files to clean (will be overwritten) ' , true , 'cleanSvg ' );
74
- $ options ->registerOption ('keep-ns ' , 'Keep the SVG namespace. Use when the file is not inlined into HTML. ' , 'k ' ,
75
- false , 'cleanSvg ' );
99
+ $ options ->registerOption (
100
+ 'keep-ns ' ,
101
+ 'Keep the SVG namespace. Use when the file is not inlined into HTML. ' ,
102
+ 'k ' ,
103
+ false ,
104
+ 'cleanSvg '
105
+ );
76
106
77
- $ options ->registerCommand ('cleanLang ' ,
107
+ $ options ->registerCommand (
108
+ 'cleanLang ' ,
78
109
'Clean language files from unused language strings. Detecting which strings are truly in use may ' .
79
- 'not always correctly work. Use with caution. ' );
110
+ 'not always correctly work. Use with caution. '
111
+ );
80
112
81
113
$ options ->registerCommand ('test ' , 'Run the unit tests for this extension. ' );
82
114
@@ -243,7 +275,7 @@ protected function deleteFile($file)
243
275
protected function git (...$ args )
244
276
{
245
277
$ args = array_map ('escapeshellarg ' , $ args );
246
- $ cmd = 'git ' . join (' ' , $ args );
278
+ $ cmd = 'git ' . implode (' ' , $ args );
247
279
$ output = [];
248
280
$ result = 0 ;
249
281
@@ -363,14 +395,14 @@ protected function cmdDeletedFiles()
363
395
});
364
396
sort ($ output );
365
397
366
- if (! count ( $ output) ) {
398
+ if ($ output === [] ) {
367
399
$ this ->info ('No deleted files found ' );
368
400
return 0 ;
369
401
}
370
402
371
403
$ content = "# This is a list of files that were present in previous releases \n" .
372
404
"# but were removed later. They should not exist in your installation. \n" .
373
- join ("\n" , $ output ) . "\n" ;
405
+ implode ("\n" , $ output ) . "\n" ;
374
406
375
407
file_put_contents ('deleted.files ' , $ content );
376
408
$ this ->success ('written deleted.files ' );
@@ -464,7 +496,7 @@ protected function cmdTest()
464
496
'--configuration ' , fullpath (__DIR__ . '/../../../_test/phpunit.xml ' ),
465
497
'--group ' , $ type . '_ ' . $ base ,
466
498
];
467
- $ cmd = join (' ' , array_map ('escapeshellarg ' , $ args ));
499
+ $ cmd = implode (' ' , array_map ('escapeshellarg ' , $ args ));
468
500
$ this ->info ("Running $ cmd " );
469
501
470
502
$ result = 0 ;
@@ -492,7 +524,7 @@ protected function cmdCheck($files = [])
492
524
$ args [] = fullpath ($ dir );
493
525
}
494
526
495
- $ cmd = join (' ' , array_map ('escapeshellarg ' , $ args ));
527
+ $ cmd = implode (' ' , array_map ('escapeshellarg ' , $ args ));
496
528
$ this ->info ("Running $ cmd " );
497
529
498
530
$ result = 0 ;
@@ -522,12 +554,12 @@ protected function cmdFix($files = [])
522
554
$ args [] = fullpath ($ dir );
523
555
}
524
556
525
- $ cmd = join (' ' , array_map ('escapeshellarg ' , $ args ));
557
+ $ cmd = implode (' ' , array_map ('escapeshellarg ' , $ args ));
526
558
$ this ->info ("Running $ cmd " );
527
559
528
560
$ result = 0 ;
529
561
passthru ($ cmd , $ result );
530
- if ($ result !== 0 ) return $ result ;
562
+ if ($ result !== 0 ) return $ result ;
531
563
532
564
// now run phpcbf to clean up code style
533
565
$ args = [
@@ -543,7 +575,7 @@ protected function cmdFix($files = [])
543
575
$ args [] = fullpath ($ dir );
544
576
}
545
577
546
- $ cmd = join (' ' , array_map ('escapeshellarg ' , $ args ));
578
+ $ cmd = implode (' ' , array_map ('escapeshellarg ' , $ args ));
547
579
$ this ->info ("Running $ cmd " );
548
580
549
581
$ result = 0 ;
0 commit comments