File tree Expand file tree Collapse file tree 2 files changed +5
-10
lines changed
Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ abstract class PushStaleToCyclopsCommand extends PushStateToCyclopsCommand
99 final function executeUseCase ()
1010 {
1111 $ pushUseCase = new PushStaleToCyclopsUseCase ($ this ->getService ());
12- $ pushUseCase ->execute ($ this ->getList (), $ this ->onCustomerCreated ());
12+ $ pushUseCase ->execute ($ this ->getList (), $ this ->getCustomerPushedHandler ());
1313 }
1414
15- abstract protected function onCustomerCreated (): callable ;
15+ abstract protected function getCustomerPushedHandler (): callable ;
1616}
Original file line number Diff line number Diff line change @@ -18,23 +18,18 @@ public function __construct(CyclopsService $cyclopsService)
1818 $ this ->cyclopsService = $ cyclopsService ;
1919 }
2020
21- public function execute (CyclopsCustomerListEntity $ list , callable $ onCustomerCreated = null )
21+ public function execute (CyclopsCustomerListEntity $ list , callable $ onItemPushed )
2222 {
2323 foreach ($ list ->items as $ item ) {
2424 try {
2525 $ this ->cyclopsService ->setBrandOptInStatus ($ item );
26-
27- if ($ onCustomerCreated !== null ) {
28- $ onCustomerCreated ($ item );
29- }
26+ $ onItemPushed ($ item , false );
3027 } catch (CustomerNotFoundException $ exception ) {
3128 $ customer = $ this ->cyclopsService ->loadCustomer ($ item ->identity );
3229 $ customer ->brandOptIn = $ item ->brandOptIn ;
3330 $ this ->cyclopsService ->setBrandOptInStatus ($ customer );
3431
35- if ($ onCustomerCreated !== null ) {
36- $ onCustomerCreated ($ customer );
37- }
32+ $ onItemPushed ($ customer , true );
3833 }
3934 }
4035 }
You can’t perform that action at this time.
0 commit comments