Completed
Push — master ( b6a23a...c3c77b )
by Aimeos
03:07
created
controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Base.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -104,37 +104,37 @@
 block discarded – undo
104 104
 	 * @param array $mappings Associative list of processor types as keys and index/data mappings as values
105 105
 	 * @return \Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Iface Processor object
106 106
 	 */
107
-	protected function getProcessors( array $mappings )
107
+	protected function getProcessors(array $mappings)
108 108
 	{
109 109
 		$list = [];
110 110
 		$context = $this->getContext();
111 111
 		$config = $context->getConfig();
112 112
 
113
-		foreach( $mappings as $type => $mapping )
113
+		foreach ($mappings as $type => $mapping)
114 114
 		{
115
-			if( ctype_alnum( $type ) === false )
115
+			if (ctype_alnum($type) === false)
116 116
 			{
117 117
 				$classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\' . $type : '<not a string>';
118
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
118
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
119 119
 			}
120 120
 
121
-			$name = $config->get( 'controller/common/subscription/export/csv/processor/' . $type . '/name', 'Standard' );
121
+			$name = $config->get('controller/common/subscription/export/csv/processor/' . $type . '/name', 'Standard');
122 122
 
123
-			if( ctype_alnum( $name ) === false )
123
+			if (ctype_alnum($name) === false)
124 124
 			{
125 125
 				$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>';
126
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
126
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
127 127
 			}
128 128
 
129
-			$classname = '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name;
129
+			$classname = '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name;
130 130
 
131
-			if( class_exists( $classname ) === false ) {
132
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
131
+			if (class_exists($classname) === false) {
132
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
133 133
 			}
134 134
 
135
-			$object = new $classname( $context, $mapping );
135
+			$object = new $classname($context, $mapping);
136 136
 
137
-			\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\Iface', $object );
137
+			\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\Iface', $object);
138 138
 
139 139
 			$list[$type] = $object;
140 140
 		}
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Subscription/Process/Base.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -27,37 +27,37 @@
 block discarded – undo
27 27
 	 * @param array $pnames List of processor names
28 28
 	 * @return \Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Iface Processor object
29 29
 	 */
30
-	protected function getProcessors( array $pnames )
30
+	protected function getProcessors(array $pnames)
31 31
 	{
32 32
 		$list = [];
33 33
 		$context = $this->getContext();
34 34
 		$config = $context->getConfig();
35 35
 
36
-		foreach( $pnames as $pname )
36
+		foreach ($pnames as $pname)
37 37
 		{
38
-			if( ctype_alnum( $pname ) === false )
38
+			if (ctype_alnum($pname) === false)
39 39
 			{
40 40
 				$classname = is_string($pname) ? '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . $pname : '<not a string>';
41
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
41
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
42 42
 			}
43 43
 
44
-			$name = $config->get( 'controller/common/subscription/process/processor/' . $pname . '/name', 'Standard' );
44
+			$name = $config->get('controller/common/subscription/process/processor/' . $pname . '/name', 'Standard');
45 45
 
46
-			if( ctype_alnum( $name ) === false )
46
+			if (ctype_alnum($name) === false)
47 47
 			{
48 48
 				$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . $pname . '\\' . $name : '<not a string>';
49
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
49
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
50 50
 			}
51 51
 
52
-			$classname = '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . ucfirst( $pname ) . '\\' . $name;
52
+			$classname = '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . ucfirst($pname) . '\\' . $name;
53 53
 
54
-			if( class_exists( $classname ) === false ) {
55
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
54
+			if (class_exists($classname) === false) {
55
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
56 56
 			}
57 57
 
58
-			$object = new $classname( $context );
58
+			$object = new $classname($context);
59 59
 
60
-			\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\Iface', $object );
60
+			\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\Iface', $object);
61 61
 
62 62
 			$list[$pname] = $object;
63 63
 		}
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Order/Export/Csv/Base.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -142,37 +142,37 @@
 block discarded – undo
142 142
 	 * @param array $mappings Associative list of processor types as keys and index/data mappings as values
143 143
 	 * @return \Aimeos\Controller\Common\Order\Export\Csv\Processor\Iface Processor object
144 144
 	 */
145
-	protected function getProcessors( array $mappings )
145
+	protected function getProcessors(array $mappings)
146 146
 	{
147 147
 		$list = [];
148 148
 		$context = $this->getContext();
149 149
 		$config = $context->getConfig();
150 150
 
151
-		foreach( $mappings as $type => $mapping )
151
+		foreach ($mappings as $type => $mapping)
152 152
 		{
153
-			if( ctype_alnum( $type ) === false )
153
+			if (ctype_alnum($type) === false)
154 154
 			{
155 155
 				$classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\' . $type : '<not a string>';
156
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
156
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
157 157
 			}
158 158
 
159
-			$name = $config->get( 'controller/common/order/export/csv/processor/' . $type . '/name', 'Standard' );
159
+			$name = $config->get('controller/common/order/export/csv/processor/' . $type . '/name', 'Standard');
160 160
 
161
-			if( ctype_alnum( $name ) === false )
161
+			if (ctype_alnum($name) === false)
162 162
 			{
163 163
 				$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>';
164
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
164
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
165 165
 			}
166 166
 
167
-			$classname = '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name;
167
+			$classname = '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name;
168 168
 
169
-			if( class_exists( $classname ) === false ) {
170
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
169
+			if (class_exists($classname) === false) {
170
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
171 171
 			}
172 172
 
173
-			$object = new $classname( $context, $mapping );
173
+			$object = new $classname($context, $mapping);
174 174
 
175
-			\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\Iface', $object );
175
+			\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\Iface', $object);
176 176
 
177 177
 			$list[$type] = $object;
178 178
 		}
Please login to merge, or discard this patch.
common/src/Controller/Common/Product/Import/Csv/Processor/Done.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 	 * @param array $mapping Associative list of field position in CSV as key and domain item key as value
28 28
 	 * @param \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor Decorated processor
29 29
 	 */
30
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping,
31
-		\Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor = null )
30
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping,
31
+		\Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor = null)
32 32
 	{
33 33
 	}
34 34
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @param array $data List of CSV fields with position as key and data as value
41 41
 	 * @return array List of data which hasn't been imported
42 42
 	 */
43
-	public function process( \Aimeos\MShop\Product\Item\Iface $item, array $data )
43
+	public function process(\Aimeos\MShop\Product\Item\Iface $item, array $data)
44 44
 	{
45 45
 		return $data;
46 46
 	}
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Subscription/Process/End/Standard.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,8 +98,7 @@
 block discarded – undo
98 98
 					}
99 99
 
100 100
 					$manager->saveItem( $item->setReason( $reason )->setStatus( 0 ) );
101
-				}
102
-				catch( \Exception $e )
101
+				} catch( \Exception $e )
103 102
 				{
104 103
 					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
105 104
 					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function getName()
30 30
 	{
31
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Subscription process end' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process end');
32 32
 	}
33 33
 
34 34
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function getDescription()
41 41
 	{
42
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Terminates expired subscriptions' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Terminates expired subscriptions');
43 43
 	}
