Completed
Push — master ( 5b2742...9e7f7e )
by Aimeos
02:35
created
Service/View.php 2 patches
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @param RequestStack $requestStack Current request stack
33 33
 	 * @param Container $container Container object to access parameters
34 34
 	 */
35
-	public function __construct( RequestStack $requestStack, Container $container )
35
+	public function __construct(RequestStack $requestStack, Container $container)
36 36
 	{
37 37
 		$this->requestStack = $requestStack;
38 38
 		$this->container = $container;
@@ -47,20 +47,20 @@  discard block
 block discarded – undo
47 47
 	 * @param string|null $locale Code of the current language or null for no translation
48 48
 	 * @return \Aimeos\MW\View\Iface View object
49 49
 	 */
50
-	public function create( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null )
50
+	public function create(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null)
51 51
 	{
52 52
 		$config = $context->getConfig();
53
-		$view = new \Aimeos\MW\View\Standard( $templatePaths );
54
-
55
-		$this->addCsrf( $view );
56
-		$this->addAccess( $view, $context );
57
-		$this->addConfig( $view, $config );
58
-		$this->addNumber( $view, $config );
59
-		$this->addParam( $view );
60
-		$this->addRequest( $view );
61
-		$this->addResponse( $view );
62
-		$this->addTranslate( $view, $locale );
63
-		$this->addUrl( $view );
53
+		$view = new \Aimeos\MW\View\Standard($templatePaths);
54
+
55
+		$this->addCsrf($view);
56
+		$this->addAccess($view, $context);
57
+		$this->addConfig($view, $config);
58
+		$this->addNumber($view, $config);
59
+		$this->addParam($view);
60
+		$this->addRequest($view);
61
+		$this->addResponse($view);
62
+		$this->addTranslate($view, $locale);
63
+		$this->addUrl($view);
64 64
 
65 65
 		return $view;
66 66
 	}
@@ -73,26 +73,26 @@  discard block
 block discarded – undo
73 73
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
74 74
 	 * @return \Aimeos\MW\View\Iface Modified view object
75 75
 	 */
76
-	protected function addAccess( \Aimeos\MW\View\Iface $view, \Aimeos\MShop\Context\Item\Iface $context )
76
+	protected function addAccess(\Aimeos\MW\View\Iface $view, \Aimeos\MShop\Context\Item\Iface $context)
77 77
 	{
78 78
 		$container = $this->container;
79
-		$token = $this->container->get( 'security.token_storage' )->getToken();
79
+		$token = $this->container->get('security.token_storage')->getToken();
80 80
 
81
-		if( is_object( $token ) && is_object( $token->getUser() )
82
-			&& in_array( 'ROLE_ADMIN', (array) $token->getUser()->getRoles() ) )
81
+		if (is_object($token) && is_object($token->getUser())
82
+			&& in_array('ROLE_ADMIN', (array) $token->getUser()->getRoles()))
83 83
 		{
84
-			$helper = new \Aimeos\MW\View\Helper\Access\All( $view );
84
+			$helper = new \Aimeos\MW\View\Helper\Access\All($view);
85 85
 		}
86 86
 		else
87 87
 		{
88
-			$fcn = function() use ( $container, $context ) {
89
-				return $container->get( 'aimeos_support' )->getGroups( $context );
88
+			$fcn = function() use ($container, $context) {
89
+				return $container->get('aimeos_support')->getGroups($context);
90 90
 			};
91 91
 
92
-			$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $fcn );
92
+			$helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $fcn);
93 93
 		}
94 94
 
95
-		$view->addHelper( 'access', $helper );
95
+		$view->addHelper('access', $helper);
96 96
 
97 97
 		return $view;
98 98
 	}
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 	 * @param \Aimeos\MW\Config\Iface $config Configuration object
106 106
 	 * @return \Aimeos\MW\View\Iface Modified view object
107 107
 	 */
108
-	protected function addConfig( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config )
108
+	protected function addConfig(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config)
109 109
 	{
110
-		$config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) );
111
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
112
-		$view->addHelper( 'config', $helper );
110
+		$config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client'));
111
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
112
+		$view->addHelper('config', $helper);
113 113
 
