11<?php
22namespace Cbx \Careertoolkit \Factories \Misc ;
3+ use Cbx \Careertoolkit \Factories \Factory ;
34
45/**
56 * Easy plugin checker command command
67 * Class EasyPluginChecker
78 * @since 1.0.1
89 */
9- class EasyPluginChecker{
10+ class EasyPluginChecker extends Factory {
1011
1112 /**
1213 * Register CLI command
@@ -25,12 +26,13 @@ public function wp_cli_register_commands() {
2526 * @since 1.0.0
2627 */
2728 public function run ( $ args , $ assoc_args ) {
29+ \WP_CLI ::success ("Plugin check output written to " );
2830 global $ wpdb ;
2931
3032 $ plugin = $ args [0 ];
31- $ exclude_directories = WP_CLI \Utils \get_flag_value ($ assoc_args , 'exclude-directories ' , '' );
32- $ format = WP_CLI \Utils \get_flag_value ($ assoc_args , 'format ' , 'table ' ); // Default format is table
33- $ output_file = WP_CLI \Utils \get_flag_value ($ assoc_args , 'output-file ' , '' );
33+ $ exclude_directories = \ WP_CLI \Utils \get_flag_value ($ assoc_args , 'exclude-directories ' , '' );
34+ $ format = \ WP_CLI \Utils \get_flag_value ($ assoc_args , 'format ' , 'table ' ); // Default format is table
35+ $ output_file = \ WP_CLI \Utils \get_flag_value ($ assoc_args , 'output-file ' , '' );
3436
3537 // Set default output file if not provided
3638 if (empty ($ output_file )) {
@@ -49,22 +51,22 @@ public function run( $args, $assoc_args ) {
4951 exec ($ command , $ output , $ return_var );
5052
5153 if ($ return_var !== 0 ) {
52- WP_CLI ::error ('Error running the plugin check command. ' );
54+ \ WP_CLI ::error ('Error running the plugin check command. ' );
5355 }
5456
5557 // Combine the output into a single string
5658 $ output_content = implode ("\n" , $ output );
5759
5860 // Clean the file (truncate) before writing new output
5961 if (file_put_contents ($ output_file , '' ) === false ) {
60- WP_CLI ::error ('Failed to clear the output file. ' );
62+ \ WP_CLI ::error ('Failed to clear the output file. ' );
6163 }
6264
6365 // Write the output to the file
6466 if (file_put_contents ($ output_file , $ output_content ) === false ) {
65- WP_CLI ::error ('Failed to write output to the file. ' );
67+ \ WP_CLI ::error ('Failed to write output to the file. ' );
6668 }
6769
68- WP_CLI ::success ("Plugin check output written to {$ output_file }" );
70+ \ WP_CLI ::success ("Plugin check output written to {$ output_file }" );
6971 } //end method run
7072} //end class EasyPluginChecker
0 commit comments