44 44
 
45 45
 
@@ -65,51 +65,51 @@  discard block
 block discarded – undo
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::create( $context, 'subscription' );
70
+		$processors = $this->getProcessors($names);
71
+		$manager = \Aimeos\MShop::create($context, 'subscription');
72 72
 
73
-		$search = $manager->createSearch( true );
73
+		$search = $manager->createSearch(true);
74 74
 		$expr = [
75
-			$search->compare( '<', 'subscription.dateend', date( 'Y-m-d' ) ),
75
+			$search->compare('<', 'subscription.dateend', date('Y-m-d')),
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->end( $item );
92
+					foreach ($processors as $processor) {
93
+						$processor->end($item);
94 94
 					}
95 95
 
96
-					if( ( $reason = $item->getReason() ) === null ) {
96
+					if (($reason = $item->getReason()) === null) {
97 97
 						$reason = \Aimeos\MShop\Subscription\Item\Iface::REASON_END;
98 98
 					}
99 99
 
100
-					$manager->saveItem( $item->setReason( $reason )->setStatus( 0 ) );
100
+					$manager->saveItem($item->setReason($reason)->setStatus(0));
101 101
 				}
102
-				catch( \Exception $e )
102
+				catch (\Exception $e)
103 103
 				{
104 104
 					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
105
-					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
106
-					$logger->log( $e->getTraceAsString() );
105
+					$logger->log(sprintf($msg, $item->getId(), $e->getMessage()));
106
+					$logger->log($e->getTraceAsString());
107 107
 				}
108 108
 			}
109 109
 
110
-			$count = count( $items );
110
+			$count = count($items);
111 111
 			$start += $count;
112 112
 		}
113
-		while( $count === $search->getSliceSize() );
113
+		while ($count === $search->getSliceSize());
114 114
 	}
115 115
 }
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php 3 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -93,8 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
 						$interval = new \DateInterval( $item->getInterval() );
95 95
 						$item->setDateNext( date_create()->add( $interval )->format( 'Y-m-d' ) );
96
-					}
97
-					catch( \Exception $e )
96
+					} catch( \Exception $e )
98 97
 					{
99 98
 						$item->setReason( \Aimeos\MShop\Subscription\Item\Iface::REASON_PAYMENT );
100 99
 						$item->setDateEnd( date_create()->format( 'Y-m-d' ) );
@@ -108,8 +107,7 @@  discard block
 block discarded – undo
108 107
 					foreach( $processors as $processor ) {
109 108
 						$processor->renew( $item, $newInvoice );
110 109
 					}
111
-				}
112
-				catch( \Exception $e )
110
+				} catch( \Exception $e )
113 111
 				{
114 112
 					$msg = 'Unable to process subscription with ID "%1$s": %2$s';
115 113
 					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
@@ -152,8 +150,7 @@  discard block
 block discarded – undo
152 150
 
153 151
 			$context->setUserId( $baseItem->getCustomerId() );
154 152
 			$context->setGroupIds( $customerItem->getGroups() );
155
-		}
156
-		catch( \Exception $e ) {} // Subscription without account
153
+		} catch( \Exception $e ) {} // Subscription without account
157 154
 
158 155
 		return $context;
159 156
 	}
Please login to merge, or discard this patch.
Doc Comments   -3 removed lines patch added patch discarded remove patch
@@ -128,7 +128,6 @@  discard block
 block discarded – undo
128 128
 	 * Adds the given addresses to the basket
129 129
 	 *
130 130
 	 * @param \Aimeos\MShop\Context\Item\Iface Context object
131
-	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to add the addresses to
132 131
 	 * @param array $addresses Associative list of type as key and address object implementing \Aimeos\MShop\Order\Item\Base\Address\Iface as value
133 132
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order with addresses added
134 133
 	 */
@@ -205,7 +204,6 @@  discard block
 block discarded – undo
205 204
 	 * Adds the given products to the basket
206 205
 	 *
207 206
 	 * @param \Aimeos\MShop\Context\Item\Iface Context object
208
-	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to add the products to
209 207
 	 * @param \Aimeos\MShop\Order\Item\Base\Product\Iface[] $orderProducts List of product items
210 208
 	 * @param string $orderProductId Unique ID of the ordered subscription product
211 209
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order with products added
@@ -232,7 +230,6 @@  discard block
 block discarded – undo
232 230
 	 * Adds a matching delivery and payment service to the basket
233 231
 	 *
234 232
 	 * @param \Aimeos\MShop\Context\Item\Iface Context object
235
-	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to add the services to
236 233
 	 * @param array $services Associative list of type as key and list of service objects implementing \Aimeos\MShop\Order\Item\Base\Service\Iface as values