114 114
 		return $view;
115 115
 	}
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
 	 * @param \Aimeos\MW\View\Iface $view View object
122 122
 	 * @return \Aimeos\MW\View\Iface Modified view object
123 123
 	 */
124
-	protected function addCsrf( \Aimeos\MW\View\Iface $view )
124
+	protected function addCsrf(\Aimeos\MW\View\Iface $view)
125 125
 	{
126
-		$token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' );
127
-		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() );
128
-		$view->addHelper( 'csrf', $helper );
126
+		$token = $this->container->get('security.csrf.token_manager')->getToken('_token');
127
+		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', $token->getValue());
128
+		$view->addHelper('csrf', $helper);
129 129
 
130 130
 		return $view;
131 131
 	}
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 	 * @param \Aimeos\MW\Config\Iface $config Configuration object
139 139
 	 * @return \Aimeos\MW\View\Iface Modified view object
140 140
 	 */
141
-	protected function addNumber( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config )
141
+	protected function addNumber(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config)
142 142
 	{
143
-		$sepDec = $config->get( 'client/html/common/format/separatorDecimal', '.' );
144
-		$sep1000 = $config->get( 'client/html/common/format/separator1000', ' ' );
145
-		$decimals = $config->get( 'client/html/common/format/decimals', 2 );
143
+		$sepDec = $config->get('client/html/common/format/separatorDecimal', '.');
144
+		$sep1000 = $config->get('client/html/common/format/separator1000', ' ');
145
+		$decimals = $config->get('client/html/common/format/decimals', 2);
146 146
 
147
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000, $decimals );
148
-		$view->addHelper( 'number', $helper );
147
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000, $decimals);
148
+		$view->addHelper('number', $helper);
149 149
 
150 150
 		return $view;
151 151
 	}
@@ -157,17 +157,17 @@  discard block
 block discarded – undo
157 157
 	 * @param \Aimeos\MW\View\Iface $view View object
158 158
 	 * @return \Aimeos\MW\View\Iface Modified view object
159 159
 	 */
160
-	protected function addParam( \Aimeos\MW\View\Iface $view )
160
+	protected function addParam(\Aimeos\MW\View\Iface $view)
161 161
 	{
162 162
 		$params = array();
163 163
 		$request = $this->requestStack->getMasterRequest();
164 164
 
165
-		if( $request !== null ) {
166
-			$params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' );
165
+		if ($request !== null) {
166
+			$params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params');
167 167
 		}
168 168
 
169
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
170
-		$view->addHelper( 'param', $helper );
169
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params);
170
+		$view->addHelper('param', $helper);
171 171
 
172 172
 		return $view;
173 173
 	}
@@ -179,14 +179,14 @@  discard block
 block discarded – undo
179 179
 	 * @param \Aimeos\MW\View\Iface $view View object
180 180
 	 * @return \Aimeos\MW\View\Iface Modified view object
181 181
 	 */
182
-	protected function addRequest( \Aimeos\MW\View\Iface $view )
182
+	protected function addRequest(\Aimeos\MW\View\Iface $view)
183 183
 	{
184 184
 		$request = $this->requestStack->getMasterRequest();
185 185
 
186
-		if( $request !== null )
186
+		if ($request !== null)
187 187
 		{
188
-			$helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request );
189
-			$view->addHelper( 'request', $helper );
188
+			$helper = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request);
189
+			$view->addHelper('request', $helper);
190 190
 		}
191 191
 
192 192
 		return $view;
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 	 * @param \Aimeos\MW\View\Iface $view View object
200 200
 	 * @return \Aimeos\MW\View\Iface Modified view object
201 201
 	 */
202
-	protected function addResponse( \Aimeos\MW\View\Iface $view )
202
+	protected function addResponse(\Aimeos\MW\View\Iface $view)
203 203
 	{
204
-		$helper = new \Aimeos\MW\View\Helper\Response\Symfony2( $view );
205
-		$view->addHelper( 'response', $helper );
204
+		$helper = new \Aimeos\MW\View\Helper\Response\Symfony2($view);
205
+		$view->addHelper('response', $helper);
206 206
 
207 207
 		return $view;
208 208
 	}
