Completed
Push — master ( 008aa0...babc0b )
by Aimeos
02:37
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,21 +56,21 @@  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
-		$engines = array( '.blade.php' => new \Aimeos\MW\View\Engine\Blade( app( '\Illuminate\View\Factory' ) ) );
62
-		$view = new \Aimeos\MW\View\Standard( $templatePaths, $engines );
61
+		$engines = array('.blade.php' => new \Aimeos\MW\View\Engine\Blade(app('\Illuminate\View\Factory')));
62
+		$view = new \Aimeos\MW\View\Standard($templatePaths, $engines);
63 63
 		$config = $context->getConfig();
64 64
 
65
-		$this->addCsrf( $view );
66
-		$this->addAccess( $view, $context );
67
-		$this->addConfig( $view, $config );
68
-		$this->addNumber( $view, $config );
69
-		$this->addParam( $view );
70
-		$this->addRequest( $view );
71
-		$this->addResponse( $view );
72
-		$this->addTranslate( $view, $locale );
73
-		$this->addUrl( $view );
65
+		$this->addCsrf($view);
66
+		$this->addAccess($view, $context);
67
+		$this->addConfig($view, $config);
68
+		$this->addNumber($view, $config);
69
+		$this->addParam($view);
70
+		$this->addRequest($view);
71
+		$this->addResponse($view);
72
+		$this->addTranslate($view, $locale);
73
+		$this->addUrl($view);
74 74
 
75 75
 		return $view;
76 76
 	}
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
84 84
 	 * @return \Aimeos\MW\View\Iface Modified view object
85 85
 	 */
86
-	protected function addAccess( \Aimeos\MW\View\Iface $view, \Aimeos\MShop\Context\Item\Iface $context )
86
+	protected function addAccess(\Aimeos\MW\View\Iface $view, \Aimeos\MShop\Context\Item\Iface $context)
87 87
 	{
88 88
 		$support = $this->support;
89 89
 
90
-		$fcn = function() use ( $support, $context ) {
91
-			return $support->getGroups( $context );
90
+		$fcn = function() use ($support, $context) {
91
+			return $support->getGroups($context);
92 92
 		};
93 93
 
94
-		$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $fcn );
95
-		$view->addHelper( 'access', $helper );
94
+		$helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $fcn);
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,10 +121,10 @@  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
-		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', csrf_token() );
127
-		$view->addHelper( 'csrf', $helper );
126
+		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', csrf_token());
127
+		$view->addHelper('csrf', $helper);
128 128
 
129 129
 		return $view;
130 130
 	}
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 	 * @param \Aimeos\MW\Config\Iface $config Configuration object
138 138
 	 * @return \Aimeos\MW\View\Iface Modified view object
139 139
 	 */
140
-	protected function addNumber( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config )
140
+	protected function addNumber(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config)
141 141
 	{
142
-		$sepDec = $config->get( 'client/html/common/format/separatorDecimal', '.' );
143
-		$sep1000 = $config->get( 'client/html/common/format/separator1000', ' ' );
144
-		$decimals = $config->get( 'client/html/common/format/decimals', 2 );
142
+		$sepDec = $config->get('client/html/common/format/separatorDecimal', '.');
143
+		$sep1000 = $config->get('client/html/common/format/separator1000', ' ');
144
+		$decimals = $config->get('client/html/common/format/decimals', 2);
145 145
 
146
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000, $decimals );
147
-		$view->addHelper( 'number', $helper );
146
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000, $decimals);
147
+		$view->addHelper('number', $helper);
148 148
 
149 149
 		return $view;
150 150
 	}
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 	 * @param \Aimeos\MW\View\Iface $view View object
157 157
 	 * @return \Aimeos\MW\View\Iface Modified view object
158 158
 	 */
159
-	protected function addParam( \Aimeos\MW\View\Iface $view )
159
+	protected function addParam(\Aimeos\MW\View\Iface $view)
160 160
 	{
161
-		$params = ( Route::current() ? Route::current()->parameters() + Input::all() : array() );
162
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
163
-		$view->addHelper( 'param', $helper );
161
+		$params = (Route::current() ? Route::current()->parameters() + Input::all() : array());
162
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params);
163
+		$view->addHelper('param', $helper);
164 164
 
165 165
 		return $view;
166 166
 	}
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 	 * @param \Aimeos\MW\View\Iface $view View object
173 173
 	 * @return \Aimeos\MW\View\Iface Modified view object
174 174
 	 */
175
-	protected function addRequest( \Aimeos\MW\View\Iface $view )
175
+	protected function addRequest(\Aimeos\MW\View\Iface $view)
176 176
 	{
177
-		$helper = new \Aimeos\MW\View\Helper\Request\Laravel5( $view, Request::instance() );
178
-		$view->addHelper( 'request', $helper );
177
+		$helper = new \Aimeos\MW\View\Helper\Request\Laravel5($view, Request::instance());
178
+		$view->addHelper('request', $helper);
179 179
 
180 180
 		return $view;
181 181
 	}
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
 	 * @param \Aimeos\MW\View\Iface $view View object