237 234
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order with delivery and payment service added
238 235
 	 */
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function getName()
30 30
 	{
31
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Subscription process renew' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process renew');
32 32
 	}
33 33
 
34 34
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function getDescription()
41 41
 	{
42
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Renews subscriptions at next date' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Renews subscriptions at next date');
43 43
 	}
44 44
 
45 45
 
@@ -54,73 +54,73 @@  discard block
 block discarded – undo
54 54
 		$config = $context->getConfig();
55 55
 		$logger = $context->getLogger();
56 56
 
57
-		$names = (array) $config->get( 'controller/common/subscription/process/processors', [] );
57
+		$names = (array) $config->get('controller/common/subscription/process/processors', []);
58 58
 
59
-		$date = date( 'Y-m-d' );
60
-		$processors = $this->getProcessors( $names );
61
-		$manager = \Aimeos\MShop::create( $context, 'subscription' );
59
+		$date = date('Y-m-d');
60
+		$processors = $this->getProcessors($names);
61
+		$manager = \Aimeos\MShop::create($context, 'subscription');
62 62
 
63
-		$search = $manager->createSearch( true );
63
+		$search = $manager->createSearch(true);
64 64
 		$expr = [
65
-			$search->compare( '<=', 'subscription.datenext', $date ),
66
-			$search->combine( '||', [
67
-				$search->compare( '==', 'subscription.dateend', null ),
68
-				$search->compare( '>', 'subscription.dateend', $date ),
69
-			] ),
65
+			$search->compare('<=', 'subscription.datenext', $date),
66
+			$search->combine('||', [
67
+				$search->compare('==', 'subscription.dateend', null),
68
+				$search->compare('>', 'subscription.dateend', $date),
69
+			]),
70 70
 			$search->getConditions(),
71 71
 		];
72
-		$search->setConditions( $search->combine( '&&', $expr ) );
73
-		$search->setSortations( [$search->sort( '+', 'subscription.id' )] );
72
+		$search->setConditions($search->combine('&&', $expr));
73
+		$search->setSortations([$search->sort('+', 'subscription.id')]);
74 74
 
75 75
 		$start = 0;
76 76
 
77 77
 		do
78 78
 		{
79
-			$search->setSlice( $start, 100 );
80
-			$items = $manager->searchItems( $search );
79
+			$search->setSlice($start, 100);
80
+			$items = $manager->searchItems($search);
81 81
 
82
-			foreach( $items as $item )
82
+			foreach ($items as $item)
83 83
 			{
84 84
 				try
85 85
 				{
86
-					$context = $this->createContext( $item->getOrderBaseId() );
87
-					$newOrder = $this->createOrderBase( $context, $item );
88
-					$newInvoice = $this->createOrderInvoice( $context, $newOrder );
86
+					$context = $this->createContext($item->getOrderBaseId());
87
+					$newOrder = $this->createOrderBase($context, $item);
88
+					$newInvoice = $this->createOrderInvoice($context, $newOrder);
89 89
 
90 90
 					try
91 91
 					{
92
-						$this->createPayment( $context, $newOrder, $newInvoice );
92
+						$this->createPayment($context, $newOrder, $newInvoice);
93 93
 
94
-						$interval = new \DateInterval( $item->getInterval() );
95
-						$item->setDateNext( date_create()->add( $interval )->format( 'Y-m-d' ) );
94
+						$interval = new \DateInterval($item->getInterval());
95
+						$item->setDateNext(date_create()->add($interval)->format('Y-m-d'));
96 96
 					}
97
-					catch( \Exception $e )
97
+					catch (\Exception $e)
98 98
 					{
99
-						$item->setReason( \Aimeos\MShop\Subscription\Item\Iface::REASON_PAYMENT );
100
-						$item->setDateEnd( date_create()->format( 'Y-m-d' ) );
101
-						$manager->saveItem( $item );
99
+						$item->setReason(\Aimeos\MShop\Subscription\Item\Iface::REASON_PAYMENT);
100
+						$item->setDateEnd(date_create()->format('Y-m-d'));
101
+						$manager->saveItem($item);
102 102
 
103 103
 						throw $e;
104 104
 					}
105 105
 
106
-					$manager->saveItem( $item );
106
+					$manager->saveItem($item);
107 107
 
108
-					foreach( $processors as $processor ) {
109
-						$processor->renew( $item, $newInvoice );
108
+					foreach ($processors as $processor) {
109
+						$processor->renew($item, $newInvoice);
110 110
 					}
111 111
 				}
112
-				catch( \Exception $e )
112
+				catch (\Exception $e)
113 113
 				{
114 114
 					$msg = 'Unable to process subscription with ID "%1$s": %2$s';
115
-					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
116
-					$logger->log( $e->getTraceAsString() );
115
+					$logger->log(sprintf($msg, $item->getId(), $e->getMessage()));
116
+					$logger->log($e->getTraceAsString());
117 117
 				}
118 118
 			}
119 119
 
120
-			$count = count( $items );
120
+			$count = count($items);
121 121
 			$start += $count;
122 122
 		}
123
-		while( $count === $search->getSliceSize() );
123
+		while ($count === $search->getSliceSize());
124 124
 	}
125 125
 
126 126
 
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	 * @param array $addresses Associative list of type as key and address object implementing \Aimeos\MShop\Order\Item\Base\Address\Iface as value
133 133
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order with addresses added
134 134
 	 */