@@ -215,20 +215,20 @@  discard block
 block discarded – undo
215 215
 	 * @param string|null $locale ISO language code, e.g. "de" or "de_CH"
216 216
 	 * @return \Aimeos\MW\View\Iface Modified view object
217 217
 	 */
218
-	protected function addTranslate( \Aimeos\MW\View\Iface $view, $locale )
218
+	protected function addTranslate(\Aimeos\MW\View\Iface $view, $locale)
219 219
 	{
220
-		if( $locale !== null )
220
+		if ($locale !== null)
221 221
 		{
222
-			$i18n = $this->container->get( 'aimeos_i18n' )->get( array( $locale ) );
222
+			$i18n = $this->container->get('aimeos_i18n')->get(array($locale));
223 223
 			$translation = $i18n[$locale];
224 224
 		}
225 225
 		else
226 226
 		{
227
-			$translation = new \Aimeos\MW\Translation\None( 'en' );
227
+			$translation = new \Aimeos\MW\Translation\None('en');
228 228
 		}
229 229
 
230
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation );
231
-		$view->addHelper( 'translate', $helper );
230
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation);
231
+		$view->addHelper('translate', $helper);
232 232
 
233 233
 		return $view;
234 234
 	}
@@ -240,30 +240,30 @@  discard block
 block discarded – undo
240 240
 	 * @param \Aimeos\MW\View\Iface $view View object
241 241
 	 * @return \Aimeos\MW\View\Iface Modified view object
242 242
 	 */
