Completed
Push — master ( 20a540...790484 )
by Aimeos
04:14
created
src/Aimeos/Shop/Base/View.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param \Aimeos\Shop\Base\I18n $i18n I18n object
42 42
 	 * @param \Aimeos\Shop\Base\Support $support Support object
43 43
 	 */
44
-	public function __construct( \Aimeos\Shop\Base\I18n $i18n, \Aimeos\Shop\Base\Support $support )
44
+	public function __construct(\Aimeos\Shop\Base\I18n $i18n, \Aimeos\Shop\Base\Support $support)
45 45
 	{
46 46
 		$this->i18n = $i18n;
47 47
 		$this->support = $support;
@@ -56,20 +56,20 @@  discard block
 block discarded – undo
56 56
 	 * @param string|null $locale Code of the current language or null for no translation
57 57
 	 * @return \Aimeos\MW\View\Iface View object
58 58
 	 */
59
-	public function create( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null )
59
+	public function create(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null)
60 60
 	{
61 61
 		$config = $context->getConfig();
62
-		$view = new \Aimeos\MW\View\Standard( $templatePaths );
63
-
64
-		$this->addCsrf( $view );
65
-		$this->addAccess( $view, $context );
66
-		$this->addConfig( $view, $config );
67
-		$this->addNumber( $view, $config );
68
-		$this->addParam( $view );
69
-		$this->addRequest( $view );
70
-		$this->addResponse( $view );
71
-		$this->addTranslate( $view, $locale );
72
-		$this->addUrl( $view );
62
+		$view = new \Aimeos\MW\View\Standard($templatePaths);
63
+
64
+		$this->addCsrf($view);
65
+		$this->addAccess($view, $context);
66
+		$this->addConfig($view, $config);
67
+		$this->addNumber($view, $config);
68
+		$this->addParam($view);
69
+		$this->addRequest($view);
70
+		$this->addResponse($view);
71
+		$this->addTranslate($view, $locale);
72
+		$this->addUrl($view);
73 73
 
74 74
 		return $view;
75 75
 	}
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
83 83
 	 * @return \Aimeos\MW\View\Iface Modified view object
84 84
 	 */
85
-	protected function addAccess( \Aimeos\MW\View\Iface $view, \Aimeos\MShop\Context\Item\Iface $context )
85
+	protected function addAccess(\Aimeos\MW\View\Iface $view, \Aimeos\MShop\Context\Item\Iface $context)
86 86
 	{
87 87
 		$support = $this->support;
88 88
 
89
-		$fcn = function() use ( $support, $context ) {
90
-			return $support->getGroups( $context );
89
+		$fcn = function() use ($support, $context) {
90
+			return $support->getGroups($context);
91 91
 		};
92 92
 
93
-		$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $fcn );
94
-		$view->addHelper( 'access', $helper );
93
+		$helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $fcn);
94
+		$view->addHelper('access', $helper);
95 95
 
96 96
 		return $view;
97 97
 	}
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 	 * @param \Aimeos\MW\Config\Iface $config Configuration object
105 105
 	 * @return \Aimeos\MW\View\Iface Modified view object
106 106
 	 */
107
-	protected function addConfig( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config )
107
+	protected function addConfig(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config)
108 108
 	{
109
-		$config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) );
110
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
111
-		$view->addHelper( 'config', $helper );
109
+		$config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client'));
110
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
111
+		$view->addHelper('config', $helper);
112 112
 
113 113
 		return $view;
114 114
 	}
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 	 * @param \Aimeos\MW\View\Iface $view View object
121 121
 	 * @return \Aimeos\MW\View\Iface Modified view object
122 122
 	 */
123
-	protected function addCsrf( \Aimeos\MW\View\Iface $view )
123
+	protected function addCsrf(\Aimeos\MW\View\Iface $view)
124 124
 	{
125
-		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', csrf_token() );
126
-		$view->addHelper( 'csrf', $helper );
125
+		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', csrf_token());
126
+		$view->addHelper('csrf', $helper);
127 127
 
128 128
 		return $view;
129 129
 	}
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
 	 * @param \Aimeos\MW\Config\Iface $config Configuration object
137 137
 	 * @return \Aimeos\MW\View\Iface Modified view object
138 138
 	 */
139
-	protected function addNumber( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config )
139
+	protected function addNumber(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config)
140 140
 	{
141
-		$sepDec = $config->get( 'client/html/common/format/separatorDecimal', '.' );
142
-		$sep1000 = $config->get( 'client/html/common/format/separator1000', ' ' );
143
-		$decimals = $config->get( 'client/html/common/format/decimals', 2 );
141
+		$sepDec = $config->get('client/html/common/format/separatorDecimal', '.');
142
+		$sep1000 = $config->get('client/html/common/format/separator1000', ' ');
143
+		$decimals = $config->get('client/html/common/format/decimals', 2);
144 144
 
145
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000, $decimals );
146
-		$view->addHelper( 'number', $helper );
145
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000, $decimals);
146
+		$view->addHelper('number', $helper);
147 147
 
