@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Subscription process start' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process start'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getDescription() |
41 | 41 | { |
42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Process subscriptions initially' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Process subscriptions initially'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -65,50 +65,50 @@ discard block |
||
65 | 65 | * @since 2018.04 |
66 | 66 | * @category Developer |
67 | 67 | */ |
68 | - $names = (array) $config->get( 'controller/common/subscription/process/processors', [] ); |
|
68 | + $names = (array) $config->get('controller/common/subscription/process/processors', []); |
|
69 | 69 | |
70 | - $processors = $this->getProcessors( $names ); |
|
71 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' ); |
|
70 | + $processors = $this->getProcessors($names); |
|
71 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'subscription'); |
|
72 | 72 | |
73 | - $search = $manager->createSearch( true ); |
|
73 | + $search = $manager->createSearch(true); |
|
74 | 74 | $expr = [ |
75 | - $search->compare( '==', 'subscription.datenext', null ), |
|
75 | + $search->compare('==', 'subscription.datenext', null), |
|
76 | 76 | $search->getConditions(), |
77 | 77 | ]; |
78 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
79 | - $search->setSortations( [$search->sort( '+', 'subscription.id' )] ); |
|
78 | + $search->setConditions($search->combine('&&', $expr)); |
|
79 | + $search->setSortations([$search->sort('+', 'subscription.id')]); |
|
80 | 80 | |
81 | 81 | $start = 0; |
82 | 82 | |
83 | 83 | do |
84 | 84 | { |
85 | - $search->setSlice( $start, 100 ); |
|
86 | - $items = $manager->searchItems( $search ); |
|
85 | + $search->setSlice($start, 100); |
|
86 | + $items = $manager->searchItems($search); |
|
87 | 87 | |
88 | - foreach( $items as $item ) |
|
88 | + foreach ($items as $item) |
|
89 | 89 | { |
90 | 90 | try |
91 | 91 | { |
92 | - foreach( $processors as $processor ) { |
|
93 | - $processor->begin( $item ); |
|
92 | + foreach ($processors as $processor) { |
|
93 | + $processor->begin($item); |
|
94 | 94 | } |
95 | 95 | |
96 | - $interval = new \DateInterval( $item->getInterval() ); |
|
97 | - $item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) ); |
|
96 | + $interval = new \DateInterval($item->getInterval()); |
|
97 | + $item->setDateNext(date_create($item->getTimeCreated())->add($interval)->format('Y-m-d')); |
|
98 | 98 | |
99 | - $manager->saveItem( $item ); |
|
99 | + $manager->saveItem($item); |
|
100 | 100 | } |
101 | - catch( \Exception $e ) |
|
101 | + catch (\Exception $e) |
|
102 | 102 | { |
103 | 103 | $msg = 'Unable to process subscription with ID "%1$S": %2$s'; |
104 | - $logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) ); |
|
105 | - $logger->log( $e->getTraceAsString() ); |
|
104 | + $logger->log(sprintf($msg, $item->getId(), $e->getMessage())); |
|
105 | + $logger->log($e->getTraceAsString()); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - $count = count( $items ); |
|
109 | + $count = count($items); |
|
110 | 110 | $start += $count; |
111 | 111 | } |
112 | - while( $count === $search->getSliceSize() ); |
|
112 | + while ($count === $search->getSliceSize()); |
|
113 | 113 | } |
114 | 114 | } |