243
-	protected function addUrl( \Aimeos\MW\View\Iface $view )
243
+	protected function addUrl(\Aimeos\MW\View\Iface $view)
244 244
 	{
245 245
 		$fixed = array();
246 246
 		$request = $this->requestStack->getMasterRequest();
247 247
 
248
-		if( $request !== null )
248
+		if ($request !== null)
249 249
 		{
250 250
 			$attr = $request->attributes;
251 251
 
252
-			if( ( $site = $attr->get( 'site' ) ) !== null ) {
252
+			if (($site = $attr->get('site')) !== null) {
253 253
 				$fixed['site'] = $site;
254 254
 			}
255 255
 
256
-			if( ( $lang = $attr->get( 'locale' ) ) !== null ) {
256
+			if (($lang = $attr->get('locale')) !== null) {
257 257
 				$fixed['locale'] = $lang;
258 258
 			}
259 259
 
260
-			if( ( $currency = $attr->get( 'currency' ) ) !== null ) {
260
+			if (($currency = $attr->get('currency')) !== null) {
261 261
 				$fixed['currency'] = $currency;
262 262
 			}
263 263
 		}
264 264
 
265
-		$helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed );
266
-		$view->addHelper( 'url', $helper );
265
+		$helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed);
266
+		$view->addHelper('url', $helper);
267 267
 
268 268
 		return $view;
269 269
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -82,8 +82,7 @@  discard block
 block discarded – undo
82 82
 			&& in_array( 'ROLE_ADMIN', (array) $token->getUser()->getRoles() ) )
83 83
 		{
84 84
 			$helper = new \Aimeos\MW\View\Helper\Access\All( $view );
85
-		}
86
-		else
85
+		} else
87 86
 		{
88 87
 			$fcn = function() use ( $container, $context ) {
89 88
 				return $container->get( 'aimeos_support' )->getGroups( $context );
@@ -221,8 +220,7 @@  discard block
 block discarded – undo
221 220
 		{
222 221
 			$i18n = $this->container->get( 'aimeos_i18n' )->get( array( $locale ) );
223 222
 			$translation = $i18n[$locale];
224
-		}
225
-		else
223
+		} else
226 224
 		{
227 225
 			$translation = new \Aimeos\MW\Translation\None( 'en' );
228 226
 		}
Please login to merge, or discard this patch.
Service/Context.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @param Container $container Container object to access parameters
33 33
 	 */
34
-	public function __construct( Container $container )
34
+	public function __construct(Container $container)
35 35
 	{
36 36
 		$this->container = $container;
37 37
 	}
@@ -44,37 +44,37 @@  discard block
 block discarded – undo
44 44
 	 * @param string $type Configuration type ("frontend" or "backend")
45 45
 	 * @return \Aimeos\MShop\Context\Item\Iface Context object
46 46
 	 */
47
-	public function get( $locale = true, $type = 'frontend' )
47
+	public function get($locale = true, $type = 'frontend')
48 48
 	{
49
-		$config = $this->container->get( 'aimeos_config' )->get( $type );
49
+		$config = $this->container->get('aimeos_config')->get($type);
50 50
 
51
-		if( self::$context === null )
51
+		if (self::$context === null)
52 52
 		{
53 53
 			$context = new \Aimeos\MShop\Context\Item\Standard();
54
-			$context->setConfig( $config );
54
+			$context->setConfig($config);
55 55
 
56
-			$this->addDataBaseManager( $context );
57
-			$this->addFilesystemManager( $context );
58
-			$this->addMessageQueueManager( $context );
59
-			$this->addLogger( $context );
60
-			$this->addCache( $context );
61
-			$this->addMailer( $context);
56
+			$this->addDataBaseManager($context);
57
+			$this->addFilesystemManager($context);
58
+			$this->addMessageQueueManager($context);
59
+			$this->addLogger($context);
60
+			$this->addCache($context);
61
+			$this->addMailer($context);
62 62
 
63 63
 			self::$context = $context;
64 64
 		}
65 65
 
66 66
 		$context = self::$context;
67
-		$context->setConfig( $config );
67
+		$context->setConfig($config);
68 68
 
69
-		if( $locale === true )
69
+		if ($locale === true)
70 70
 		{
71
-			$localeItem = $this->container->get('aimeos_locale')->get( $context );
72
-			$context->setI18n( $this->container->get('aimeos_i18n')->get( array( $localeItem->getLanguageId() ) ) );
73
-			$context->setLocale( $localeItem );
71
+			$localeItem = $this->container->get('aimeos_locale')->get($context);
72
+			$context->setI18n($this->container->get('aimeos_i18n')->get(array($localeItem->getLanguageId())));
73
+			$context->setLocale($localeItem);
74 74
 		}
75 75
 
76
-		$this->addSession( $context );
77
-		$this->addUserGroups( $context);
76
+		$this->addSession($context);
77
+		$this->addUserGroups($context);
78 78
 
79 79
 		return $context;
80 80
 	}
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object including config
87 87
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
88 88
 	 */
89
-	protected function addCache( \Aimeos\MShop\Context\Item\Iface $context )
89
+	protected function addCache(\Aimeos\MShop\Context\Item\Iface $context)
90 90
 	{
91
-		$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context );
92
-		$context->setCache( $cache );
91
+		$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context);
92
+		$context->setCache($cache);
93 93
 
94 94
 		return $context;
95 95
 	}
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
102 102
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
103 103
 	 */
104
-	protected function addDatabaseManager( \Aimeos\MShop\Context\Item\Iface $context )
104
+	protected function addDatabaseManager(\Aimeos\MShop\Context\Item\Iface $context)
105 105
 	{
106
-		$dbm = new \Aimeos\MW\DB\Manager\DBAL( $context->getConfig() );
107
-		$context->setDatabaseManager( $dbm );
106
+		$dbm = new \Aimeos\MW\DB\Manager\DBAL($context->getConfig());
107
+		$context->setDatabaseManager($dbm);
108 108
 
109 109
 		return $context;
110 110
 	}
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
117 117
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
118 118
 	 */
119
-	protected function addFilesystemManager( \Aimeos\MShop\Context\Item\Iface $context )
119
+	protected function addFilesystemManager(\Aimeos\MShop\Context\Item\Iface $context)
120 120
 	{
121
-		$fs = new \Aimeos\MW\Filesystem\Manager\Standard( $context->getConfig() );
122
-		$context->setFilesystemManager( $fs );
121
+		$fs = new \Aimeos\MW\Filesystem\Manager\Standard($context->getConfig());
122
+		$context->setFilesystemManager($fs);
123 123
 
124 124
 		return $context;
125 125
 	}