148 148
 		return $view;
149 149
 	}
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
 	 * @param \Aimeos\MW\View\Iface $view View object
156 156
 	 * @return \Aimeos\MW\View\Iface Modified view object
157 157
 	 */
158
-	protected function addParam( \Aimeos\MW\View\Iface $view )
158
+	protected function addParam(\Aimeos\MW\View\Iface $view)
159 159
 	{
160
-		$params = ( Route::current() ? Route::current()->parameters() + Input::all() : array() );
161
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
162
-		$view->addHelper( 'param', $helper );
160
+		$params = (Route::current() ? Route::current()->parameters() + Input::all() : array());
161
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params);
162
+		$view->addHelper('param', $helper);
163 163
 
164 164
 		return $view;
165 165
 	}
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 	 * @param \Aimeos\MW\View\Iface $view View object
172 172
 	 * @return \Aimeos\MW\View\Iface Modified view object
173 173
 	 */
174
-	protected function addRequest( \Aimeos\MW\View\Iface $view )
174
+	protected function addRequest(\Aimeos\MW\View\Iface $view)
175 175
 	{
176
-		$helper = new \Aimeos\MW\View\Helper\Request\Laravel5( $view, Request::instance() );
177
-		$view->addHelper( 'request', $helper );
176
+		$helper = new \Aimeos\MW\View\Helper\Request\Laravel5($view, Request::instance());
177
+		$view->addHelper('request', $helper);
178 178
 
179 179
 		return $view;
180 180
 	}
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
 	 * @param \Aimeos\MW\View\Iface $view View object
187 187
 	 * @return \Aimeos\MW\View\Iface Modified view object
188 188
 	 */
189
-	protected function addResponse( \Aimeos\MW\View\Iface $view )
189
+	protected function addResponse(\Aimeos\MW\View\Iface $view)
190 190
 	{
191
-		$helper = new \Aimeos\MW\View\Helper\Response\Laravel5( $view );
192
-		$view->addHelper( 'response', $helper );
191
+		$helper = new \Aimeos\MW\View\Helper\Response\Laravel5($view);
192
+		$view->addHelper('response', $helper);
193 193
 
194 194
 		return $view;
195 195
 	}
@@ -202,20 +202,20 @@  discard block
 block discarded – undo
202 202
 	 * @param string|null $locale ISO language code, e.g. "de" or "de_CH"
203 203
 	 * @return \Aimeos\MW\View\Iface Modified view object
204 204
 	 */
205
-	protected function addTranslate( \Aimeos\MW\View\Iface $view, $locale )
205
+	protected function addTranslate(\Aimeos\MW\View\Iface $view, $locale)
206 206
 	{
207
-		if( $locale !== null )
207
+		if ($locale !== null)
208 208
 		{
209
-			$i18n = $this->i18n->get( array( $locale ) );
209
+			$i18n = $this->i18n->get(array($locale));
210 210
 			$translation = $i18n[$locale];
211 211
 		}
212 212
 		else
213 213
 		{
214
-			$translation = new \Aimeos\MW\Translation\None( 'en' );
214
+			$translation = new \Aimeos\MW\Translation\None('en');
215 215
 		}
216 216
 
217
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation );
218
-		$view->addHelper( 'translate', $helper );
217
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation);
218
+		$view->addHelper('translate', $helper);
219 219
 
220 220
 		return $view;
221 221
 	}
@@ -227,27 +227,27 @@  discard block
 block discarded – undo
227 227
 	 * @param \Aimeos\MW\View\Iface $view View object
228 228
 	 * @return \Aimeos\MW\View\Iface Modified view object
229 229
 	 */
230
-	protected function addUrl( \Aimeos\MW\View\Iface $view )
230
+	protected function addUrl(\Aimeos\MW\View\Iface $view)
231 231
 	{
232 232
 		$fixed = array();
233 233
 
234
-		if( Route::current() )
234
+		if (Route::current())
235 235
 		{
236
-			if( ( $value = Route::input( 'site' ) ) !== null ) {
236
+			if (($value = Route::input('site')) !== null) {
237 237
 				$fixed['site'] = $value;
238 238
 			}
239 239
 
240
-			if( ( $value = Route::input( 'locale' ) ) !== null ) {
240
+			if (($value = Route::input('locale')) !== null) {
241 241
 				$fixed['locale'] = $value;
242 242
 			}
243 243
 
244
-			if( ( $value = Route::input( 'currency' ) ) !== null ) {
244
+			if (($value = Route::input('currency')) !== null) {
245 245
 				$fixed['currency'] = $value;
246 246
 			}
247 247
 		}
248 248
 
249
-		$helper = new \Aimeos\MW\View\Helper\Url\Laravel5( $view, app('url'), $fixed );
250
-		$view->addHelper( 'url', $helper );
249
+		$helper = new \Aimeos\MW\View\Helper\Url\Laravel5($view, app('url'), $fixed);
250
+		$view->addHelper('url', $helper);
251 251
 
252 252
 		return $view;
253 253
 	}
Please login to merge, or discard this patch.