135
-	protected function addBasketAddresses( \Aimeos\MShop\Context\Item\Iface $context,
136
-		\Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $addresses )
135
+	protected function addBasketAddresses(\Aimeos\MShop\Context\Item\Iface $context,
136
+		\Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $addresses)
137 137
 	{
138
-		foreach( $addresses as $type => $orderAddress ) {
139
-			$newBasket->setAddress( $orderAddress, $type );
138
+		foreach ($addresses as $type => $orderAddress) {
139
+			$newBasket->setAddress($orderAddress, $type);
140 140
 		}
141 141
 
142 142
 		return $newBasket;
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	 * @param array $codes List of coupon codes that should be added to the given basket
152 152
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Basket, maybe with coupons added
153 153
 	 */
154
-	protected function addBasketCoupons( \Aimeos\MShop\Context\Item\Iface $context,
155
-		\Aimeos\MShop\Order\Item\Base\Iface $basket, array $codes )
154
+	protected function addBasketCoupons(\Aimeos\MShop\Context\Item\Iface $context,
155
+		\Aimeos\MShop\Order\Item\Base\Iface $basket, array $codes)
156 156
 	{
157 157
 		/** controller/jobs/subcription/process/renew/standard/use-coupons
158 158
 		 *
@@ -166,34 +166,34 @@  discard block
 block discarded – undo
166 166
 		 * @category User
167 167
 		 * @since 2018.10
168 168
 		 */
169
-		if( $context->getConfig()->get( 'controller/jobs/subcription/process/renew/standard/use-coupons', false ) )
169
+		if ($context->getConfig()->get('controller/jobs/subcription/process/renew/standard/use-coupons', false))
170 170
 		{
171
-			$manager = \Aimeos\MShop::create( $context, 'coupon' );
172
-			$codeManager = \Aimeos\MShop::create( $context, 'coupon/code' );
171
+			$manager = \Aimeos\MShop::create($context, 'coupon');
172
+			$codeManager = \Aimeos\MShop::create($context, 'coupon/code');
173 173
 
174
-			foreach( $codes as $code )
174
+			foreach ($codes as $code)
175 175
 			{
176
-				$search = $manager->createSearch( true )->setSlice( 0, 1 );
176
+				$search = $manager->createSearch(true)->setSlice(0, 1);
177 177
 				$expr = [
178
-					$search->compare( '==', 'coupon.code.code', $code ),
179
-					$codeManager->createSearch( true )->getConditions(),
178
+					$search->compare('==', 'coupon.code.code', $code),
179
+					$codeManager->createSearch(true)->getConditions(),
180 180
 					$search->getConditions(),
181 181
 				];
182
-				$search->setConditions( $search->combine( '&&', $expr ) );
182
+				$search->setConditions($search->combine('&&', $expr));
183 183
 
184
-				$result = $manager->searchItems( $search );
184
+				$result = $manager->searchItems($search);
185 185
 
186
-				if( ( $item = reset( $result ) ) === false ) {
186
+				if (($item = reset($result)) === false) {
187 187
 					continue;
188 188
 				}
189 189
 
190
-				$provider = $manager->getProvider( $item, $code );
190
+				$provider = $manager->getProvider($item, $code);
191 191
 
192
-				if( $provider->isAvailable( $basket ) !== true ) {
192
+				if ($provider->isAvailable($basket) !== true) {
193 193
 					continue;
194 194
 				}
195 195
 
196
-				$provider->addCoupon( $basket );
196
+				$provider->addCoupon($basket);
197 197
 			}
198 198
 		}
199 199
 
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
 	 * @param string $orderProductId Unique ID of the ordered subscription product
211 211
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order with products added
212 212
 	 */
213
-	protected function addBasketProducts( \Aimeos\MShop\Context\Item\Iface $context,
214
-		\Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $orderProducts, $orderProductId )
213
+	protected function addBasketProducts(\Aimeos\MShop\Context\Item\Iface $context,
214
+		\Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $orderProducts, $orderProductId)
215 215
 	{
216
-		foreach( $orderProducts as $orderProduct )
216
+		foreach ($orderProducts as $orderProduct)
217 217
 		{
218
-			if( $orderProduct->getId() == $orderProductId )
218
+			if ($orderProduct->getId() == $orderProductId)
219 219
 			{
220
-				foreach( $orderProduct->getAttributeItems() as $attrItem ) {
221
-					$attrItem->setId( null );
220
+				foreach ($orderProduct->getAttributeItems() as $attrItem) {
221
+					$attrItem->setId(null);
222 222
 				}
223
-				$newBasket->addProduct( $orderProduct->setId( null ) );
223
+				$newBasket->addProduct($orderProduct->setId(null));
224 224
 			}
225 225
 		}
226 226
 
@@ -236,35 +236,35 @@  discard block
 block discarded – undo
236 236
 	 * @param array $services Associative list of type as key and list of service objects implementing \Aimeos\MShop\Order\Item\Base\Service\Iface as values
237 237
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order with delivery and payment service added
238 238
 	 */
239
-	protected function addBasketServices( \Aimeos\MShop\Context\Item\Iface $context,
240
-		\Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $services )
239
+	protected function addBasketServices(\Aimeos\MShop\Context\Item\Iface $context,
240
+		\Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $services)
241 241
 	{
242 242
 		$type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT;
243 243
 
244
-		if( isset( $services[$type] ) )
244
+		if (isset($services[$type]))
245 245
 		{
246
-			foreach( $services[$type] as $orderService ) {
247
-				$newBasket->addService( $orderService, $type );
246
+			foreach ($services[$type] as $orderService) {
247
+				$newBasket->addService($orderService, $type);
248 248
 			}
249 249
 		}
250 250
 
251 251
 		$type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY;
252 252
 
253
-		$serviceManager = \Aimeos\MShop::create( $context, 'service' );
254
-		$orderServiceManager = \Aimeos\MShop::create( $context, 'order/base/service' );
253
+		$serviceManager = \Aimeos\MShop::create($context, 'service');
254
+		$orderServiceManager = \Aimeos\MShop::create($context, 'order/base/service');
255 255
 
256
-		$search = $serviceManager->createSearch( true );
257
-		$search->setSortations( [$search->sort( '+', 'service.position' )] );
258
-		$search->setConditions( $search->compare( '==', 'service.type', $type ) );
256
+		$search = $serviceManager->createSearch(true);
257
+		$search->setSortations([$search->sort('+', 'service.position')]);
258
+		$search->setConditions($search->compare('==', 'service.type', $type));
259 259
 
260
-		foreach( $serviceManager->searchItems( $search, ['media', 'price', 'text'] ) as $item )
260
+		foreach ($serviceManager->searchItems($search, ['media', 'price', 'text']) as $item)
261 261
 		{
262
-			$provider = $serviceManager->getProvider( $item, $item->getType() );
262
+			$provider = $serviceManager->getProvider($item, $item->getType());
263 263
 
264
-			if( $provider->isAvailable( $newBasket ) === true )
264
+			if ($provider->isAvailable($newBasket) === true)
265 265
 			{
266
-				$orderServiceItem = $orderServiceManager->createItem()->copyFrom( $item );
267
-				return $newBasket->addService( $orderServiceItem, $type );
266
+				$orderServiceItem = $orderServiceManager->createItem()->copyFrom($item);
267
+				return $newBasket->addService($orderServiceItem, $type);
268 268
 			}
269 269
 		}
270 270
 
@@ -278,30 +278,30 @@  discard block
 block discarded – undo
278 278
 	 * @param string $baseId Unique order base ID
279 279
 	 * @return \Aimeos\MShop\Context\Item\Iface New context object
280 280
 	 */
281
-	protected function createContext( $baseId )
281
+	protected function createContext($baseId)
282 282
 	{
283 283
 		$context = clone $this->getContext();
284 284
 
285
-		$manager = \Aimeos\MShop::create( $context, 'order/base' );
286
-		$baseItem = $manager->getItem( $baseId );
285
+		$manager = \Aimeos\MShop::create($context, 'order/base');
286
+		$baseItem = $manager->getItem($baseId);
287 287
 
288 288
 		$locale = $baseItem->getLocale();
289 289
 		$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
290 290
 
291
-		$manager = \Aimeos\MShop::create( $context, 'locale' );
292
-		$locale = $manager->bootstrap( $baseItem->getSiteCode(), $locale->getLanguageId(), $locale->getCurrencyId(), false, $level );
291
+		$manager = \Aimeos\MShop::create($context, 'locale');
292
+		$locale = $manager->bootstrap($baseItem->getSiteCode(), $locale->getLanguageId(), $locale->getCurrencyId(), false, $level);
293 293
 
294
-		$context->setLocale( $locale );
294
+		$context->setLocale($locale);
295 295
 
296 296
 		try
297 297
 		{
298
-			$manager = \Aimeos\MShop::create( $context, 'customer' );
299
-			$customerItem = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] );
298
+			$manager = \Aimeos\MShop::create($context, 'customer');
299
+			$customerItem = $manager->getItem($baseItem->getCustomerId(), ['customer/group']);
300 300
 
301
-			$context->setUserId( $baseItem->getCustomerId() );
302
-			$context->setGroupIds( $customerItem->getGroups() );
301
+			$context->setUserId($baseItem->getCustomerId());
302
+			$context->setGroupIds($customerItem->getGroups());
303 303
 		}
304
-		catch( \Exception $e ) {} // Subscription without account
304
+		catch (\Exception $e) {} // Subscription without account
305 305
 
306 306
 		return $context;
307 307
 	}
@@ -314,19 +314,19 @@  discard block
 block discarded – undo
314 314
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item with order base ID and order product ID
315 315
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Complete order with product, addresses and services saved to the storage
316 316
 	 */
317
-	protected function createOrderBase( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription )
317
+	protected function createOrderBase(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription)
318 318
 	{
319
-		$manager = \Aimeos\MShop::create( $context, 'order/base' );
319
+		$manager = \Aimeos\MShop::create($context, 'order/base');
320 320
 
321
-		$basket = $manager->load( $subscription->getOrderBaseId() );
322
-		$newBasket = $manager->createItem()->setCustomerId( $basket->getCustomerId() );
321
+		$basket = $manager->load($subscription->getOrderBaseId());
322
+		$newBasket = $manager->createItem()->setCustomerId($basket->getCustomerId());
323 323
 
324
-		$newBasket = $this->addBasketProducts( $context, $newBasket, $basket->getProducts(), $subscription->getOrderProductId() );
325
-		$newBasket = $this->addBasketAddresses( $context, $newBasket, $basket->getAddresses() );
326
-		$newBasket = $this->addBasketServices( $context, $newBasket, $basket->getServices() );
327
-		$newBasket = $this->addBasketCoupons( $context, $newBasket, array_keys( $basket->getCoupons() ) );
324
+		$newBasket = $this->addBasketProducts($context, $newBasket, $basket->getProducts(), $subscription->getOrderProductId());
325
+		$newBasket = $this->addBasketAddresses($context, $newBasket, $basket->getAddresses());
326
+		$newBasket = $this->addBasketServices($context, $newBasket, $basket->getServices());
327
+		$newBasket = $this->addBasketCoupons($context, $newBasket, array_keys($basket->getCoupons()));
328 328
 
329
-		return $manager->store( $newBasket );
329
+		return $manager->store($newBasket);
330 330
 	}
331 331
 
332 332
 
@@ -337,15 +337,15 @@  discard block
 block discarded – undo
337 337
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Complete order with product, addresses and services saved to the storage
338 338
 	 * @return \Aimeos\MShop\Order\Item\Iface New invoice item associated to the order saved to the storage
339 339
 	 */
340
-	protected function createOrderInvoice( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket )
340
+	protected function createOrderInvoice(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket)
341 341
 	{
342
-		$manager = \Aimeos\MShop::create( $context, 'order' );
342
+		$manager = \Aimeos\MShop::create($context, 'order');
343 343
 
344 344
 		$item = $manager->createItem();
345
-		$item->setBaseId( $basket->getId() );
346
-		$item->setType( 'subscription' );
345
+		$item->setBaseId($basket->getId());
346
+		$item->setType('subscription');
347 347
 
348
-		return $manager->saveItem( $item );
348
+		return $manager->saveItem($item);
349 349
 	}
350 350
 
351 351
 
@@ -356,17 +356,17 @@  discard block
 block discarded – undo
356 356
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Complete order with product, addresses and services
357 357
 	 * @param \Aimeos\MShop\Order\Item\Iface New invoice item associated to the order
358 358
 	 */
359
-	protected function createPayment( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket,
360
-		\Aimeos\MShop\Order\Item\Iface $invoice )
359
+	protected function createPayment(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket,
360
+		\Aimeos\MShop\Order\Item\Iface $invoice)
361 361
 	{
362
-		$manager = \Aimeos\MShop::create( $context, 'service' );
362
+		$manager = \Aimeos\MShop::create($context, 'service');
363 363
 
364
-		foreach( $basket->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT ) as $service )
364
+		foreach ($basket->getService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT) as $service)
365 365
 		{
366
-			$item = $manager->getItem( $service->getServiceId() );
367
-			$provider = $manager->getProvider( $item, 'payment' );
366
+			$item = $manager->getItem($service->getServiceId());
367
+			$provider = $manager->getProvider($item, 'payment');
368 368
 
369
-			$provider->repay( $invoice );
369
+			$provider->repay($invoice);
370 370
 		}
371 371
 	}
372 372
 }
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Subscription/Process/Begin/Standard.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -153,15 +153,13 @@
 block discarded – undo
153 153
 
154 154
 						$interval = new \DateInterval( $item->getInterval() );
155 155
 						$item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) );
156
-					}
157
-					elseif( $item->getTimeCreated() < $date )
156
+					} elseif( $item->getTimeCreated() < $date )
158 157
 					{
159 158
 						$item->setStatus( 0 );
160 159
 					}