@@ -131,10 +131,10 @@  discard block
 block discarded – undo
131 131
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
132 132
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
133 133
 	 */
134
-	protected function addLogger( \Aimeos\MShop\Context\Item\Iface $context )
134
+	protected function addLogger(\Aimeos\MShop\Context\Item\Iface $context)
135 135
 	{
136
-		$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context );
137
-		$context->setLogger( $logger );
136
+		$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context);
137
+		$context->setLogger($logger);
138 138
 
139 139
 		return $context;
140 140
 	}
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
148 148
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
149 149
 	 */
150
-	protected function addMailer( \Aimeos\MShop\Context\Item\Iface $context )
150
+	protected function addMailer(\Aimeos\MShop\Context\Item\Iface $context)
151 151
 	{
152 152
 		$container = $this->container;
153
-		$mail = new \Aimeos\MW\Mail\Swift( function() use ( $container) { return $container->get( 'mailer' ); } );
154
-		$context->setMail( $mail );
153
+		$mail = new \Aimeos\MW\Mail\Swift(function() use ($container) { return $container->get('mailer'); } );
154
+		$context->setMail($mail);
155 155
 
156 156
 		return $context;
157 157
 	}
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
164 164
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
165 165
 	 */
166
-	protected function addMessageQueueManager( \Aimeos\MShop\Context\Item\Iface $context )
166
+	protected function addMessageQueueManager(\Aimeos\MShop\Context\Item\Iface $context)
167 167
 	{
168
-		$mq = new \Aimeos\MW\MQueue\Manager\Standard( $context->getConfig() );
169
-		$context->setMessageQueueManager( $mq );
168
+		$mq = new \Aimeos\MW\MQueue\Manager\Standard($context->getConfig());
169
+		$context->setMessageQueueManager($mq);
170 170
 
171 171
 		return $context;
172 172
 	}
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
179 179
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
180 180
 	 */
181
-	protected function addSession( \Aimeos\MShop\Context\Item\Iface $context )
181
+	protected function addSession(\Aimeos\MShop\Context\Item\Iface $context)
182 182
 	{
183
-		$session = new \Aimeos\MW\Session\Symfony2( $this->container->get( 'session' ) );
184
-		$context->setSession( $session );
183
+		$session = new \Aimeos\MW\Session\Symfony2($this->container->get('session'));
184
+		$context->setSession($session);
185 185
 
186 186
 		return $context;
187 187
 	}
@@ -192,33 +192,33 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
194 194
 	 */
195
-	protected function addUserGroups( \Aimeos\MShop\Context\Item\Iface $context )
195
+	protected function addUserGroups(\Aimeos\MShop\Context\Item\Iface $context)
196 196
 	{
197 197
 		$token = null;
198 198
 		$username = '';
199 199
 
200
-		$token = $this->container->get( 'security.token_storage' )->getToken();
200
+		$token = $this->container->get('security.token_storage')->getToken();
201 201
 
202
-		if( is_object( $token ) )
202
+		if (is_object($token))
203 203
 		{
204
-			if( method_exists( $token->getUser(), 'getId' ) )
204
+			if (method_exists($token->getUser(), 'getId'))
205 205
 			{
206 206
 				$userid = $token->getUser()->getId();
207
-				$context->setUserId( $userid );
208
-				$context->setGroupIds( function() use ( $context, $userid )
207
+				$context->setUserId($userid);
208
+				$context->setGroupIds(function() use ($context, $userid)
209 209
 				{
210
-					$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
211
-					return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups();
210
+					$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
211
+					return $manager->getItem($userid, array('customer/group'))->getGroups();
212 212
 				} );
213 213
 			}
214 214
 
215
-			if( is_object( $token->getUser() ) ) {
216
-				$username =  $token->getUser()->getUsername();
215
+			if (is_object($token->getUser())) {
216
+				$username = $token->getUser()->getUsername();
217 217
 			} else {
218 218
 				$username = $token->getUser();
219 219
 			}
220 220
 		}
221 221
 
222
-		$context->setEditor( $username );
222
+		$context->setEditor($username);
223 223
 	}
224 224
 }
Please login to merge, or discard this patch.