188 188
 	 * @return \Aimeos\MW\View\Iface Modified view object
189 189
 	 */
190
-	protected function addResponse( \Aimeos\MW\View\Iface $view )
190
+	protected function addResponse(\Aimeos\MW\View\Iface $view)
191 191
 	{
192
-		$helper = new \Aimeos\MW\View\Helper\Response\Laravel5( $view );
193
-		$view->addHelper( 'response', $helper );
192
+		$helper = new \Aimeos\MW\View\Helper\Response\Laravel5($view);
193
+		$view->addHelper('response', $helper);
194 194
 
195 195
 		return $view;
196 196
 	}
@@ -203,20 +203,20 @@  discard block
 block discarded – undo
203 203
 	 * @param string|null $locale ISO language code, e.g. "de" or "de_CH"
204 204
 	 * @return \Aimeos\MW\View\Iface Modified view object
205 205
 	 */
206
-	protected function addTranslate( \Aimeos\MW\View\Iface $view, $locale )
206
+	protected function addTranslate(\Aimeos\MW\View\Iface $view, $locale)
207 207
 	{
208
-		if( $locale !== null )
208
+		if ($locale !== null)
209 209
 		{
210
-			$i18n = $this->i18n->get( array( $locale ) );
210
+			$i18n = $this->i18n->get(array($locale));
211 211
 			$translation = $i18n[$locale];
212 212
 		}
213 213
 		else
214 214
 		{
215
-			$translation = new \Aimeos\MW\Translation\None( 'en' );
215
+			$translation = new \Aimeos\MW\Translation\None('en');
216 216
 		}
217 217
 
218
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation );
219
-		$view->addHelper( 'translate', $helper );
218
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation);
219
+		$view->addHelper('translate', $helper);
220 220
 
221 221
 		return $view;
222 222
 	}
@@ -228,27 +228,27 @@  discard block
 block discarded – undo
228 228
 	 * @param \Aimeos\MW\View\Iface $view View object
229 229
 	 * @return \Aimeos\MW\View\Iface Modified view object
230 230
 	 */
231
-	protected function addUrl( \Aimeos\MW\View\Iface $view )
231
+	protected function addUrl(\Aimeos\MW\View\Iface $view)
232 232
 	{
233 233
 		$fixed = array();
234 234
 
235
-		if( Route::current() )
235
+		if (Route::current())
236 236
 		{
237
-			if( ( $value = Route::input( 'site' ) ) !== null ) {
237
+			if (($value = Route::input('site')) !== null) {
238 238
 				$fixed['site'] = $value;
239 239
 			}
240 240
 
241
-			if( ( $value = Route::input( 'locale' ) ) !== null ) {
241
+			if (($value = Route::input('locale')) !== null) {
242 242
 				$fixed['locale'] = $value;
243 243
 			}
244 244
 
245
-			if( ( $value = Route::input( 'currency' ) ) !== null ) {
245
+			if (($value = Route::input('currency')) !== null) {
246 246
 				$fixed['currency'] = $value;
247 247
 			}
248 248
 		}
249 249
 
250
-		$helper = new \Aimeos\MW\View\Helper\Url\Laravel5( $view, app('url'), $fixed );
251
-		$view->addHelper( 'url', $helper );
250
+		$helper = new \Aimeos\MW\View\Helper\Url\Laravel5($view, app('url'), $fixed);
251
+		$view->addHelper('url', $helper);
252 252
 
253 253
 		return $view;
254 254
 	}
Please login to merge, or discard this patch.
src/Aimeos/Shop/ShopServiceProvider.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -65,20 +65,20 @@
 block discarded – undo
65 65
 		require $basedir.'routes.php';
66 66
 
67 67
 
68
-		$i18n = $this->app->make( '\Aimeos\Shop\Base\I18n' );
69
-		$config = $this->app->make( '\Aimeos\Shop\Base\Config' );
68
+		$i18n = $this->app->make('\Aimeos\Shop\Base\I18n');
69
+		$config = $this->app->make('\Aimeos\Shop\Base\Config');
70 70
 
71
-		Blade::directive('ai:config', function( $key, $default = null ) use ( $config )
71
+		Blade::directive('ai:config', function($key, $default = null) use ($config)
72 72
 		{
73
-			return $config->get( $key, $default );
73
+			return $config->get($key, $default);
74 74
 		});
75 75
 
76
-		Blade::directive('ai:translate', function( $domain, $singular, $plural, $number ) use ( $i18n )
76
+		Blade::directive('ai:translate', function($domain, $singular, $plural, $number) use ($i18n)
77 77
 		{
78
-			if( $plural !== '' ) {
79
-				return $this->translator->dn( $domain, $singular, $plural, $number );
78
+			if ($plural !== '') {
79
+				return $this->translator->dn($domain, $singular, $plural, $number);
80 80
 			}
81
-			return $this->translator->dt( $domain, $singular );
81
+			return $this->translator->dt($domain, $singular);
82 82
 		});
83 83
 	}
84 84
 
Please login to merge, or discard this patch.