1010 * Class DummyJobGenerate
1111 * @since 1.0.0
1212 */
13- class DummyJobGenerate extends Factory
14- {
13+ class DummyJobGenerate extends Factory {
1514
1615 /**
1716 * Register CLI command
1817 * @since 1.0.0
1918 */
20- public function wp_cli_register_commands ()
21- {
22- \WP_CLI ::add_command ('cbxjob-generate ' , [$ this , "run " ]);
19+ public function wp_cli_register_commands () {
20+ \WP_CLI ::add_command ( 'cbxjob-generate ' , [ $ this , "run " ] );
2321 } //end method wp_cli_register_commands
2422
2523 /**
@@ -30,68 +28,66 @@ public function wp_cli_register_commands()
3028 *
3129 * @since 1.0.0
3230 */
33- public function run ($ args , $ assoc_args )
34- {
35- $ start = microtime (true );
31+ public function run ( $ args , $ assoc_args ) {
32+ $ start = microtime ( true );
3633
37- $ total = isset ($ assoc_args ['total ' ]) && intval ($ assoc_args ['total ' ]) ? intval ($ assoc_args ['total ' ]) : 100 ;
38- $ status = isset ($ assoc_args ['status ' ]) ? sanitize_text_field ($ assoc_args ['status ' ]) : 'publish ' ;
39- $ is_remote = isset ($ assoc_args ['is-remote ' ]) && intval ($ assoc_args ['is-remote ' ]) ? intval ($ assoc_args ['is-remote ' ]) : 0 ;
40- $ is_featured = isset ($ assoc_args ['is-featured ' ]) && intval ($ assoc_args ['is-featured ' ]) ? intval ($ assoc_args ['is-featured ' ]) : 1 ;
41- $ is_filled = isset ($ assoc_args ['is-filled ' ]) && intval ($ assoc_args ['is-filled ' ]) ? intval ($ assoc_args ['is-filled ' ]) : 0 ;
34+ $ total = isset ( $ assoc_args ['total ' ] ) && intval ( $ assoc_args ['total ' ] ) ? intval ( $ assoc_args ['total ' ] ) : 100 ;
35+ $ status = isset ( $ assoc_args ['status ' ] ) ? sanitize_text_field ( $ assoc_args ['status ' ] ) : 'publish ' ;
36+ $ is_remote = isset ( $ assoc_args ['is-remote ' ] ) && intval ( $ assoc_args ['is-remote ' ] ) ? intval ( $ assoc_args ['is-remote ' ] ) : 0 ;
37+ $ is_featured = isset ( $ assoc_args ['is-featured ' ] ) && intval ( $ assoc_args ['is-featured ' ] ) ? intval ( $ assoc_args ['is-featured ' ] ) : 1 ;
38+ $ is_filled = isset ( $ assoc_args ['is-filled ' ] ) && intval ( $ assoc_args ['is-filled ' ] ) ? intval ( $ assoc_args ['is-filled ' ] ) : 0 ;
4239
43- $ salary_currency = isset ($ assoc_args ['currency ' ]) ? sanitize_text_field ($ assoc_args ['currency ' ]) : 'USD ' ;
44- $ salary_unit = isset ($ assoc_args ['salary-unit ' ]) ? sanitize_text_field ($ assoc_args ['salary-unit ' ]) : 'monthly ' ;
40+ $ salary_currency = isset ( $ assoc_args ['currency ' ] ) ? sanitize_text_field ( $ assoc_args ['currency ' ] ) : 'USD ' ;
41+ $ salary_unit = isset ( $ assoc_args ['salary-unit ' ] ) ? sanitize_text_field ( $ assoc_args ['salary-unit ' ] ) : 'monthly ' ;
4542
46- $ user_id = isset ($ assoc_args ['user-id ' ]) && intval ($ assoc_args ['user-id ' ]) ? intval ($ assoc_args ['user-id ' ]) : 1 ;
43+ $ user_id = isset ( $ assoc_args ['user-id ' ] ) && intval ( $ assoc_args ['user-id ' ] ) ? intval ( $ assoc_args ['user-id ' ] ) : 1 ;
4744
48- for ($ i = 0 ; $ i < $ total ; $ i++ ) {
45+ for ( $ i = 0 ; $ i < $ total ; $ i ++ ) {
4946
50- $ user_data = get_userdata ($ user_id );
47+ $ user_data = get_userdata ( $ user_id );
5148
52- $ cbxjob ['add_by ' ] = $ user_id ; //user id = X
53- $ cbxjob ['add_date ' ] = date ('Y-m-d H:i:s ' );
49+ $ cbxjob ['add_by ' ] = $ user_id ; //user id = X
50+ $ cbxjob ['add_date ' ] = date ( 'Y-m-d H:i:s ' );
5451 //$cbxjob['email'] = FakerFactory::create()->email();
55- $ cbxjob ['email ' ] = $ user_data ->user_email ;
56- $ cbxjob ['title ' ] = FakerFactory::create ()->jobTitle ();
57- $ cbxjob ['status ' ] = $ status ;
58- $ cbxjob ['job_location ' ] = FakerFactory::create ()->address ();
59- $ cbxjob ['is_featured ' ] = $ is_featured ;
60- $ cbxjob ['is_filled ' ] = $ is_filled ;
61- $ cbxjob ['salary_amount ' ] = FakerFactory::create ()->randomNumber (3 );
62- $ cbxjob ['is_remote ' ] = $ is_remote ;
52+ $ cbxjob ['email ' ] = $ user_data ->user_email ;
53+ $ cbxjob ['title ' ] = FakerFactory::create ()->jobTitle ();
54+ $ cbxjob ['status ' ] = $ status ;
55+ $ cbxjob ['job_location ' ] = FakerFactory::create ()->address ();
56+ $ cbxjob ['is_featured ' ] = $ is_featured ;
57+ $ cbxjob ['is_filled ' ] = $ is_filled ;
58+ $ cbxjob ['salary_amount ' ] = FakerFactory::create ()->randomNumber ( 3 );
59+ $ cbxjob ['is_remote ' ] = $ is_remote ;
6360 $ cbxjob ['application_url ' ] = FakerFactory::create ()->url ();
64- $ cbxjob ['description ' ] = FakerFactory::create ()->text ();
65- $ cbxjob ['open_positions ' ] = FakerFactory::create ()->randomNumber (1 );
61+ $ cbxjob ['description ' ] = FakerFactory::create ()->text ();
62+ $ cbxjob ['open_positions ' ] = FakerFactory::create ()->randomNumber ( 1 );
6663
6764 $ cbxjob ['misc ' ] = [
68- 'salary_currency ' => $ salary_currency ,
69- 'job_location ' => FakerFactory::create ()->address (),
70- 'company_name ' => FakerFactory::create ()->company (),
71- 'salary_unit ' => $ salary_unit ,
72- 'company_website ' => FakerFactory::create ()->url (),
73- 'company_logo ' => '' ,
65+ 'salary_currency ' => $ salary_currency ,
66+ 'job_location ' => FakerFactory::create ()->address (),
67+ 'company_name ' => FakerFactory::create ()->company (),
68+ 'salary_unit ' => $ salary_unit ,
69+ 'company_website ' => FakerFactory::create ()->url (),
70+ 'company_logo ' => '' ,
7471 'company_logo_source ' => 'job ' ,
75- 'company_logo_url ' => FakerFactory::create ()->imageUrl (360 , 360 , 'company ' , true ),
72+ 'company_logo_url ' => FakerFactory::create ()->imageUrl ( 360 , 360 , 'company ' , true ),
7673 ];
7774
7875
7976 //$cbxjob['mod_by'] = $job->post_author;
80- $ cbxjob ['mod_date ' ] = date ('Y-m-d H:i:s ' );
77+ $ cbxjob ['mod_date ' ] = date ( 'Y-m-d H:i:s ' );
8178
82- $ cbxjob ['closing_date ' ] = date ('Y-m-d H:i:s ' , strtotime ('+7 days ' ) );
79+ $ cbxjob ['closing_date ' ] = date ( 'Y-m-d H:i:s ' , strtotime ( '+7 days ' ) );
8380
84- $ cbxjob ['expiry_date ' ] = date ('Y-m-d H:i:s ' , strtotime ('+7 days ' ) );
81+ $ cbxjob ['expiry_date ' ] = date ( 'Y-m-d H:i:s ' , strtotime ( '+7 days ' ) );
8582
8683
87-
88- \Cbx \Job \Models \CBXJob::query ()->create ($ cbxjob );
84+ \Cbx \Job \Models \CBXJob::query ()->create ( $ cbxjob );
8985 }
90- $ end = microtime (true );
86+ $ end = microtime ( true );
9187
9288 $ elapsed = $ end - $ start ;
9389
94- \WP_CLI ::success ("Successfully $ total dummy job added. Execution time $ elapsed seconds " );
90+ \WP_CLI ::success ( "Successfully $ total dummy job added. Execution time $ elapsed seconds " );
9591
9692 } //end method run
9793} //end class DummyJobGenerate
0 commit comments