2020
2121class Tiny_Cli
2222{
23- /**
24- * Tiny_Plugin $settings
25- *
26- * @var Tiny_Settings
27- */
28- private $ tiny_settings ;
2923
30- public function __construct ($ settings )
24+ public function __construct ()
3125 {
32- $ this ->tiny_settings = $ settings ;
3326
3427 // Only add CLI hooks when WP-CLI is available
3528 if (defined ('WP_CLI ' ) && WP_CLI ) {
@@ -38,23 +31,13 @@ public function __construct($settings)
3831 }
3932
4033 public function register_command () {
41- $ command_instance = new Tiny_Command ( $ this -> tiny_settings );
34+ $ command_instance = new Tiny_Command ();
4235 WP_CLI ::add_command ('tiny ' , $ command_instance );
4336 }
4437}
4538
4639class Tiny_Command
4740{
48- /**
49- * Tiny_Plugin $settings
50- *
51- * @var Tiny_Settings
52- */
53- private $ tiny_settings ;
54-
55- public function __construct ( $ settings ) {
56- $ tiny_settings = $ settings ;
57- }
5841
5942 /**
6043 * Optimize will process images
@@ -79,11 +62,6 @@ public function __construct( $settings ) {
7962 */
8063 public function optimize ($ args , $ assoc_args )
8164 {
82- if (! $ this ->tiny_settings ) {
83- WP_CLI ::error ('TinyPNG settings not available. ' );
84- return ;
85- }
86-
8765 $ attachments = isset ($ assoc_args ['attachments ' ]) ? array_map ('trim ' , explode (', ' , $ assoc_args ['attachments ' ])) : array ();
8866
8967 if (empty ($ attachments )) {
0 commit comments