161 160
 
162 161
 					$manager->saveItem( $item );
163
-				}
164
-				catch( \Exception $e )
162
+				} catch( \Exception $e )
165 163
 				{
166 164
 					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
167 165
 					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		 * @see controller/common/subscription/process/payment-status
68 68
 		 * @see controller/common/subscription/process/payment-days
69 69
 		 */
70
-		$names = (array) $config->get( 'controller/common/subscription/process/processors', [] );
70
+		$names = (array) $config->get('controller/common/subscription/process/processors', []);
71 71
 
72 72
 		/** controller/common/subscription/process/payment-status
73 73
 		 * Minimum payment status that will activate the subscription
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		 * @see controller/common/subscription/process/payment-days
87 87
 		 */
88 88
 		$status = \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED;
89
-		$status = $config->get( 'controller/common/subscription/process/payment-status', $status );
89
+		$status = $config->get('controller/common/subscription/process/payment-status', $status);
90 90
 
91 91
 		/** controller/common/subscription/process/payment-days
92 92
 		 * Number of days to wait for the payment until subscription is removed
@@ -104,74 +104,74 @@  discard block
 block discarded – undo
104 104
 		 * @see controller/common/subscription/process/processors
105 105
 		 * @see controller/common/subscription/process/payment-status
106 106
 		 */
107
-		$days = (float) $config->get( 'controller/common/subscription/process/payment-days', 3 );
107
+		$days = (float) $config->get('controller/common/subscription/process/payment-days', 3);
108 108
 
109 109
 
110
-		$processors = $this->getProcessors( $names );
111
-		$orderManager = \Aimeos\MShop::create( $context, 'order' );
112
-		$manager = \Aimeos\MShop::create( $context, 'subscription' );
110
+		$processors = $this->getProcessors($names);
111
+		$orderManager = \Aimeos\MShop::create($context, 'order');
112
+		$manager = \Aimeos\MShop::create($context, 'subscription');
113 113
 
114
-		$search = $manager->createSearch( true );
114
+		$search = $manager->createSearch(true);
115 115
 		$expr = [
116
-			$search->compare( '==', 'subscription.datenext', null ),
116
+			$search->compare('==', 'subscription.datenext', null),
117 117
 			$search->getConditions(),
118 118
 		];
119
-		$search->setConditions( $search->combine( '&&', $expr ) );
120
-		$search->setSortations( [$search->sort( '+', 'subscription.id' )] );
119
+		$search->setConditions($search->combine('&&', $expr));
120
+		$search->setSortations([$search->sort('+', 'subscription.id')]);
121 121
 
122
-		$date = date( 'Y-m-d H:i:s', time() - 86400 * $days );
122
+		$date = date('Y-m-d H:i:s', time() - 86400 * $days);
123 123
 		$start = 0;
124 124
 
125 125
 		do
126 126
 		{
127 127
 			$ordBaseIds = $payStatus = [];
128 128
 
129
-			$search->setSlice( $start, 100 );
130
-			$items = $manager->searchItems( $search );
129
+			$search->setSlice($start, 100);
130
+			$items = $manager->searchItems($search);
131 131
 
132
-			foreach( $items as $item ) {
132
+			foreach ($items as $item) {
133 133
 				$ordBaseIds[] = $item->getOrderBaseId();
134 134
 			}
135 135
 
136
-			$orderSearch = $orderManager->createSearch()->setSlice( 0, $search->getSliceSize() );
137
-			$orderSearch->setConditions( $orderSearch->compare( '==', 'order.base.id', $ordBaseIds ) );
138
-			$orderSearch->setSortations( [$orderSearch->sort( '+', 'order.id' )] );
136
+			$orderSearch = $orderManager->createSearch()->setSlice(0, $search->getSliceSize());
137
+			$orderSearch->setConditions($orderSearch->compare('==', 'order.base.id', $ordBaseIds));
138
+			$orderSearch->setSortations([$orderSearch->sort('+', 'order.id')]);
139 139
 
140
-			foreach( $orderManager->searchItems( $orderSearch ) as $orderItem ) {
140
+			foreach ($orderManager->searchItems($orderSearch) as $orderItem) {
141 141
 				$payStatus[$orderItem->getBaseId()] = $orderItem->getPaymentStatus();
142 142
 			}
143 143
 
144
-			foreach( $items as $item )
144
+			foreach ($items as $item)
145 145
 			{
146 146
 				try
147 147
 				{
148
-					if( isset( $payStatus[$item->getOrderBaseId()] ) && $payStatus[$item->getOrderBaseId()] >= $status )
148
+					if (isset($payStatus[$item->getOrderBaseId()]) && $payStatus[$item->getOrderBaseId()] >= $status)
149 149
 					{
150
-						foreach( $processors as $processor ) {
151
-							$processor->begin( $item );
150
+						foreach ($processors as $processor) {
151
+							$processor->begin($item);
152 152
 						}
153 153
 
154
-						$interval = new \DateInterval( $item->getInterval() );
155
-						$item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) );
154
+						$interval = new \DateInterval($item->getInterval());
155
+						$item->setDateNext(date_create($item->getTimeCreated())->add($interval)->format('Y-m-d'));
156 156
 					}
157
-					elseif( $item->getTimeCreated() < $date )
157
+					elseif ($item->getTimeCreated() < $date)
158 158
 					{
159
-						$item->setStatus( 0 );
159
+						$item->setStatus(0);
160 160
 					}
161 161
 
162
-					$manager->saveItem( $item );
162
+					$manager->saveItem($item);
163 163
 				}
164
-				catch( \Exception $e )
164
+				catch (\Exception $e)
165 165
 				{
166 166
 					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
167
-					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
168
-					$logger->log( $e->getTraceAsString() );
167
+					$logger->log(sprintf($msg, $item->getId(), $e->getMessage()));
168
+					$logger->log($e->getTraceAsString());
169 169
 				}
170 170
 			}
171 171
 
172
-			$count = count( $items );
172
+			$count = count($items);
173 173
 			$start += $count;
174 174
 		}
175
-		while( $count === $search->getSliceSize() );
175
+		while ($count === $search->getSliceSize());
176 176
 	}
177 177
 }
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Order/Service/Delivery/Standard.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -127,8 +127,7 @@  discard block
 block discarded – undo
