File tree 2 files changed +5
-10
lines changed
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
9
9
final function executeUseCase ()
10
10
{
11
11
$ pushUseCase = new PushStaleToCyclopsUseCase ($ this ->getService ());
12
- $ pushUseCase ->execute ($ this ->getList (), $ this ->onCustomerCreated ());
12
+ $ pushUseCase ->execute ($ this ->getList (), $ this ->getCustomerPushedHandler ());
13
13
}
14
14
15
- abstract protected function onCustomerCreated (): callable ;
15
+ abstract protected function getCustomerPushedHandler (): callable ;
16
16
}
Original file line number Diff line number Diff line change @@ -18,23 +18,18 @@ public function __construct(CyclopsService $cyclopsService)
18
18
$ this ->cyclopsService = $ cyclopsService ;
19
19
}
20
20
21
- public function execute (CyclopsCustomerListEntity $ list , callable $ onCustomerCreated = null )
21
+ public function execute (CyclopsCustomerListEntity $ list , callable $ onItemPushed )
22
22
{
23
23
foreach ($ list ->items as $ item ) {
24
24
try {
25
25
$ this ->cyclopsService ->setBrandOptInStatus ($ item );
26
-
27
- if ($ onCustomerCreated !== null ) {
28
- $ onCustomerCreated ($ item );
29
- }
26
+ $ onItemPushed ($ item , false );
30
27
} catch (CustomerNotFoundException $ exception ) {
31
28
$ customer = $ this ->cyclopsService ->loadCustomer ($ item ->identity );
32
29
$ customer ->brandOptIn = $ item ->brandOptIn ;
33
30
$ this ->cyclopsService ->setBrandOptInStatus ($ customer );
34
31
35
- if ($ onCustomerCreated !== null ) {
36
- $ onCustomerCreated ($ customer );
37
- }
32
+ $ onItemPushed ($ customer , true );
38
33
}
39
34
}
40
35
}
You can’t perform that action at this time.
0 commit comments