1- <?php
1+ <?php
22
33namespace Axn \LaravelCollectiveFormToRawHtml \Console ;
44
77use Symfony \Component \Finder \Finder ;
88
99class RunCommand extends Command
10- {
11- protected $ signature = 'laravelcollective-form-to-raw-html:run
12- {target=resources/views : Target path to scan (directory or single file relative to the project root)}
13- {--escape-with-double-encode} ' ;
10+ {
11+ protected $ signature = 'laravelcollective-form-to-raw-html:run
12+ {target=resources/views : Target path to scan (directory or single file relative to the project root)}
13+ {--escape-with-double-encode : Use regular Blade echo syntax instead of the one without double-encode (see README for more info) } ' ;
1414
1515 protected $ description = 'Replaces LaravelCollective `Form::` syntax by raw HTML ' ;
1616
1717 public function handle (): int
18- {
18+ {
1919 $ target = $ this ->argument ('target ' );
2020
2121 $ path = base_path ($ target );
2222
23- if (is_file ($ path )) {
24- $ finder = Finder::create ()
25- ->files ()
26- ->in (\dirname ($ path ))
27- ->depth (0 )
23+ if (is_file ($ path )) {
24+ $ finder = Finder::create ()
25+ ->files ()
26+ ->in (\dirname ($ path ))
27+ ->depth (0 )
2828 ->name (basename ($ path ));
2929
3030 $ this ->comment ('Replacing `Form::` syntax by raw HTML in file ` ' .$ path .'`... ' );
3131
32- } elseif (is_dir ($ path )) {
33- $ finder = Finder::create ()
34- ->files ()
32+ } elseif (is_dir ($ path )) {
33+ $ finder = Finder::create ()
34+ ->files ()
3535 ->in ($ path );
3636
3737 $ this ->comment ('Replacing `Form::` syntax by raw HTML in all files of directory ` ' .$ path .'`... ' );
3838
39- } else {
39+ } else {
4040 $ this ->error ('Target ` ' .$ path .'` not found. ' );
4141
42- return 0 ;
42+ return 0 ;
4343 }
4444
4545 $ files = iterator_to_array ($ finder , false );
@@ -50,12 +50,12 @@ public function handle(): int
5050
5151 $ this ->info ('Finished with ' .$ nbReplacements .' replacement(s) done. ' );
5252
53- $ this ->line ('Remember to search and review ` ' .Converter::CHECK_COMMENTS_TAG .'` ' );
54- $ this ->line ('Remember to search and review ` ' .Converter::CHECK_OPTIONS_TAG .'` ' );
53+ $ this ->line ('Remember to search and review ` ' .Converter::CHECK_COMMENTS_TAG .'` ' );
54+ $ this ->line ('Remember to search and review ` ' .Converter::CHECK_OPTIONS_TAG .'` ' );
5555 $ this ->line ('Remember to search and replace leaving `Form::` ' );
5656
5757 $ this ->comment ('See README.md for more info. ' );
5858
59- return 0 ;
60- }
59+ return 0 ;
60+ }
6161}
0 commit comments