127 127
 						{
128 128
 							$serviceProvider->processBatch( $orderItems );
129 129
 							$orderManager->saveItems( $orderItems );
130
-						}
131
-						catch( \Exception $e )
130
+						} catch( \Exception $e )
132 131
 						{
133 132
 							$str = 'Error while processing orders by delivery service "%1$s": %2$s';
134 133
 							$context->getLogger()->log( sprintf( $str, $serviceItem->getLabel(), $e->getMessage() ) );
@@ -138,8 +137,7 @@  discard block
 block discarded – undo
138 137
 						$orderStart += $orderCount;
139 138
 					}
140 139
 					while( $orderCount >= $orderSearch->getSliceSize() );
141
-				}
142
-				catch( \Exception $e )
140
+				} catch( \Exception $e )
143 141
 				{
144 142
 					$str = 'Error while processing service with ID "%1$s": %2$s';
145 143
 					$context->getLogger()->log( sprintf( $str, $serviceItem->getId(), $e->getMessage() ) );
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function getName()
31 31
 	{
32
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Process order delivery services' );
32
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Process order delivery services');
33 33
 	}
34 34
 
35 35
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function getDescription()
42 42
 	{
43
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Sends paid orders to the ERP system or logistic partner' );
43
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Sends paid orders to the ERP system or logistic partner');
44 44
 	}
45 45
 
46 46
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 		 * @see controller/jobs/order/email/delivery/standard/limit-days
70 70
 		 * @see controller/jobs/order/service/delivery/batch-max
71 71
 		 */
72
-		$days = $context->getConfig()->get( 'controller/jobs/order/service/delivery/limit-days', 90 );
73
-		$date = date( 'Y-m-d 00:00:00', time() - 86400 * $days );
72
+		$days = $context->getConfig()->get('controller/jobs/order/service/delivery/limit-days', 90);
73
+		$date = date('Y-m-d 00:00:00', time() - 86400 * $days);
74 74
 
75 75
 		/** controller/jobs/order/service/delivery/batch-max
76 76
 		 * Maximum number of orders processed at once by the delivery service provider
@@ -85,71 +85,71 @@  discard block
 block discarded – undo
85 85
 		 * @category Developer
86 86
 		 * @see controller/jobs/order/service/delivery/limit-days
87 87
 		 */
88
-		$maxItems = $context->getConfig()->get( 'controller/jobs/order/service/delivery/batch-max', 100 );
88
+		$maxItems = $context->getConfig()->get('controller/jobs/order/service/delivery/batch-max', 100);
89 89
 
90 90
 
91
-		$serviceManager = \Aimeos\MShop\Service\Manager\Factory::create( $context );
91
+		$serviceManager = \Aimeos\MShop\Service\Manager\Factory::create($context);
92 92
 		$serviceSearch = $serviceManager->createSearch();
93
-		$serviceSearch->setConditions( $serviceSearch->compare( '==', 'service.type', 'delivery' ) );
93
+		$serviceSearch->setConditions($serviceSearch->compare('==', 'service.type', 'delivery'));
94 94
 
95
-		$orderManager = \Aimeos\MShop\Order\Manager\Factory::create( $context );
95
+		$orderManager = \Aimeos\MShop\Order\Manager\Factory::create($context);
96 96
 		$orderSearch = $orderManager->createSearch();
97 97
 
98 98
 		$start = 0;
99 99
 
100 100
 		do
101 101
 		{
102
-			$serviceItems = $serviceManager->searchItems( $serviceSearch );
102
+			$serviceItems = $serviceManager->searchItems($serviceSearch);
103 103
 
104
-			foreach( $serviceItems as $serviceItem )
104
+			foreach ($serviceItems as $serviceItem)
105 105
 			{
106 106
 				try
107 107
 				{
108
-					$serviceProvider = $serviceManager->getProvider( $serviceItem, $serviceItem->getType() );
108
+					$serviceProvider = $serviceManager->getProvider($serviceItem, $serviceItem->getType());
109 109
 
110 110
 					$expr = array(
111
-						$orderSearch->compare( '>', 'order.datepayment', $date ),
112
-						$orderSearch->compare( '>', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_PENDING ),
113
-						$orderSearch->compare( '==', 'order.statusdelivery', \Aimeos\MShop\Order\Item\Base::STAT_UNFINISHED ),
114
-						$orderSearch->compare( '==', 'order.base.service.code', $serviceItem->getCode() ),
115
-						$orderSearch->compare( '==', 'order.base.service.type', 'delivery' ),
111
+						$orderSearch->compare('>', 'order.datepayment', $date),
112
+						$orderSearch->compare('>', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_PENDING),
113
+						$orderSearch->compare('==', 'order.statusdelivery', \Aimeos\MShop\Order\Item\Base::STAT_UNFINISHED),
114
+						$orderSearch->compare('==', 'order.base.service.code', $serviceItem->getCode()),
115
+						$orderSearch->compare('==', 'order.base.service.type', 'delivery'),
116 116
 					);
117
-					$orderSearch->setConditions( $orderSearch->combine( '&&', $expr ) );
117
+					$orderSearch->setConditions($orderSearch->combine('&&', $expr));
118 118
 
119 119
 					$orderStart = 0;
120 120
 
121 121
 					do
122 122
 					{
123
-						$orderSearch->setSlice( $orderStart, $maxItems );
124
-						$orderItems = $orderManager->searchItems( $orderSearch );
123
+						$orderSearch->setSlice($orderStart, $maxItems);
124
+						$orderItems = $orderManager->searchItems($orderSearch);
125 125
 
126 126
 						try
127 127
 						{
128
-							$serviceProvider->processBatch( $orderItems );
129
-							$orderManager->saveItems( $orderItems );
128
+							$serviceProvider->processBatch($orderItems);
129
+							$orderManager->saveItems($orderItems);
130 130
 						}
131
-						catch( \Exception $e )
131
+						catch (\Exception $e)
132 132
 						{
133 133
 							$str = 'Error while processing orders by delivery service "%1$s": %2$s';
134
-							$context->getLogger()->log( sprintf( $str, $serviceItem->getLabel(), $e->getMessage() ) );
134
+							$context->getLogger()->log(sprintf($str, $serviceItem->getLabel(), $e->getMessage()));
135 135
 						}
136 136
 
137
-						$orderCount = count( $orderItems );
137
+						$orderCount = count($orderItems);
138 138
 						$orderStart += $orderCount;
139 139
 					}
140
-					while( $orderCount >= $orderSearch->getSliceSize() );
140
+					while ($orderCount >= $orderSearch->getSliceSize());
141 141
 				}
142
-				catch( \Exception $e )
142
+				catch (\Exception $e)
143 143
 				{
144 144
 					$str = 'Error while processing service with ID "%1$s": %2$s';
145
-					$context->getLogger()->log( sprintf( $str, $serviceItem->getId(), $e->getMessage() ) );
145
+					$context->getLogger()->log(sprintf($str, $serviceItem->getId(), $e->getMessage()));
146 146
 				}
147 147
 			}
148 148
 
149
-			$count = count( $serviceItems );
149
+			$count = count($serviceItems);
150 150
 			$start += $count;
151
-			$serviceSearch->setSlice( $start );
151
+			$serviceSearch->setSlice($start);
152 152
 		}
153
-		while( $count >= $serviceSearch->getSliceSize() );
153
+		while ($count >= $serviceSearch->getSliceSize());
154 154
 	}
