@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function attributeAction() |
29 | 29 | { |
30 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/attribute'); |
|
31 | - return $this->getClientOutput($client); |
|
30 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/attribute' ); |
|
31 | + return $this->getClientOutput( $client ); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -37,18 +37,18 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function countAction() |
39 | 39 | { |
40 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/count'); |
|
40 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/count' ); |
|
41 | 41 | |
42 | - if (!isset($this->responseFactory)) { // TYPO3 10 |
|
43 | - return $this->getClientOutput($client); |
|
42 | + if( !isset( $this->responseFactory ) ) { // TYPO3 10 |
|
43 | + return $this->getClientOutput( $client ); |
|
44 | 44 | } |
45 | 45 | |
46 | - $client->setView($this->context()->view())->init(); |
|
46 | + $client->setView( $this->context()->view() )->init(); |
|
47 | 47 | |
48 | 48 | return $this->responseFactory->createResponse() |
49 | - ->withAddedHeader('Content-Type', 'application/javascript') |
|
50 | - ->withAddedHeader('Cache-Control', 'public, max-age=300') |
|
51 | - ->withBody($this->streamFactory->createStream((string) $client->body())); |
|
49 | + ->withAddedHeader( 'Content-Type', 'application/javascript' ) |
|
50 | + ->withAddedHeader( 'Cache-Control', 'public, max-age=300' ) |
|
51 | + ->withBody( $this->streamFactory->createStream( (string) $client->body() ) ); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | { |
60 | 60 | try { |
61 | 61 | $this->removeMetatags(); |
62 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/detail'); |
|
63 | - return $this->getClientOutput($client); |
|
64 | - } catch(\Exception $e) { |
|
65 | - $this->exception($e); |
|
62 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/detail' ); |
|
63 | + return $this->getClientOutput( $client ); |
|
64 | + } catch( \Exception $e ) { |
|
65 | + $this->exception( $e ); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function filterAction() |
74 | 74 | { |
75 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/filter'); |
|
76 | - return $this->getClientOutput($client); |
|
75 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/filter' ); |
|
76 | + return $this->getClientOutput( $client ); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | public function homeAction() |
84 | 84 | { |
85 | 85 | $this->removeMetatags(); |
86 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/home'); |
|
87 | - return $this->getClientOutput($client); |
|
86 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/home' ); |
|
87 | + return $this->getClientOutput( $client ); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | public function listAction() |
95 | 95 | { |
96 | 96 | $this->removeMetatags(); |
97 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/lists'); |
|
98 | - return $this->getClientOutput($client); |
|
97 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/lists' ); |
|
98 | + return $this->getClientOutput( $client ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function priceAction() |
106 | 106 | { |
107 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/price'); |
|
108 | - return $this->getClientOutput($client); |
|
107 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/price' ); |
|
108 | + return $this->getClientOutput( $client ); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function searchAction() |
116 | 116 | { |
117 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/search'); |
|
118 | - return $this->getClientOutput($client); |
|
117 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/search' ); |
|
118 | + return $this->getClientOutput( $client ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function sessionAction() |
126 | 126 | { |
127 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/session'); |
|
128 | - return $this->getClientOutput($client); |
|
127 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/session' ); |
|
128 | + return $this->getClientOutput( $client ); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function stageAction() |
136 | 136 | { |
137 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/stage'); |
|
138 | - return $this->getClientOutput($client); |
|
137 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/stage' ); |
|
138 | + return $this->getClientOutput( $client ); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -144,18 +144,18 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function stockAction() |
146 | 146 | { |
147 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/stock'); |
|
147 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/stock' ); |
|
148 | 148 | |
149 | - if (!isset($this->responseFactory)) { // TYPO3 10 |
|
150 | - return $this->getClientOutput($client); |
|
149 | + if( !isset( $this->responseFactory ) ) { // TYPO3 10 |
|
150 | + return $this->getClientOutput( $client ); |
|
151 | 151 | } |
152 | 152 | |
153 | - $client->setView($this->context()->view())->init(); |
|
153 | + $client->setView( $this->context()->view() )->init(); |
|
154 | 154 | |
155 | 155 | return $this->responseFactory->createResponse() |
156 | - ->withAddedHeader('Content-Type', 'application/javascript') |
|
157 | - ->withAddedHeader('Cache-Control', 'public, max-age=300') |
|
158 | - ->withBody($this->streamFactory->createStream((string) $client->body())); |
|
156 | + ->withAddedHeader( 'Content-Type', 'application/javascript' ) |
|
157 | + ->withAddedHeader( 'Cache-Control', 'public, max-age=300' ) |
|
158 | + ->withBody( $this->streamFactory->createStream( (string) $client->body() ) ); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -164,18 +164,18 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function suggestAction() |
166 | 166 | { |
167 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/suggest'); |
|
167 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/suggest' ); |
|
168 | 168 | |
169 | - if (!isset($this->responseFactory)) { // TYPO3 10 |
|
170 | - return $this->getClientOutput($client); |
|
169 | + if( !isset( $this->responseFactory ) ) { // TYPO3 10 |
|
170 | + return $this->getClientOutput( $client ); |
|
171 | 171 | } |
172 | 172 | |
173 | - $client->setView($this->context()->view())->init(); |
|
173 | + $client->setView( $this->context()->view() )->init(); |
|
174 | 174 | |
175 | 175 | return $this->responseFactory->createResponse() |
176 | - ->withAddedHeader('Content-Type', 'application/json') |
|
177 | - ->withAddedHeader('Cache-Control', 'public, max-age=300') |
|
178 | - ->withBody($this->streamFactory->createStream((string) $client->body())); |
|
176 | + ->withAddedHeader( 'Content-Type', 'application/json' ) |
|
177 | + ->withAddedHeader( 'Cache-Control', 'public, max-age=300' ) |
|
178 | + ->withBody( $this->streamFactory->createStream( (string) $client->body() ) ); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function supplierAction() |
186 | 186 | { |
187 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/supplier'); |
|
188 | - return $this->getClientOutput($client); |
|
187 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/supplier' ); |
|
188 | + return $this->getClientOutput( $client ); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | public function treeAction() |
196 | 196 | { |
197 | 197 | try { |
198 | - $client = \Aimeos\Client\Html::create($this->context(), 'catalog/tree'); |
|
199 | - return $this->getClientOutput($client); |
|
200 | - } catch(\Exception $e) { |
|
201 | - $this->exception($e); |
|
198 | + $client = \Aimeos\Client\Html::create( $this->context(), 'catalog/tree' ); |
|
199 | + return $this->getClientOutput( $client ); |
|
200 | + } catch( \Exception $e ) { |
|
201 | + $this->exception( $e ); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | * @param \Exception $e Caught exception |
210 | 210 | * @throws \Exception Thrown exception |
211 | 211 | */ |
212 | - protected function exception(\Exception $e) |
|
212 | + protected function exception( \Exception $e ) |
|
213 | 213 | { |
214 | - if ($e->getCode() > 400) { |
|
214 | + if( $e->getCode() > 400 ) { |
|
215 | 215 | $name = \TYPO3\CMS\Frontend\Controller\ErrorController::class; |
216 | 216 | |
217 | - $response = GeneralUtility::makeInstance($name)->pageNotFoundAction( |
|
217 | + $response = GeneralUtility::makeInstance( $name )->pageNotFoundAction( |
|
218 | 218 | $this->request, $e->getMessage(), ['code' => $e->getCode()] |
219 | 219 | ); |
220 | - throw new \TYPO3\CMS\Core\Http\ImmediateResponseException($response); |
|
220 | + throw new \TYPO3\CMS\Core\Http\ImmediateResponseException( $response ); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | throw $e; |
@@ -229,24 +229,24 @@ discard block |
||
229 | 229 | */ |
230 | 230 | protected function removeMetatags() |
231 | 231 | { |
232 | - if (is_object($GLOBALS['TSFE']) && isset($GLOBALS['TSFE']->config['config'])) { |
|
232 | + if( is_object( $GLOBALS['TSFE'] ) && isset( $GLOBALS['TSFE']->config['config'] ) ) { |
|
233 | 233 | $GLOBALS['TSFE']->config['config']['disableCanonical'] = true; |
234 | 234 | $GLOBALS['TSFE']->config['config']['noPageTitle'] = 2; |
235 | 235 | } |
236 | 236 | |
237 | - if (class_exists('\TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry') |
|
238 | - && !\Aimeos\Aimeos\Base::getExtConfig('typo3Metatags', true) |
|
237 | + if( class_exists( '\TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry' ) |
|
238 | + && !\Aimeos\Aimeos\Base::getExtConfig( 'typo3Metatags', true ) |
|
239 | 239 | ) { |
240 | - $registry = GeneralUtility::makeInstance('TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry'); |
|
241 | - |
|
242 | - $registry->getManagerForProperty('keywords')->removeProperty('keywords'); |
|
243 | - $registry->getManagerForProperty('description')->removeProperty('description'); |
|
244 | - $registry->getManagerForProperty('og:type')->removeProperty('og:type'); |
|
245 | - $registry->getManagerForProperty('og:title')->removeProperty('og:title'); |
|
246 | - $registry->getManagerForProperty('og:url')->removeProperty('og:url'); |
|
247 | - $registry->getManagerForProperty('og:description')->removeProperty('og:description'); |
|
248 | - $registry->getManagerForProperty('og:image')->removeProperty('og:image'); |
|
249 | - $registry->getManagerForProperty('twitter:card')->removeProperty('twitter:card'); |
|
240 | + $registry = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry' ); |
|
241 | + |
|
242 | + $registry->getManagerForProperty( 'keywords' )->removeProperty( 'keywords' ); |
|
243 | + $registry->getManagerForProperty( 'description' )->removeProperty( 'description' ); |
|
244 | + $registry->getManagerForProperty( 'og:type' )->removeProperty( 'og:type' ); |
|
245 | + $registry->getManagerForProperty( 'og:title' )->removeProperty( 'og:title' ); |
|
246 | + $registry->getManagerForProperty( 'og:url' )->removeProperty( 'og:url' ); |
|
247 | + $registry->getManagerForProperty( 'og:description' )->removeProperty( 'og:description' ); |
|
248 | + $registry->getManagerForProperty( 'og:image' )->removeProperty( 'og:image' ); |
|
249 | + $registry->getManagerForProperty( 'twitter:card' )->removeProperty( 'twitter:card' ); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | } |
@@ -57,11 +57,14 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function detailAction() |
59 | 59 | { |
60 | - try { |
|
60 | + try |
|
61 | + { |
|
61 | 62 | $this->removeMetatags(); |
62 | 63 | $client = \Aimeos\Client\Html::create($this->context(), 'catalog/detail'); |
63 | 64 | return $this->getClientOutput($client); |
64 | - } catch(\Exception $e) { |
|
65 | + } |
|
66 | + catch(\Exception $e) |
|
67 | + { |
|
65 | 68 | $this->exception($e); |
66 | 69 | } |
67 | 70 | } |
@@ -194,10 +197,13 @@ discard block |
||
194 | 197 | */ |
195 | 198 | public function treeAction() |
196 | 199 | { |
197 | - try { |
|
200 | + try |
|
201 | + { |
|
198 | 202 | $client = \Aimeos\Client\Html::create($this->context(), 'catalog/tree'); |
199 | 203 | return $this->getClientOutput($client); |
200 | - } catch(\Exception $e) { |
|
204 | + } |
|
205 | + catch(\Exception $e) |
|
206 | + { |
|
201 | 207 | $this->exception($e); |
202 | 208 | } |
203 | 209 | } |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | public function detailAction() |
29 | 29 | { |
30 | 30 | $this->removeMetatags(); |
31 | - $client = \Aimeos\Client\Html::create($this->context(), 'supplier/detail'); |
|
32 | - return $this->getClientOutput($client); |
|
31 | + $client = \Aimeos\Client\Html::create( $this->context(), 'supplier/detail' ); |
|
32 | + return $this->getClientOutput( $client ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | */ |
39 | 39 | protected function removeMetatags() |
40 | 40 | { |
41 | - if (class_exists('\TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry') |
|
42 | - && !\Aimeos\Aimeos\Base::getExtConfig('typo3Metatags', true) |
|
41 | + if( class_exists( '\TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry' ) |
|
42 | + && !\Aimeos\Aimeos\Base::getExtConfig( 'typo3Metatags', true ) |
|
43 | 43 | ) { |
44 | - $registry = GeneralUtility::makeInstance('TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry'); |
|
45 | - |
|
46 | - $registry->getManagerForProperty('keywords')->removeProperty('keywords'); |
|
47 | - $registry->getManagerForProperty('description')->removeProperty('description'); |
|
48 | - $registry->getManagerForProperty('og:type')->removeProperty('og:type'); |
|
49 | - $registry->getManagerForProperty('og:title')->removeProperty('og:title'); |
|
50 | - $registry->getManagerForProperty('og:url')->removeProperty('og:url'); |
|
51 | - $registry->getManagerForProperty('og:description')->removeProperty('og:description'); |
|
52 | - $registry->getManagerForProperty('og:image')->removeProperty('og:image'); |
|
53 | - $registry->getManagerForProperty('twitter:card')->removeProperty('twitter:card'); |
|
44 | + $registry = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry' ); |
|
45 | + |
|
46 | + $registry->getManagerForProperty( 'keywords' )->removeProperty( 'keywords' ); |
|
47 | + $registry->getManagerForProperty( 'description' )->removeProperty( 'description' ); |
|
48 | + $registry->getManagerForProperty( 'og:type' )->removeProperty( 'og:type' ); |
|
49 | + $registry->getManagerForProperty( 'og:title' )->removeProperty( 'og:title' ); |
|
50 | + $registry->getManagerForProperty( 'og:url' )->removeProperty( 'og:url' ); |
|
51 | + $registry->getManagerForProperty( 'og:description' )->removeProperty( 'og:description' ); |
|
52 | + $registry->getManagerForProperty( 'og:image' )->removeProperty( 'og:image' ); |
|
53 | + $registry->getManagerForProperty( 'twitter:card' )->removeProperty( 'twitter:card' ); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function indexAction() |
28 | 28 | { |
29 | - $client = \Aimeos\Client\Html::create($this->context(), 'basket/standard'); |
|
30 | - return $this->getClientOutput($client); |
|
29 | + $client = \Aimeos\Client\Html::create( $this->context(), 'basket/standard' ); |
|
30 | + return $this->getClientOutput( $client ); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function bulkAction() |
38 | 38 | { |
39 | - $client = \Aimeos\Client\Html::create($this->context(), 'basket/bulk'); |
|
40 | - return $this->getClientOutput($client); |
|
39 | + $client = \Aimeos\Client\Html::create( $this->context(), 'basket/bulk' ); |
|
40 | + return $this->getClientOutput( $client ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function smallAction() |
48 | 48 | { |
49 | - $client = \Aimeos\Client\Html::create($this->context(), 'basket/mini'); |
|
50 | - return $this->getClientOutput($client); |
|
49 | + $client = \Aimeos\Client\Html::create( $this->context(), 'basket/mini' ); |
|
50 | + return $this->getClientOutput( $client ); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function relatedAction() |
58 | 58 | { |
59 | - $client = \Aimeos\Client\Html::create($this->context(), 'basket/related'); |
|
60 | - return $this->getClientOutput($client); |
|
59 | + $client = \Aimeos\Client\Html::create( $this->context(), 'basket/related' ); |
|
60 | + return $this->getClientOutput( $client ); |
|
61 | 61 | } |
62 | 62 | } |
@@ -30,26 +30,26 @@ discard block |
||
30 | 30 | { |
31 | 31 | $resource = $related = null; |
32 | 32 | |
33 | - if ($this->request->hasArgument('resource') |
|
34 | - && ($value = $this->request->getArgument('resource')) != '' |
|
33 | + if( $this->request->hasArgument( 'resource' ) |
|
34 | + && ( $value = $this->request->getArgument( 'resource' ) ) != '' |
|
35 | 35 | ) { |
36 | 36 | $resource = $value; |
37 | 37 | } |
38 | 38 | |
39 | - if ($this->request->hasArgument('related') |
|
40 | - && ($value = $this->request->getArgument('related')) != '' |
|
39 | + if( $this->request->hasArgument( 'related' ) |
|
40 | + && ( $value = $this->request->getArgument( 'related' ) ) != '' |
|
41 | 41 | ) { |
42 | 42 | $related = $value; |
43 | 43 | } |
44 | 44 | |
45 | - switch ($this->request->getMethod()) |
|
45 | + switch( $this->request->getMethod() ) |
|
46 | 46 | { |
47 | - case 'DELETE': return $this->deleteAction((string) $resource, $related); |
|
48 | - case 'PATCH': return $this->patchAction((string) $resource, $related); |
|
49 | - case 'POST': return $this->postAction((string) $resource, $related); |
|
50 | - case 'PUT': return $this->putAction((string) $resource, $related); |
|
51 | - case 'GET': return $this->getAction((string) $resource, $related); |
|
52 | - default: return $this->optionsAction($resource); |
|
47 | + case 'DELETE': return $this->deleteAction( (string) $resource, $related ); |
|
48 | + case 'PATCH': return $this->patchAction( (string) $resource, $related ); |
|
49 | + case 'POST': return $this->postAction( (string) $resource, $related ); |
|
50 | + case 'PUT': return $this->putAction( (string) $resource, $related ); |
|
51 | + case 'GET': return $this->getAction( (string) $resource, $related ); |
|
52 | + default: return $this->optionsAction( $resource ); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | * @param string|null Related resource, e.g. "product" |
62 | 62 | * @return string Generated output |
63 | 63 | */ |
64 | - public function deleteAction(string $resource, string $related = null) |
|
64 | + public function deleteAction( string $resource, string $related = null ) |
|
65 | 65 | { |
66 | - $response = $this->createClient($resource, $related)->delete($this->getPsrRequest(), (new Psr17Factory)->createResponse()); |
|
67 | - return $this->setPsrResponse($response); |
|
66 | + $response = $this->createClient( $resource, $related )->delete( $this->getPsrRequest(), ( new Psr17Factory )->createResponse() ); |
|
67 | + return $this->setPsrResponse( $response ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | * @param string|null Related resource, e.g. "product" |
76 | 76 | * @return string Generated output |
77 | 77 | */ |
78 | - public function getAction(string $resource, string $related = null) |
|
78 | + public function getAction( string $resource, string $related = null ) |
|
79 | 79 | { |
80 | - $response = $this->createClient($resource, $related)->get($this->getPsrRequest(), (new Psr17Factory)->createResponse()); |
|
81 | - return $this->setPsrResponse($response); |
|
80 | + $response = $this->createClient( $resource, $related )->get( $this->getPsrRequest(), ( new Psr17Factory )->createResponse() ); |
|
81 | + return $this->setPsrResponse( $response ); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * @param string|null Related resource, e.g. "product" |
90 | 90 | * @return string Generated output |
91 | 91 | */ |
92 | - public function patchAction(string $resource, string $related = null) |
|
92 | + public function patchAction( string $resource, string $related = null ) |
|
93 | 93 | { |
94 | - $response = $this->createClient($resource, $related)->patch($this->getPsrRequest(), (new Psr17Factory)->createResponse()); |
|
95 | - return $this->setPsrResponse($response); |
|
94 | + $response = $this->createClient( $resource, $related )->patch( $this->getPsrRequest(), ( new Psr17Factory )->createResponse() ); |
|
95 | + return $this->setPsrResponse( $response ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | * @param string|null Related resource, e.g. "product" |
104 | 104 | * @return string Generated output |
105 | 105 | */ |
106 | - public function postAction(string $resource, string $related = null) |
|
106 | + public function postAction( string $resource, string $related = null ) |
|
107 | 107 | { |
108 | - $response = $this->createClient($resource, $related)->post($this->getPsrRequest(), (new Psr17Factory)->createResponse()); |
|
109 | - return $this->setPsrResponse($response); |
|
108 | + $response = $this->createClient( $resource, $related )->post( $this->getPsrRequest(), ( new Psr17Factory )->createResponse() ); |
|
109 | + return $this->setPsrResponse( $response ); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | * @param string|null Related resource, e.g. "product" |
118 | 118 | * @return string Generated output |
119 | 119 | */ |
120 | - public function putAction(string $resource, string $related = null) |
|
120 | + public function putAction( string $resource, string $related = null ) |
|
121 | 121 | { |
122 | - $response = $this->createClient($resource, $related)->put($this->getPsrRequest(), (new Psr17Factory)->createResponse()); |
|
123 | - return $this->setPsrResponse($response); |
|
122 | + $response = $this->createClient( $resource, $related )->put( $this->getPsrRequest(), ( new Psr17Factory )->createResponse() ); |
|
123 | + return $this->setPsrResponse( $response ); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | * @param string Resource location, e.g. "product" |
131 | 131 | * @return string Generated output |
132 | 132 | */ |
133 | - public function optionsAction(string $resource = null) |
|
133 | + public function optionsAction( string $resource = null ) |
|
134 | 134 | { |
135 | - $response = $this->createClient($resource ?? '')->options($this->getPsrRequest(), (new Psr17Factory)->createResponse()); |
|
136 | - return $this->setPsrResponse($response); |
|
135 | + $response = $this->createClient( $resource ?? '' )->options( $this->getPsrRequest(), ( new Psr17Factory )->createResponse() ); |
|
136 | + return $this->setPsrResponse( $response ); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | * @param string|null Related resource, e.g. "product" |
145 | 145 | * @return \Aimeos\Client\JsonApi\Iface Jsonapi client |
146 | 146 | */ |
147 | - protected function createClient(string $resource, string $related = null) : \Aimeos\Client\JsonApi\Iface |
|
147 | + protected function createClient( string $resource, string $related = null ) : \Aimeos\Client\JsonApi\Iface |
|
148 | 148 | { |
149 | - $context = $this->context('client/jsonapi/templates'); |
|
150 | - return \Aimeos\Client\JsonApi::create($context, $resource . '/' . $related); |
|
149 | + $context = $this->context( 'client/jsonapi/templates' ); |
|
150 | + return \Aimeos\Client\JsonApi::create( $context, $resource . '/' . $related ); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -177,15 +177,15 @@ discard block |
||
177 | 177 | * @param \Psr\Http\Message\ResponseInterface $response PSR-7 response object |
178 | 178 | * @return string Generated output |
179 | 179 | */ |
180 | - protected function setPsrResponse(\Psr\Http\Message\ResponseInterface $response) |
|
180 | + protected function setPsrResponse( \Psr\Http\Message\ResponseInterface $response ) |
|
181 | 181 | { |
182 | - if (!isset($this->responseFactory)) // TYPO3 10 |
|
182 | + if( !isset( $this->responseFactory ) ) // TYPO3 10 |
|
183 | 183 | { |
184 | - $this->response->setStatus($response->getStatusCode()); |
|
184 | + $this->response->setStatus( $response->getStatusCode() ); |
|
185 | 185 | |
186 | - foreach ($response->getHeaders() as $key => $value) { |
|
187 | - foreach ((array) $value as $val) { |
|
188 | - $this->response->setHeader($key, $val); |
|
186 | + foreach( $response->getHeaders() as $key => $value ) { |
|
187 | + foreach( (array) $value as $val ) { |
|
188 | + $this->response->setHeader( $key, $val ); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 |
@@ -59,9 +59,11 @@ |
||
59 | 59 | */ |
60 | 60 | protected function setPsrResponse(\Psr\Http\Message\ResponseInterface $response) |
61 | 61 | { |
62 | - if (!isset($this->responseFactory)) // TYPO3 10 |
|
62 | + if (!isset($this->responseFactory)) { |
|
63 | + // TYPO3 10 |
|
63 | 64 | { |
64 | 65 | $this->response->setStatus($response->getStatusCode()); |
66 | + } |
|
65 | 67 | |
66 | 68 | foreach ($response->getHeaders() as $key => $value) { |
67 | 69 | foreach ((array) $value as $val) { |
@@ -23,25 +23,25 @@ discard block |
||
23 | 23 | * @param \Composer\Script\Event $event Event instance |
24 | 24 | * @throws \RuntimeException If an error occured |
25 | 25 | */ |
26 | - public static function install(\Composer\Script\Event $event) |
|
26 | + public static function install( \Composer\Script\Event $event ) |
|
27 | 27 | { |
28 | 28 | $repository = $event->getComposer()->getRepositoryManager()->getLocalRepository(); |
29 | 29 | |
30 | - if (($t3package = $repository->findPackage('aimeos/aimeos-typo3', '*')) === null) { |
|
31 | - throw new \RuntimeException('No installed package "aimeos/aimeos-typo3" found'); |
|
30 | + if( ( $t3package = $repository->findPackage( 'aimeos/aimeos-typo3', '*' ) ) === null ) { |
|
31 | + throw new \RuntimeException( 'No installed package "aimeos/aimeos-typo3" found' ); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $installer = $event->getComposer()->getInstallationManager(); |
35 | - $t3path = $installer->getInstallPath($t3package); |
|
35 | + $t3path = $installer->getInstallPath( $t3package ); |
|
36 | 36 | |
37 | - if (($package = $repository->findPackage('aimeos/ai-client-html', '*')) !== null) { |
|
38 | - $event->getIO()->write('Installing Aimeos public files from HTML client'); |
|
37 | + if( ( $package = $repository->findPackage( 'aimeos/ai-client-html', '*' ) ) !== null ) { |
|
38 | + $event->getIO()->write( 'Installing Aimeos public files from HTML client' ); |
|
39 | 39 | |
40 | - $path = $installer->getInstallPath($package); |
|
41 | - self::copyRecursive($path . '/client/html/themes', $t3path . '/Resources/Public/Themes'); |
|
40 | + $path = $installer->getInstallPath( $package ); |
|
41 | + self::copyRecursive( $path . '/client/html/themes', $t3path . '/Resources/Public/Themes' ); |
|
42 | 42 | } |
43 | 43 | |
44 | - self::join($event); |
|
44 | + self::join( $event ); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -52,24 +52,24 @@ discard block |
||
52 | 52 | * @param string $dest Target directory path |
53 | 53 | * @throws \RuntimeException If an error occured |
54 | 54 | */ |
55 | - protected static function copyRecursive(string $src, string $dest) |
|
55 | + protected static function copyRecursive( string $src, string $dest ) |
|
56 | 56 | { |
57 | - self::createDirectory($dest); |
|
57 | + self::createDirectory( $dest ); |
|
58 | 58 | |
59 | 59 | $iterator = new \RecursiveIteratorIterator( |
60 | - new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
60 | + new \RecursiveDirectoryIterator( $src, \RecursiveDirectoryIterator::SKIP_DOTS ), |
|
61 | 61 | \RecursiveIteratorIterator::SELF_FIRST |
62 | 62 | ); |
63 | 63 | |
64 | - foreach ($iterator as $item) { |
|
64 | + foreach( $iterator as $item ) { |
|
65 | 65 | $target = $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName(); |
66 | 66 | |
67 | - if ($item->isDir() === false) { |
|
68 | - if (copy($item, $target) === false) { |
|
69 | - throw new \RuntimeException(sprintf('Unable to copy file "%1$s"', $item)); |
|
67 | + if( $item->isDir() === false ) { |
|
68 | + if( copy( $item, $target ) === false ) { |
|
69 | + throw new \RuntimeException( sprintf( 'Unable to copy file "%1$s"', $item ) ); |
|
70 | 70 | } |
71 | 71 | } else { |
72 | - self::createDirectory($target); |
|
72 | + self::createDirectory( $target ); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | * @param string $dir Absolute path of the new directory |
82 | 82 | * @throws \RuntimeException If directory couldn't be created |
83 | 83 | */ |
84 | - protected static function createDirectory(string $dir) |
|
84 | + protected static function createDirectory( string $dir ) |
|
85 | 85 | { |
86 | 86 | $perm = 0755; |
87 | 87 | |
88 | - if (is_dir($dir) === false && mkdir($dir, $perm, true) === false) { |
|
88 | + if( is_dir( $dir ) === false && mkdir( $dir, $perm, true ) === false ) { |
|
89 | 89 | $msg = 'Unable to create directory "%1$s" with permission "%2$s"'; |
90 | - throw new \RuntimeException(sprintf($msg, $dir, $perm)); |
|
90 | + throw new \RuntimeException( sprintf( $msg, $dir, $perm ) ); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | * @param Event $event Event instance |
99 | 99 | * @throws \RuntimeException If an error occured |
100 | 100 | */ |
101 | - protected static function join(\Composer\Script\Event $event) |
|
101 | + protected static function join( \Composer\Script\Event $event ) |
|
102 | 102 | { |
103 | 103 | try { |
104 | - if (!$event->getIO()->hasAuthentication('github.com')) { |
|
104 | + if( !$event->getIO()->hasAuthentication( 'github.com' ) ) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
@@ -109,25 +109,25 @@ discard block |
||
109 | 109 | 'http' => [ |
110 | 110 | 'method' => 'POST', |
111 | 111 | 'header' => ['Content-Type: application/json'], |
112 | - 'content' => json_encode(['query' => 'mutation{ |
|
112 | + 'content' => json_encode( ['query' => 'mutation{ |
|
113 | 113 | _1: addStar(input:{clientMutationId:"_1",starrableId:"MDEwOlJlcG9zaXRvcnkxMDMwMTUwNzA="}){clientMutationId} |
114 | 114 | _2: addStar(input:{clientMutationId:"_2",starrableId:"MDEwOlJlcG9zaXRvcnkzMTU0MTIxMA=="}){clientMutationId} |
115 | 115 | _3: addStar(input:{clientMutationId:"_3",starrableId:"MDEwOlJlcG9zaXRvcnkyNjg4MTc2NQ=="}){clientMutationId} |
116 | 116 | _4: addStar(input:{clientMutationId:"_4",starrableId:"MDEwOlJlcG9zaXRvcnkyMjIzNTY4OTA="}){clientMutationId} |
117 | 117 | _5: addStar(input:{clientMutationId:"_5",starrableId:"R_kgDOG1PAJw"}){clientMutationId} |
118 | 118 | }' |
119 | - ]) |
|
119 | + ] ) |
|
120 | 120 | ] |
121 | 121 | ]; |
122 | 122 | $config = $event->getComposer()->config(); |
123 | 123 | |
124 | - if (method_exists('\Composer\Factory', 'createHttpDownloader')) { |
|
125 | - \Composer\Factory::createHttpDownloader($event->getIO(), $config) |
|
126 | - ->get('https://api.github.com/graphql', $options); |
|
124 | + if( method_exists( '\Composer\Factory', 'createHttpDownloader' ) ) { |
|
125 | + \Composer\Factory::createHttpDownloader( $event->getIO(), $config ) |
|
126 | + ->get( 'https://api.github.com/graphql', $options ); |
|
127 | 127 | } else { |
128 | - \Composer\Factory::createRemoteFilesystem($event->getIO(), $config) |
|
129 | - ->getContents('github.com', 'https://api.github.com/graphql', false, $options); |
|
128 | + \Composer\Factory::createRemoteFilesystem( $event->getIO(), $config ) |
|
129 | + ->getContents( 'github.com', 'https://api.github.com/graphql', false, $options ); |
|
130 | 130 | } |
131 | - } catch(\Exception $e) {} |
|
131 | + } catch( \Exception $e ) {} |
|
132 | 132 | } |
133 | 133 | } |
@@ -100,7 +100,8 @@ discard block |
||
100 | 100 | */ |
101 | 101 | protected static function join(\Composer\Script\Event $event) |
102 | 102 | { |
103 | - try { |
|
103 | + try |
|
104 | + { |
|
104 | 105 | if (!$event->getIO()->hasAuthentication('github.com')) { |
105 | 106 | return; |
106 | 107 | } |
@@ -128,6 +129,9 @@ discard block |
||
128 | 129 | \Composer\Factory::createRemoteFilesystem($event->getIO(), $config) |
129 | 130 | ->getContents('github.com', 'https://api.github.com/graphql', false, $options); |
130 | 131 | } |
131 | - } catch(\Exception $e) {} |
|
132 | + } |
|
133 | + catch(\Exception $e) |
|
134 | + { |
|
135 | +} |
|
132 | 136 | } |
133 | 137 | } |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | protected function configure() |
36 | 36 | { |
37 | - $this->setName(self::$defaultName); |
|
38 | - $this->setDescription('Executes the job controllers'); |
|
39 | - $this->addArgument('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"'); |
|
40 | - $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)'); |
|
41 | - $this->addOption('pid', null, InputOption::VALUE_REQUIRED, 'Page ID of the catalog detail page for jobs generating URLs'); |
|
37 | + $this->setName( self::$defaultName ); |
|
38 | + $this->setDescription( 'Executes the job controllers' ); |
|
39 | + $this->addArgument( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' ); |
|
40 | + $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' ); |
|
41 | + $this->addOption( 'pid', null, InputOption::VALUE_REQUIRED, 'Page ID of the catalog detail page for jobs generating URLs' ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -48,39 +48,39 @@ discard block |
||
48 | 48 | * @param InputInterface $input Input object |
49 | 49 | * @param OutputInterface $output Output object |
50 | 50 | */ |
51 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
51 | + protected function execute( InputInterface $input, OutputInterface $output ) |
|
52 | 52 | { |
53 | - $context = $this->context($input->getOption('pid')); |
|
53 | + $context = $this->context( $input->getOption( 'pid' ) ); |
|
54 | 54 | $process = $context->process(); |
55 | 55 | |
56 | 56 | $aimeos = \Aimeos\Aimeos\Base::aimeos(); |
57 | - $jobs = explode(' ', $input->getArgument('jobs')); |
|
58 | - $localeManager = \Aimeos\MShop::create($context, 'locale'); |
|
57 | + $jobs = explode( ' ', $input->getArgument( 'jobs' ) ); |
|
58 | + $localeManager = \Aimeos\MShop::create( $context, 'locale' ); |
|
59 | 59 | |
60 | - foreach ($this->getSiteItems($context, $input) as $siteItem) { |
|
61 | - $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
62 | - $localeItem->setLanguageId(null); |
|
63 | - $localeItem->setCurrencyId(null); |
|
64 | - $context->setLocale($localeItem); |
|
60 | + foreach( $this->getSiteItems( $context, $input ) as $siteItem ) { |
|
61 | + $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
62 | + $localeItem->setLanguageId( null ); |
|
63 | + $localeItem->setCurrencyId( null ); |
|
64 | + $context->setLocale( $localeItem ); |
|
65 | 65 | |
66 | 66 | $config = $context->config(); |
67 | - foreach ($localeItem->getSiteItem()->getConfig() as $key => $value) { |
|
68 | - $config->set($key, $value); |
|
67 | + foreach( $localeItem->getSiteItem()->getConfig() as $key => $value ) { |
|
68 | + $config->set( $key, $value ); |
|
69 | 69 | } |
70 | 70 | |
71 | - $output->writeln(sprintf('Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode())); |
|
71 | + $output->writeln( sprintf( 'Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode() ) ); |
|
72 | 72 | |
73 | 73 | // Reset before child processes are spawned to avoid lost DB connections afterwards (TYPO3 9.4 and above) |
74 | - if (method_exists('\TYPO3\CMS\Core\Database\ConnectionPool', 'resetConnections')) { |
|
75 | - GeneralUtility::makeInstance('TYPO3\CMS\Core\Database\ConnectionPool')->resetConnections(); |
|
74 | + if( method_exists( '\TYPO3\CMS\Core\Database\ConnectionPool', 'resetConnections' ) ) { |
|
75 | + GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Database\ConnectionPool' )->resetConnections(); |
|
76 | 76 | } |
77 | 77 | |
78 | - foreach ($jobs as $jobname) { |
|
79 | - $fcn = function($context, $aimeos, $jobname) { |
|
80 | - \Aimeos\Controller\Jobs::create($context, $aimeos, $jobname)->run(); |
|
78 | + foreach( $jobs as $jobname ) { |
|
79 | + $fcn = function( $context, $aimeos, $jobname ) { |
|
80 | + \Aimeos\Controller\Jobs::create( $context, $aimeos, $jobname )->run(); |
|
81 | 81 | }; |
82 | 82 | |
83 | - $process->start($fcn, [$context, $aimeos, $jobname], true); |
|
83 | + $process->start( $fcn, [$context, $aimeos, $jobname], true ); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
@@ -96,27 +96,27 @@ discard block |
||
96 | 96 | * @param string|null $pid Page ID if available |
97 | 97 | * @return \Aimeos\MShop\ContextIface Context object containing only the most necessary dependencies |
98 | 98 | */ |
99 | - protected function context(?string $pid) : \Aimeos\MShop\ContextIface |
|
99 | + protected function context( ?string $pid ) : \Aimeos\MShop\ContextIface |
|
100 | 100 | { |
101 | 101 | $aimeos = \Aimeos\Aimeos\Base::aimeos(); |
102 | - $tmplPaths = $aimeos->getTemplatePaths('controller/jobs/templates'); |
|
102 | + $tmplPaths = $aimeos->getTemplatePaths( 'controller/jobs/templates' ); |
|
103 | 103 | |
104 | 104 | $config = \Aimeos\Aimeos\Base::config(); |
105 | - $context = \Aimeos\Aimeos\Base::context($config); |
|
105 | + $context = \Aimeos\Aimeos\Base::context( $config ); |
|
106 | 106 | |
107 | - $langManager = \Aimeos\MShop::create($context, 'locale/language'); |
|
108 | - $langids = $langManager->search($langManager->filter(true))->keys()->toArray(); |
|
107 | + $langManager = \Aimeos\MShop::create( $context, 'locale/language' ); |
|
108 | + $langids = $langManager->search( $langManager->filter( true ) )->keys()->toArray(); |
|
109 | 109 | |
110 | - $i18n = \Aimeos\Aimeos\Base::i18n($langids, $config->get('i18n', [])); |
|
111 | - $context->setI18n($i18n); |
|
110 | + $i18n = \Aimeos\Aimeos\Base::i18n( $langids, $config->get( 'i18n', [] ) ); |
|
111 | + $context->setI18n( $i18n ); |
|
112 | 112 | |
113 | - $view = \Aimeos\Aimeos\Base::view($context, $this->getRouter($pid), $tmplPaths); |
|
114 | - $context->setView($view); |
|
113 | + $view = \Aimeos\Aimeos\Base::view( $context, $this->getRouter( $pid ), $tmplPaths ); |
|
114 | + $context->setView( $view ); |
|
115 | 115 | |
116 | - $context->setSession(new \Aimeos\Base\Session\None()); |
|
117 | - $context->setCache(new \Aimeos\Base\Cache\None()); |
|
116 | + $context->setSession( new \Aimeos\Base\Session\None() ); |
|
117 | + $context->setCache( new \Aimeos\Base\Cache\None() ); |
|
118 | 118 | |
119 | - return $context->setEditor('aimeos:jobs'); |
|
119 | + return $context->setEditor( 'aimeos:jobs' ); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -127,16 +127,16 @@ discard block |
||
127 | 127 | * @param InputInterface $input Input object |
128 | 128 | * @return \Aimeos\Map List of site items implementing \Aimeos\MShop\Locale\Item\Site\Iface |
129 | 129 | */ |
130 | - protected function getSiteItems(\Aimeos\MShop\ContextIface $context, InputInterface $input) : \Aimeos\Map |
|
130 | + protected function getSiteItems( \Aimeos\MShop\ContextIface $context, InputInterface $input ) : \Aimeos\Map |
|
131 | 131 | { |
132 | - $manager = \Aimeos\MShop::create($context, 'locale/site'); |
|
132 | + $manager = \Aimeos\MShop::create( $context, 'locale/site' ); |
|
133 | 133 | $search = $manager->filter(); |
134 | 134 | |
135 | - if (($codes = (string) $input->getArgument('site')) !== '') { |
|
136 | - $search->setConditions($search->compare('==', 'locale.site.code', explode(' ', $codes))); |
|
135 | + if( ( $codes = (string) $input->getArgument( 'site' ) ) !== '' ) { |
|
136 | + $search->setConditions( $search->compare( '==', 'locale.site.code', explode( ' ', $codes ) ) ); |
|
137 | 137 | } |
138 | 138 | |
139 | - return $manager->search($search); |
|
139 | + return $manager->search( $search ); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | * @return \TYPO3\CMS\Core\Routing\RouterInterface Page router |
148 | 148 | * @throws \RuntimeException If no site configuraiton is available |
149 | 149 | */ |
150 | - protected function getRouter(?string $pid) : \TYPO3\CMS\Core\Routing\RouterInterface |
|
150 | + protected function getRouter( ?string $pid ) : \TYPO3\CMS\Core\Routing\RouterInterface |
|
151 | 151 | { |
152 | - $siteFinder = GeneralUtility::makeInstance(SiteFinder::class); |
|
153 | - $site = $pid ? $siteFinder->getSiteByPageId($pid) : current($siteFinder->getAllSites()); |
|
152 | + $siteFinder = GeneralUtility::makeInstance( SiteFinder::class ); |
|
153 | + $site = $pid ? $siteFinder->getSiteByPageId( $pid ) : current( $siteFinder->getAllSites() ); |
|
154 | 154 | |
155 | - if ($site) { |
|
155 | + if( $site ) { |
|
156 | 156 | return $site->getRouter(); |
157 | 157 | } |
158 | 158 | |
159 | - throw new \RuntimeException('No site configuration found'); |
|
159 | + throw new \RuntimeException( 'No site configuration found' ); |
|
160 | 160 | } |
161 | 161 | } |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | */ |
30 | 30 | protected function configure() |
31 | 31 | { |
32 | - $this->setName('aimeos:setup'); |
|
33 | - $this->setDescription('Initialize or update the Aimeos database tables'); |
|
34 | - $this->addArgument('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'); |
|
35 | - $this->addArgument('tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default'); |
|
36 | - $this->addOption('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', []); |
|
37 | - $this->addOption('v', null, InputOption::VALUE_OPTIONAL, 'Verbosity level, "v", "vv" or "vvv"', 'vv'); |
|
38 | - $this->addOption('q', null, InputOption::VALUE_NONE, 'Quiet mode without any output'); |
|
32 | + $this->setName( 'aimeos:setup' ); |
|
33 | + $this->setDescription( 'Initialize or update the Aimeos database tables' ); |
|
34 | + $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ); |
|
35 | + $this->addArgument( 'tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default' ); |
|
36 | + $this->addOption( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', [] ); |
|
37 | + $this->addOption( 'v', null, InputOption::VALUE_OPTIONAL, 'Verbosity level, "v", "vv" or "vvv"', 'vv' ); |
|
38 | + $this->addOption( 'q', null, InputOption::VALUE_NONE, 'Quiet mode without any output' ); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -45,24 +45,24 @@ discard block |
||
45 | 45 | * @param InputInterface $input Input object |
46 | 46 | * @param OutputInterface $output Output object |
47 | 47 | */ |
48 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
48 | + protected function execute( InputInterface $input, OutputInterface $output ) |
|
49 | 49 | { |
50 | - \Aimeos\MShop::cache(false); |
|
51 | - \Aimeos\MAdmin::cache(false); |
|
50 | + \Aimeos\MShop::cache( false ); |
|
51 | + \Aimeos\MAdmin::cache( false ); |
|
52 | 52 | |
53 | - $site = $input->getArgument('site'); |
|
54 | - $template = $input->getArgument('tplsite'); |
|
53 | + $site = $input->getArgument( 'site' ); |
|
54 | + $template = $input->getArgument( 'tplsite' ); |
|
55 | 55 | |
56 | 56 | $config = \Aimeos\Aimeos\Base::config(); |
57 | 57 | $boostrap = \Aimeos\Aimeos\Base::aimeos(); |
58 | - $ctx = \Aimeos\Aimeos\Base::context($config)->setEditor('aimeos:setup'); |
|
58 | + $ctx = \Aimeos\Aimeos\Base::context( $config )->setEditor( 'aimeos:setup' ); |
|
59 | 59 | |
60 | - $output->writeln(sprintf('Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site)); |
|
60 | + $output->writeln( sprintf( 'Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site ) ); |
|
61 | 61 | |
62 | - \Aimeos\Setup::use($boostrap) |
|
63 | - ->context($this->addConfig($ctx->setEditor('aimeos:setup'), $input->getOption('option'))) |
|
64 | - ->verbose($input->getOption('q') ? '' : $input->getOption('v')) |
|
65 | - ->up($site, $template); |
|
62 | + \Aimeos\Setup::use( $boostrap ) |
|
63 | + ->context( $this->addConfig( $ctx->setEditor( 'aimeos:setup' ), $input->getOption( 'option' ) ) ) |
|
64 | + ->verbose( $input->getOption( 'q' ) ? '' : $input->getOption( 'v' ) ) |
|
65 | + ->up( $site, $template ); |
|
66 | 66 | |
67 | 67 | return 0; |
68 | 68 | } |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | * @param \Aimeos\MShop\ContextIface $ctx Context object |
76 | 76 | * @return array Associative list of key/value pairs of configuration options |
77 | 77 | */ |
78 | - protected function addConfig(\Aimeos\MShop\ContextIface $ctx, $options) : \Aimeos\MShop\ContextIface |
|
78 | + protected function addConfig( \Aimeos\MShop\ContextIface $ctx, $options ) : \Aimeos\MShop\ContextIface |
|
79 | 79 | { |
80 | 80 | $config = $ctx->config(); |
81 | 81 | |
82 | - foreach ((array) $options as $option) { |
|
83 | - list($name, $value) = explode(':', $option); |
|
84 | - $config->set($name, $value); |
|
82 | + foreach( (array) $options as $option ) { |
|
83 | + list( $name, $value ) = explode( ':', $option ); |
|
84 | + $config->set( $name, $value ); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | return $ctx; |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -defined('TYPO3') or die(); |
|
3 | +defined( 'TYPO3' ) or die(); |
|
4 | 4 | |
5 | 5 | |
6 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('aimeos', 'Configuration/TypoScript/', 'Aimeos Shop configuration'); |
|
6 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile( 'aimeos', 'Configuration/TypoScript/', 'Aimeos Shop configuration' ); |
|
7 | 7 | |
8 | 8 | |
9 | 9 | ?> |
10 | 10 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -defined('TYPO3') or die(); |
|
3 | +defined( 'TYPO3' ) or die(); |
|
4 | 4 | |
5 | 5 | |
6 | 6 | $beUsersSiteFcn = function() { |
@@ -9,44 +9,44 @@ discard block |
||
9 | 9 | |
10 | 10 | try { |
11 | 11 | $config = \Aimeos\Aimeos\Base::config(); |
12 | - $context = \Aimeos\Aimeos\Base::context($config); |
|
12 | + $context = \Aimeos\Aimeos\Base::context( $config ); |
|
13 | 13 | |
14 | - $result = $context->db('db-locale')->create('SELECT * FROM "mshop_locale_site" ORDER BY "nleft"')->execute(); |
|
14 | + $result = $context->db( 'db-locale' )->create( 'SELECT * FROM "mshop_locale_site" ORDER BY "nleft"' )->execute(); |
|
15 | 15 | $parents = []; |
16 | 16 | |
17 | - $fcn = function($result, $parents, $right) use (&$fcn, &$list) { |
|
17 | + $fcn = function( $result, $parents, $right ) use ( &$fcn, &$list ) { |
|
18 | 18 | |
19 | - while ($row = $result->fetch()) { |
|
20 | - $list[] = [join(' > ', array_merge($parents, [$row['label']])), $row['siteid']]; |
|
19 | + while( $row = $result->fetch() ) { |
|
20 | + $list[] = [join( ' > ', array_merge( $parents, [$row['label']] ) ), $row['siteid']]; |
|
21 | 21 | |
22 | - if ($row['nright'] - $row['nleft'] > 1) { |
|
23 | - $fcn($result, array_merge($parents, [$row['label']]), $row['nright']); |
|
22 | + if( $row['nright'] - $row['nleft'] > 1 ) { |
|
23 | + $fcn( $result, array_merge( $parents, [$row['label']] ), $row['nright'] ); |
|
24 | 24 | } |
25 | 25 | |
26 | - if ($row['nright'] + 1 == $right) { |
|
26 | + if( $row['nright'] + 1 == $right ) { |
|
27 | 27 | return; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | }; |
31 | 31 | |
32 | - while ($row = $result->fetch()) { |
|
32 | + while( $row = $result->fetch() ) { |
|
33 | 33 | $list[] = [$row['label'], $row['siteid']]; |
34 | 34 | |
35 | - if ($row['nright'] - $row['nleft'] > 1) { |
|
36 | - $fcn($result, array_merge($parents, [$row['label']]), $row['nright']); |
|
35 | + if( $row['nright'] - $row['nleft'] > 1 ) { |
|
36 | + $fcn( $result, array_merge( $parents, [$row['label']] ), $row['nright'] ); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | } |
40 | - catch(\Exception $e) { |
|
41 | - $log = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class); |
|
42 | - $log->getLogger(__CLASS__)->warning('Unable to retrieve Aimeos sites: ' . $e->getMessage()); |
|
40 | + catch( \Exception $e ) { |
|
41 | + $log = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( \TYPO3\CMS\Core\Log\LogManager::class ); |
|
42 | + $log->getLogger( __CLASS__ )->warning( 'Unable to retrieve Aimeos sites: ' . $e->getMessage() ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | return $list; |
46 | 46 | }; |
47 | 47 | |
48 | 48 | |
49 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('be_users', [ |
|
49 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns( 'be_users', [ |
|
50 | 50 | 'siteid' => [ |
51 | 51 | 'label' => 'LLL:EXT:aimeos/Resources/Private/Language/admin.xlf:beusers_site.title', |
52 | 52 | 'config' => [ |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'items' => $beUsersSiteFcn(), |
56 | 56 | ] |
57 | 57 | ] |
58 | -]); |
|
58 | +] ); |
|
59 | 59 | |
60 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('be_users', 'siteid', '', 'after:password'); |
|
60 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( 'be_users', 'siteid', '', 'after:password' ); |
|
61 | 61 |
@@ -7,7 +7,8 @@ discard block |
||
7 | 7 | |
8 | 8 | $list = [['', '']]; |
9 | 9 | |
10 | - try { |
|
10 | + try |
|
11 | + { |
|
11 | 12 | $config = \Aimeos\Aimeos\Base::config(); |
12 | 13 | $context = \Aimeos\Aimeos\Base::context($config); |
13 | 14 | |
@@ -37,7 +38,8 @@ discard block |
||
37 | 38 | } |
38 | 39 | } |
39 | 40 | } |
40 | - catch(\Exception $e) { |
|
41 | + catch(\Exception $e) |
|
42 | + { |
|
41 | 43 | $log = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class); |
42 | 44 | $log->getLogger(__CLASS__)->warning('Unable to retrieve Aimeos sites: ' . $e->getMessage()); |
43 | 45 | } |