@@ -184,12 +184,12 @@ private function _scaffold( $slug, $assoc_args, $defaults, $subdir, $templates )
184184 }
185185
186186 if ( $ path = $ this ->get_output_path ( $ control_args , $ subdir ) ) {
187- $ filename = $ path . $ slug . ' . php' ;
187+ $ filename = "{ $ path}{ $ slug} . php" ;
188188
189189 $ force = \WP_CLI \Utils \get_flag_value ( $ assoc_args , 'force ' );
190190 $ files_written = $ this ->create_files ( array ( $ filename => $ final_output ), $ force );
191- $ skip_message = "Skipped creating ' $ filename'. " ;
192- $ success_message = "Created ' $ filename'. " ;
191+ $ skip_message = "Skipped creating ' { $ filename} '. " ;
192+ $ success_message = "Created ' { $ filename} '. " ;
193193 $ this ->log_whether_files_written ( $ files_written , $ skip_message , $ success_message );
194194
195195 } else {
@@ -298,10 +298,10 @@ public function block( $args, $assoc_args ) {
298298 }
299299
300300 $ files_written = $ this ->create_files ( array (
301- "$ block_dir/ $ slug.php " => self ::mustache_render ( 'block-php.mustache ' , $ data ),
302- "$ block_dir/ $ slug/index.js " => self ::mustache_render ( 'block-index-js.mustache ' , $ data ),
303- "$ block_dir/ $ slug/editor.css " => self ::mustache_render ( 'block-editor-css.mustache ' , $ data ),
304- "$ block_dir/ $ slug/style.css " => self ::mustache_render ( 'block-style-css.mustache ' , $ data ),
301+ "{ $ block_dir} / { $ slug} .php " => self ::mustache_render ( 'block-php.mustache ' , $ data ),
302+ "{ $ block_dir} / { $ slug} /index.js " => self ::mustache_render ( 'block-index-js.mustache ' , $ data ),
303+ "{ $ block_dir} / { $ slug} /editor.css " => self ::mustache_render ( 'block-editor-css.mustache ' , $ data ),
304+ "{ $ block_dir} / { $ slug} /style.css " => self ::mustache_render ( 'block-style-css.mustache ' , $ data ),
305305 ), $ control_args ['force ' ] );
306306 $ skip_message = 'All block files were skipped. ' ;
307307 $ success_message = "Created block ' {$ data ['title_ucfirst ' ]}'. " ;
@@ -378,7 +378,7 @@ public function _s( $args, $assoc_args ) {
378378 die;
379379 }
380380
381- $ theme_description = ' Custom theme: ' . $ data ['theme_name ' ] . ' , developed by ' . $ data ['author ' ];
381+ $ theme_description = " Custom theme: { $ data ['theme_name ' ]} , developed by { $ data ['author ' ]}" ;
382382
383383 $ body = array ();
384384 $ body ['underscoresme_name ' ] = $ data ['theme_name ' ];
@@ -423,7 +423,7 @@ public function _s( $args, $assoc_args ) {
423423
424424 $ response_code = wp_remote_retrieve_response_code ( $ response );
425425 if ( 200 != $ response_code ) {
426- WP_CLI ::error ( "Couldn't create theme (received $ response_code response). " );
426+ WP_CLI ::error ( "Couldn't create theme (received { $ response_code} response). " );
427427 }
428428
429429 $ this ->maybe_create_themes_dir ();
@@ -435,7 +435,7 @@ public function _s( $args, $assoc_args ) {
435435
436436 if ( true === $ unzip_result ) {
437437 $ this ->create_files ( array (
438- "$ theme_path/ {$ theme_slug }/.editorconfig " => file_get_contents ( self ::get_template_path ( '.editorconfig ' ) ),
438+ "{ $ theme_path} / {$ theme_slug }/.editorconfig " => file_get_contents ( self ::get_template_path ( '.editorconfig ' ) ),
439439 ), false );
440440 WP_CLI ::success ( "Created theme ' {$ data ['theme_name ' ]}'. " );
441441 } else {
@@ -498,35 +498,36 @@ function child_theme( $args, $assoc_args ) {
498498 WP_CLI ::error ( "Invalid theme slug specified. The slug cannot be '.' or '..'. " );
499499 }
500500
501- $ data = wp_parse_args ( $ assoc_args , array (
501+ $ data = wp_parse_args ( $ assoc_args , array (
502502 'theme_name ' => ucfirst ( $ theme_slug ),
503503 'author ' => 'Me ' ,
504504 'author_uri ' => '' ,
505505 'theme_uri ' => '' ,
506506 ) );
507+
507508 $ data ['slug ' ] = $ theme_slug ;
508509 $ data ['parent_theme_function_safe ' ] = str_replace ( array ( ' ' , '- ' ), '_ ' , $ data ['parent_theme ' ] );
509510 $ data ['description ' ] = ucfirst ( $ data ['parent_theme ' ] ) . ' child theme. ' ;
510511
511- $ theme_dir = WP_CONTENT_DIR . ' /themes ' . " / $ theme_slug " ;
512+ $ theme_dir = WP_CONTENT_DIR . " /themes/ { $ theme_slug} " ;
512513
513514 if ( $ error_msg = $ this ->check_target_directory ( 'theme ' , $ theme_dir ) ) {
514515 WP_CLI ::error ( "Invalid theme slug specified. {$ error_msg }" );
515516 }
516517
517- $ theme_style_path = "$ theme_dir/style.css " ;
518- $ theme_functions_path = "$ theme_dir/functions.php " ;
518+ $ theme_style_path = "{ $ theme_dir} /style.css " ;
519+ $ theme_functions_path = "{ $ theme_dir} /functions.php " ;
519520
520521 $ this ->maybe_create_themes_dir ();
521522
522523 $ force = \WP_CLI \Utils \get_flag_value ( $ assoc_args , 'force ' );
523524 $ files_written = $ this ->create_files ( array (
524- $ theme_style_path => self ::mustache_render ( 'child_theme.mustache ' , $ data ),
525- $ theme_functions_path => self ::mustache_render ( 'child_theme_functions.mustache ' , $ data ),
526- "$ theme_dir/.editorconfig " => file_get_contents ( self ::get_template_path ( '.editorconfig ' ) ),
525+ $ theme_style_path => self ::mustache_render ( 'child_theme.mustache ' , $ data ),
526+ $ theme_functions_path => self ::mustache_render ( 'child_theme_functions.mustache ' , $ data ),
527+ "{ $ theme_dir} /.editorconfig " => file_get_contents ( self ::get_template_path ( '.editorconfig ' ) ),
527528 ), $ force );
528529 $ skip_message = 'All theme files were skipped. ' ;
529- $ success_message = "Created ' $ theme_dir'. " ;
530+ $ success_message = "Created ' { $ theme_dir} '. " ;
530531 $ this ->log_whether_files_written ( $ files_written , $ skip_message , $ success_message );
531532
532533 if ( \WP_CLI \Utils \get_flag_value ( $ assoc_args , 'activate ' ) ) {
@@ -540,18 +541,18 @@ private function get_output_path( $assoc_args, $subdir ) {
540541 if ( $ assoc_args ['theme ' ] ) {
541542 $ theme = $ assoc_args ['theme ' ];
542543 if ( is_string ( $ theme ) ) {
543- $ path = get_theme_root ( $ theme ) . ' / ' . $ theme ;
544+ $ path = get_theme_root ( $ theme ) . " / { $ theme}" ;
544545 } else {
545546 $ path = get_stylesheet_directory ();
546547 }
547548 if ( ! is_dir ( $ path ) ) {
548- WP_CLI ::error ( "Can't find ' $ theme' theme. " );
549+ WP_CLI ::error ( "Can't find ' { $ theme} ' theme. " );
549550 }
550551 } elseif ( $ assoc_args ['plugin ' ] ) {
551552 $ plugin = $ assoc_args ['plugin ' ];
552- $ path = WP_PLUGIN_DIR . ' / ' . $ plugin ;
553+ $ path = WP_PLUGIN_DIR . " / { $ plugin}" ;
553554 if ( ! is_dir ( $ path ) ) {
554- WP_CLI ::error ( "Can't find ' $ plugin' plugin. " );
555+ WP_CLI ::error ( "Can't find ' { $ plugin} ' plugin. " );
555556 }
556557 } else {
557558 return false ;
@@ -661,28 +662,28 @@ function plugin( $args, $assoc_args ) {
661662 if ( ! is_dir ( $ assoc_args ['dir ' ] ) ) {
662663 WP_CLI ::error ( "Cannot create plugin in directory that doesn't exist. " );
663664 }
664- $ plugin_dir = $ assoc_args ['dir ' ] . " / $ plugin_slug " ;
665+ $ plugin_dir = "{ $ assoc_args ['dir ' ]} / { $ plugin_slug} " ;
665666 } else {
666- $ plugin_dir = WP_PLUGIN_DIR . "/ $ plugin_slug " ;
667+ $ plugin_dir = WP_PLUGIN_DIR . "/ { $ plugin_slug} " ;
667668 $ this ->maybe_create_plugins_dir ();
668669
669670 if ( $ error_msg = $ this ->check_target_directory ( 'plugin ' , $ plugin_dir ) ) {
670671 WP_CLI ::error ( "Invalid plugin slug specified. {$ error_msg }" );
671672 }
672673 }
673674
674- $ plugin_path = "$ plugin_dir/ $ plugin_slug.php " ;
675- $ plugin_readme_path = "$ plugin_dir/readme.txt " ;
675+ $ plugin_path = "{ $ plugin_dir} / { $ plugin_slug} .php " ;
676+ $ plugin_readme_path = "{ $ plugin_dir} /readme.txt " ;
676677
677678 $ force = \WP_CLI \Utils \get_flag_value ( $ assoc_args , 'force ' );
678679 $ files_written = $ this ->create_files ( array (
679- $ plugin_path => self ::mustache_render ( 'plugin.mustache ' , $ data ),
680- $ plugin_readme_path => self ::mustache_render ( 'plugin-readme.mustache ' , $ data ),
681- "$ plugin_dir/package.json " => self ::mustache_render ( 'plugin-packages.mustache ' , $ data ),
682- "$ plugin_dir/Gruntfile.js " => self ::mustache_render ( 'plugin-gruntfile.mustache ' , $ data ),
683- "$ plugin_dir/.gitignore " => self ::mustache_render ( 'plugin-gitignore.mustache ' , $ data ),
684- "$ plugin_dir/.distignore " => self ::mustache_render ( 'plugin-distignore.mustache ' , $ data ),
685- "$ plugin_dir/.editorconfig " => file_get_contents ( self ::get_template_path ( '.editorconfig ' ) ),
680+ $ plugin_path => self ::mustache_render ( 'plugin.mustache ' , $ data ),
681+ $ plugin_readme_path => self ::mustache_render ( 'plugin-readme.mustache ' , $ data ),
682+ "{ $ plugin_dir} /package.json " => self ::mustache_render ( 'plugin-packages.mustache ' , $ data ),
683+ "{ $ plugin_dir} /Gruntfile.js " => self ::mustache_render ( 'plugin-gruntfile.mustache ' , $ data ),
684+ "{ $ plugin_dir} /.gitignore " => self ::mustache_render ( 'plugin-gitignore.mustache ' , $ data ),
685+ "{ $ plugin_dir} /.distignore " => self ::mustache_render ( 'plugin-distignore.mustache ' , $ data ),
686+ "{ $ plugin_dir} /.editorconfig " => file_get_contents ( self ::get_template_path ( '.editorconfig ' ) ),
686687 ), $ force );
687688
688689 $ skip_message = 'All plugin files were skipped. ' ;
@@ -827,7 +828,7 @@ private function scaffold_plugin_theme_tests( $args, $assoc_args, $type ) {
827828 WP_CLI ::error ( "Invalid {$ type } slug specified. The theme ' {$ slug }' does not exist. " );
828829 }
829830 } else {
830- $ target_dir = WP_PLUGIN_DIR . "/ $ slug " ;
831+ $ target_dir = WP_PLUGIN_DIR . "/ { $ slug} " ;
831832 }
832833 if ( empty ( $ assoc_args ['dir ' ] ) && ! is_dir ( $ target_dir ) ) {
833834 WP_CLI ::error ( "Invalid {$ type } slug specified. No such target directory ' {$ target_dir }'. " );
@@ -862,8 +863,8 @@ private function scaffold_plugin_theme_tests( $args, $assoc_args, $type ) {
862863
863864 $ wp_versions_to_test = array ();
864865 // Parse plugin readme.txt
865- if ( file_exists ( $ target_dir . ' /readme.txt ' ) ) {
866- $ readme_content = file_get_contents ( $ target_dir . ' /readme.txt ' );
866+ if ( file_exists ( "{ $ target_dir} /readme.txt " ) ) {
867+ $ readme_content = file_get_contents ( "{ $ target_dir} /readme.txt " );
867868
868869 preg_match ( '/Requires at least\:(.*)\n/m ' , $ readme_content , $ matches );
869870 if ( isset ( $ matches [1 ] ) && $ matches [1 ] ) {
@@ -880,8 +881,8 @@ private function scaffold_plugin_theme_tests( $args, $assoc_args, $type ) {
880881
881882 $ force = \WP_CLI \Utils \get_flag_value ( $ assoc_args , 'force ' );
882883 $ files_to_create = array (
883- "$ tests_dir/bootstrap.php " => self ::mustache_render ( "{$ type }-bootstrap.mustache " , $ template_data ),
884- "$ tests_dir/test-sample.php " => self ::mustache_render ( "{$ type }-test-sample.mustache " , $ template_data ),
884+ "{ $ tests_dir} /bootstrap.php " => self ::mustache_render ( "{$ type }-bootstrap.mustache " , $ template_data ),
885+ "{ $ tests_dir} /test-sample.php " => self ::mustache_render ( "{$ type }-test-sample.mustache " , $ template_data ),
885886 );
886887 if ( 'travis ' === $ assoc_args ['ci ' ] ) {
887888 $ files_to_create [ "{$ target_dir }/.travis.yml " ] = self ::mustache_render ( 'plugin-travis.mustache ' , compact ( 'wp_versions_to_test ' ) );
@@ -902,7 +903,7 @@ private function scaffold_plugin_theme_tests( $args, $assoc_args, $type ) {
902903 );
903904
904905 foreach ( $ to_copy as $ file => $ dir ) {
905- $ file_name = "$ dir/ $ file " ;
906+ $ file_name = "{ $ dir} / { $ file} " ;
906907 $ force = \WP_CLI \Utils \get_flag_value ( $ assoc_args , 'force ' );
907908 $ should_write_file = $ this ->prompt_if_files_will_be_overwritten ( $ file_name , $ force );
908909 if ( ! $ should_write_file ) {
@@ -912,7 +913,7 @@ private function scaffold_plugin_theme_tests( $args, $assoc_args, $type ) {
912913
913914 $ wp_filesystem ->copy ( self ::get_template_path ( $ file ), $ file_name , true );
914915 if ( 'install-wp-tests.sh ' === $ file ) {
915- if ( ! $ wp_filesystem ->chmod ( "$ dir/ $ file " , 0755 ) ) {
916+ if ( ! $ wp_filesystem ->chmod ( "{ $ dir} / { $ file} " , 0755 ) ) {
916917 WP_CLI ::warning ( "Couldn't mark 'install-wp-tests.sh' as executable. " );
917918 }
918919 }
@@ -959,7 +960,7 @@ protected function create_files( $files_and_contents, $force ) {
959960 $ wp_filesystem ->mkdir ( dirname ( $ filename ) );
960961
961962 if ( ! $ wp_filesystem ->put_contents ( $ filename , $ contents ) ) {
962- WP_CLI ::error ( "Error creating file: $ filename " );
963+ WP_CLI ::error ( "Error creating file: { $ filename} " );
963964 } elseif ( $ should_write_file ) {
964965 $ wrote_files [] = $ filename ;
965966 }
@@ -1106,7 +1107,7 @@ protected function init_wp_filesystem() {
11061107 * Localizes the template path.
11071108 */
11081109 private static function mustache_render ( $ template , $ data = array () ) {
1109- return Utils \mustache_render ( dirname ( dirname ( __FILE__ ) ) . ' /templates/ ' . $ template , $ data );
1110+ return Utils \mustache_render ( dirname ( dirname ( __FILE__ ) ) . " /templates/ { $ template}" , $ data );
11101111 }
11111112
11121113 /**
0 commit comments