155 155
 }
Please login to merge, or discard this patch.
Controller/Common/Subscription/Export/Csv/Processor/Product/Standard.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,24 +40,24 @@  discard block
 block discarded – undo
40 40
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items
41 41
 	 * @return array Two dimensional associative list of order data representing the lines in CSV
42 42
 	 */
43
-	public function process( \Aimeos\MShop\Subscription\Item\Iface $subscription, \Aimeos\MShop\Order\Item\Base\Iface $order )
43
+	public function process(\Aimeos\MShop\Subscription\Item\Iface $subscription, \Aimeos\MShop\Order\Item\Base\Iface $order)
44 44
 	{
45 45
 		$result = [];
46 46
 
47
-		foreach( $order->getProducts() as $item )
47
+		foreach ($order->getProducts() as $item)
48 48
 		{
49
-			if( $subscription->getOrderProductId() != $item->getId() ) {
49
+			if ($subscription->getOrderProductId() != $item->getId()) {
50 50
 				continue;
51 51
 			}
52 52
 
53 53
 			$data = [];
54 54
 			$list = $item->toArray();
55 55
 
56
-			foreach( $item->getAttributeItems() as $attrItem )
56
+			foreach ($item->getAttributeItems() as $attrItem)
57 57
 			{
58
-				foreach( $attrItem->toArray() as $key => $value )
58
+				foreach ($attrItem->toArray() as $key => $value)
59 59
 				{
60
-					if( isset( $list[$key] ) ) {
60
+					if (isset($list[$key])) {
61 61
 						$list[$key] .= "\n" . $value;
62 62
 					} else {
63 63
 						$list[$key] = $value;
@@ -65,16 +65,16 @@  discard block
 block discarded – undo
65 65
 				}
66 66
 			}
67 67
 
68
-			foreach( $this->getMapping() as $pos => $key )
68
+			foreach ($this->getMapping() as $pos => $key)
69 69
 			{
70
-				if( array_key_exists( $key, $list ) ) {
70
+				if (array_key_exists($key, $list)) {
71 71
 					$data[$pos] = $list[$key];
72 72
 				} else {
73 73
 					$data[$pos] = '';
74 74
 				}
75 75
 			}
76 76
 
77
-			ksort( $data );
77
+			ksort($data);
78 78
 			$result[] = $data;
79 79
 		}
80 80
 
Please login to merge, or discard this patch.