Completed
Push — master ( e63e7d...d63c8b )
by Aimeos
03:05
created
src/Aimeos/Shop/Base/View.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -32,52 +32,52 @@  discard block
 block discarded – undo
32 32
 	 * @param string|null $locale Code of the current language or null for no translation
33 33
 	 * @return \Aimeos\MW\View\Iface View object
34 34
 	 */
35
-	public function create( \Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null )
35
+	public function create(\Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null)
36 36
 	{
37 37
 		$params = $fixed = array();
38 38
 
39
-		if( $locale !== null )
39
+		if ($locale !== null)
40 40
 		{
41 41
 			$params = Route::current()->parameters() + Input::all();
42 42
 			$fixed = $this->getFixedParams();
43 43
 
44
-			$i18n = app('\Aimeos\Shop\Base\I18n')->get( array( $locale ) );
44
+			$i18n = app('\Aimeos\Shop\Base\I18n')->get(array($locale));
45 45
 			$translation = $i18n[$locale];
46 46
 		}
47 47
 		else
48 48
 		{
49
-			$translation = new \Aimeos\MW\Translation\None( 'en' );
49
+			$translation = new \Aimeos\MW\Translation\None('en');
50 50
 		}
51 51
 
52 52
 
53
-		$view = new \Aimeos\MW\View\Standard( $templatePaths );
53
+		$view = new \Aimeos\MW\View\Standard($templatePaths);
54 54
 
55
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation );
56
-		$view->addHelper( 'translate', $helper );
55
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation);
56
+		$view->addHelper('translate', $helper);
57 57
 
58
-		$helper = new \Aimeos\MW\View\Helper\Url\Laravel5( $view, app('url'), $fixed );
59
-		$view->addHelper( 'url', $helper );
58
+		$helper = new \Aimeos\MW\View\Helper\Url\Laravel5($view, app('url'), $fixed);
59
+		$view->addHelper('url', $helper);
60 60
 
61
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
62
-		$view->addHelper( 'param', $helper );
61
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params);
62
+		$view->addHelper('param', $helper);
63 63
 
64
-		$config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) );
65
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
66
-		$view->addHelper( 'config', $helper );
64
+		$config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client'));
65
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
66
+		$view->addHelper('config', $helper);
67 67
 
68
-		$sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' );
69
-		$sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' );
70
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000 );
71
-		$view->addHelper( 'number', $helper );
68
+		$sepDec = $config->get('client/html/common/format/seperatorDecimal', '.');
69
+		$sep1000 = $config->get('client/html/common/format/seperator1000', ' ');
70
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000);
71
+		$view->addHelper('number', $helper);
72 72
 
73
-		$helper = new \Aimeos\MW\View\Helper\Request\Laravel5( $view, Request::instance() );
74
-		$view->addHelper( 'request', $helper );
73
+		$helper = new \Aimeos\MW\View\Helper\Request\Laravel5($view, Request::instance());
74
+		$view->addHelper('request', $helper);
75 75
 
76
-		$helper = new \Aimeos\MW\View\Helper\Response\Laravel5( $view );
77
-		$view->addHelper( 'response', $helper );
76
+		$helper = new \Aimeos\MW\View\Helper\Response\Laravel5($view);
77
+		$view->addHelper('response', $helper);
78 78
 
79
-		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', csrf_token() );
80
-		$view->addHelper( 'csrf', $helper );
79
+		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', csrf_token());
80
+		$view->addHelper('csrf', $helper);
81 81
 
82 82
 		return $view;
83 83
 	}
@@ -92,15 +92,15 @@  discard block
 block discarded – undo
92 92
 	{
93 93
 		$fixed = array();
94 94
 
95
-		if( ( $value = Route::input( 'site' ) ) !== null ) {
95
+		if (($value = Route::input('site')) !== null) {
96 96
 			$fixed['site'] = $value;
97 97
 		}
98 98
 
99
-		if( ( $value = Route::input( 'locale' ) ) !== null ) {
99
+		if (($value = Route::input('locale')) !== null) {
100 100
 			$fixed['locale'] = $value;
101 101
 		}
102 102
 
103
-		if( ( $value = Route::input( 'currency' ) ) !== null ) {
103
+		if (($value = Route::input('currency')) !== null) {
104 104
 			$fixed['currency'] = $value;
105 105
 		}
106 106
 
Please login to merge, or discard this patch.
src/Aimeos/Shop/Command/AccountCommand.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -43,21 +43,21 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function fire()
45 45
 	{
46
-		$code = $this->argument( 'email' );
47
-		if( ( $password = $this->option( 'password' ) ) === null ) {
48
-			$password = $this->secret( 'Password' );
46
+		$code = $this->argument('email');
47
+		if (($password = $this->option('password')) === null) {
48
+			$password = $this->secret('Password');
49 49
 		}
50 50
 
51
-		$context = $this->getLaravel()->make( 'Aimeos\Shop\Base\Context' )->get( false );
52
-		$context->setEditor( 'aimeos:account' );
51
+		$context = $this->getLaravel()->make('Aimeos\Shop\Base\Context')->get(false);
52
+		$context->setEditor('aimeos:account');
53 53
 
54
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
55
-		$context->setLocale( $localeManager->createItem() );
54
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
55
+		$context->setLocale($localeManager->createItem());
56 56
 
57
-		$user = $this->createCustomerItem( $context, $code, $password );
57
+		$user = $this->createCustomerItem($context, $code, $password);
58 58
 
59
-		if( $this->option( 'admin' ) ) {
60
-			$this->addPrivilege( $context, $user, 'admin' );
59
+		if ($this->option('admin')) {
60
+			$this->addPrivilege($context, $user, 'admin');
61 61
 		}
62 62
 	}
63 63
 
@@ -69,31 +69,31 @@  discard block
 block discarded – undo
69 69
 	 * @param string $userid Unique user ID
70 70
 	 * @param string $groupid Unique group ID
71 71
 	 */
72
-	protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid )
72
+	protected function addListItem(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid)
73 73
 	{
74
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'lists' );
75
-		$typeid = $manager->getSubmanager( 'type' )->findItem( 'default', array(), 'customer/group' )->getId();
74
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('lists');
75
+		$typeid = $manager->getSubmanager('type')->findItem('default', array(), 'customer/group')->getId();
76 76
 
77 77
 		$search = $manager->createSearch();
78 78
 		$expr = array(
79
-			$search->compare( '==', 'customer.lists.parentid', $userid ),
80
-			$search->compare( '==', 'customer.lists.refid', $groupid ),
81
-			$search->compare( '==', 'customer.lists.domain', 'customer/group' ),
82
-			$search->compare( '==', 'customer.lists.typeid', $typeid ),
79
+			$search->compare('==', 'customer.lists.parentid', $userid),
80
+			$search->compare('==', 'customer.lists.refid', $groupid),
81
+			$search->compare('==', 'customer.lists.domain', 'customer/group'),
82
+			$search->compare('==', 'customer.lists.typeid', $typeid),
83 83
 		);
84
-		$search->setConditions( $search->combine( '&&', $expr ) );
85
-		$search->setSlice( 0, 1 );
84
+		$search->setConditions($search->combine('&&', $expr));
85
+		$search->setSlice(0, 1);
86 86
 
87
-		if( count( $manager->searchItems( $search ) ) === 0 )
87
+		if (count($manager->searchItems($search)) === 0)
88 88
 		{
89 89
 			$item = $manager->createItem();
90
-			$item->setDomain( 'customer/group' );
91
-			$item->setParentId( $userid );
92
-			$item->setTypeId( $typeid );
93
-			$item->setRefId( $groupid );
94
-			$item->setStatus( 1 );
90
+			$item->setDomain('customer/group');
91
+			$item->setParentId($userid);
92
+			$item->setTypeId($typeid);
93
+			$item->setRefId($groupid);
94
+			$item->setStatus(1);
95 95
 
96
-			$manager->saveItem( $item, false );
96
+			$manager->saveItem($item, false);
97 97
 		}
98 98
 	}
99 99
 
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
 	 * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object
106 106
 	 * @param string $privilege Unique customer group code
107 107
 	 */
108
-	protected function addPrivilege( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $privilege )
108
+	protected function addPrivilege(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $privilege)
109 109
 	{
110
-		$this->info( sprintf( 'Add "%1$s" privilege to user "%2$s" for sites', $privilege, $user->getCode() ) );
110
+		$this->info(sprintf('Add "%1$s" privilege to user "%2$s" for sites', $privilege, $user->getCode()));
111 111
 
112
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
112
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
113 113
 
114
-		foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem )
114
+		foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem)
115 115
 		{
116
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
116
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false);
117 117
 
118 118
 			$lcontext = clone $context;
119
-			$lcontext->setLocale( $localeItem );
119
+			$lcontext->setLocale($localeItem);
120 120
 
121
-			$this->info( '- ' . $siteItem->getCode() );
121
+			$this->info('- '.$siteItem->getCode());
122 122
 
123
-			$groupItem = $this->getGroupItem( $lcontext, $privilege );
124
-			$this->addListItem( $lcontext, $user->getId(), $groupItem->getId() );
123
+			$groupItem = $this->getGroupItem($lcontext, $privilege);
124
+			$this->addListItem($lcontext, $user->getId(), $groupItem->getId());
125 125
 		}
126 126
 	}
127 127
 
@@ -136,21 +136,21 @@  discard block
 block discarded – undo
136 136
 	 * @param string $password New user password
137 137
 	 * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object
138 138
 	 */
139
-	protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password )
139
+	protected function createCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password)
140 140
 	{
141
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
141
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
142 142
 
143 143
 		try {
144
-			$item = $manager->findItem( $email );
145
-		} catch( \Aimeos\MShop\Exception $e ) {
144
+			$item = $manager->findItem($email);
145
+		} catch (\Aimeos\MShop\Exception $e) {
146 146
 			$item = $manager->createItem();
147 147
 		}
148 148
 
149
-		$item->setCode( $email );
150
-		$item->getPaymentAddress()->setEmail( $email );
151
-		$item->setPassword( $password );
149
+		$item->setCode($email);
150
+		$item->getPaymentAddress()->setEmail($email);
151
+		$item->setPassword($password);
152 152
 
153
-		$manager->saveItem( $item );
153
+		$manager->saveItem($item);
154 154
 
155 155
 		return $item;
156 156
 	}
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	protected function getArguments()
165 165
 	{
166 166
 		return array(
167
-			array( 'email', InputArgument::REQUIRED, 'E-mail address of the account that should be created' ),
168
-			array( 'site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)' ),
167
+			array('email', InputArgument::REQUIRED, 'E-mail address of the account that should be created'),
168
+			array('site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)'),
169 169
 		);
170 170
 	}
171 171
 
@@ -177,21 +177,21 @@  discard block
 block discarded – undo
177 177
 	 * @param string $code Unique customer group code
178 178
 	 * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object
179 179
 	 */
180
-	protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code )
180
+	protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code)
181 181
 	{
182
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'group' );
182
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('group');
183 183
 
184 184
 		try
185 185
 		{
186
-			$item = $manager->findItem( $code );
186
+			$item = $manager->findItem($code);
187 187
 		}
188
-		catch( \Aimeos\MShop\Exception $e )
188
+		catch (\Aimeos\MShop\Exception $e)
189 189
 		{
190 190
 			$item = $manager->createItem();
191
-			$item->setLabel( $code );
192
-			$item->setCode( $code );
191
+			$item->setLabel($code);
192
+			$item->setCode($code);
193 193
 
194
-			$manager->saveItem( $item );
194
+			$manager->saveItem($item);
195 195
 		}
196 196
 
197 197
 		return $item;
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 	protected function getOptions()
207 207
 	{
208 208
 		return array(
209
-				array( 'password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)' ),
210
-				array( 'admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges' ),
209
+				array('password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)'),
210
+				array('admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges'),
211 211
 		);
212 212
 	}
213 213
 }
Please login to merge, or discard this patch.
src/Aimeos/Shop/Command/SetupCommand.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
 	 * @param string $classname Name of the setup task class
43 43
 	 * @return boolean True if class is found, false if not
44 44
 	 */
45
-	public static function autoload( $classname )
45
+	public static function autoload($classname)
46 46
 	{
47
-		if( strncmp( $classname, 'Aimeos\\MW\\Setup\\Task\\', 21 ) === 0 )
47
+		if (strncmp($classname, 'Aimeos\\MW\\Setup\\Task\\', 21) === 0)
48 48
 		{
49
-			$fileName = substr( $classname, 21 ) . '.php';
50
-			$paths = explode( PATH_SEPARATOR, get_include_path() );
49
+			$fileName = substr($classname, 21).'.php';
50
+			$paths = explode(PATH_SEPARATOR, get_include_path());
51 51
 
52
-			foreach( $paths as $path )
52
+			foreach ($paths as $path)
53 53
 			{
54
-				$file = $path . DIRECTORY_SEPARATOR . $fileName;
54
+				$file = $path.DIRECTORY_SEPARATOR.$fileName;
55 55
 
56
-				if( file_exists( $file ) === true && ( include_once $file ) !== false ) {
56
+				if (file_exists($file) === true && (include_once $file) !== false) {
57 57
 					return true;
58 58
 				}
59 59
 			}
@@ -70,33 +70,33 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function fire()
72 72
 	{
73
-		$ctx = $this->getLaravel()->make( '\Aimeos\Shop\Base\Context' )->get( false );
74
-		$ctx->setEditor( 'aimeos:setup' );
73
+		$ctx = $this->getLaravel()->make('\Aimeos\Shop\Base\Context')->get(false);
74
+		$ctx->setEditor('aimeos:setup');
75 75
 
76 76
 		$config = $ctx->getConfig();
77
-		$site = $this->argument( 'site' );
78
-		$template = $this->argument( 'tplsite' );
77
+		$site = $this->argument('site');
78
+		$template = $this->argument('tplsite');
79 79
 
80
-		$config->set( 'setup/site', $site );
81
-		$dbconfig = $this->getDbConfig( $config );
82
-		$this->setOptions( $config );
80
+		$config->set('setup/site', $site);
81
+		$dbconfig = $this->getDbConfig($config);
82
+		$this->setOptions($config);
83 83
 
84
-		$taskPaths = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get()->getSetupPaths( $template );
84
+		$taskPaths = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get()->getSetupPaths($template);
85 85
 
86 86
 		$includePaths = $taskPaths;
87 87
 		$includePaths[] = get_include_path();
88 88
 
89
-		if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) {
90
-			throw new Exception( 'Unable to extend include path' );
89
+		if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) {
90
+			throw new Exception('Unable to extend include path');
91 91
 		}
92 92
 
93
-		spl_autoload_register( '\Aimeos\Shop\Command\SetupCommand::autoload', true );
93
+		spl_autoload_register('\Aimeos\Shop\Command\SetupCommand::autoload', true);
94 94
 
95
-		$manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx );
95
+		$manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx);
96 96
 
97
-		$this->info( sprintf( 'Initializing or updating the Aimeos database tables for site "%1$s"', $site ) );
97
+		$this->info(sprintf('Initializing or updating the Aimeos database tables for site "%1$s"', $site));
98 98
 
99
-		$manager->run( 'mysql' );
99
+		$manager->run('mysql');
100 100
 	}
101 101
 
102 102
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	protected function getArguments()
109 109
 	{
110 110
 		return array(
111
-			array( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ),
112
-			array( 'tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default' ),
111
+			array('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'),
112
+			array('tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default'),
113 113
 		);
114 114
 	}
115 115
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	protected function getOptions()
123 123
 	{
124 124
 		return array(
125
-			array( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() ),
125
+			array('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array()),
126 126
 		);
127 127
 	}
128 128
 
@@ -133,14 +133,14 @@  discard block
 block discarded – undo
133 133
 	 * @param \Aimeos\MW\Config\Iface $conf Config object
134 134
 	 * @return array Multi-dimensional associative list of database configuration parameters
135 135
 	 */
136
-	protected function getDbConfig( \Aimeos\MW\Config\Iface $conf )
136
+	protected function getDbConfig(\Aimeos\MW\Config\Iface $conf)
137 137
 	{
138
-		$dbconfig = $conf->get( 'resource', array() );
138
+		$dbconfig = $conf->get('resource', array());
139 139
 
140
-		foreach( $dbconfig as $rname => $dbconf )
140
+		foreach ($dbconfig as $rname => $dbconf)
141 141
 		{
142
-			if( strncmp( $rname, 'db', 2 ) !== 0 ) {
143
-				unset( $dbconfig[$rname] );
142
+			if (strncmp($rname, 'db', 2) !== 0) {
143
+				unset($dbconfig[$rname]);
144 144
 			}
145 145
 		}
146 146
 
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
 	 * @param array Associative list of database configurations
156 156
 	 * @throws \RuntimeException If the format of the options is invalid
157 157
 	 */
158
-	protected function setOptions( \Aimeos\MW\Config\Iface $conf )
158
+	protected function setOptions(\Aimeos\MW\Config\Iface $conf)
159 159
 	{
160
-		foreach( (array) $this->option( 'option' ) as $option )
160
+		foreach ((array) $this->option('option') as $option)
161 161
 		{
162
-			list( $name, $value ) = explode( ':', $option );
163
-			$conf->set( $name, $value );
162
+			list($name, $value) = explode(':', $option);
163
+			$conf->set($name, $value);
164 164
 		}
165 165
 	}
166 166
 }
Please login to merge, or discard this patch.
src/Aimeos/Shop/Base/I18n.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @param \Aimeos\Shop\Base\Aimeos $aimeos Aimeos object
41 41
 	 * @param \Illuminate\Contracts\Config\Repository $config Configuration object
42 42
 	 */
43
-	public function __construct( \Aimeos\Shop\Base\Aimeos $aimeos, \Illuminate\Contracts\Config\Repository $config )
43
+	public function __construct(\Aimeos\Shop\Base\Aimeos $aimeos, \Illuminate\Contracts\Config\Repository $config)
44 44
 	{
45 45
 		$this->aimeos = $aimeos;
46 46
 		$this->config = $config;
@@ -53,22 +53,22 @@  discard block
 block discarded – undo
53 53
 	 * @param array $languageIds List of two letter ISO language IDs
54 54
 	 * @return \Aimeos\MW\Translation\Iface[] List of translation objects
55 55
 	 */
56
-	public function get( array $languageIds )
56
+	public function get(array $languageIds)
57 57
 	{
58 58
 		$i18nPaths = $this->aimeos->get()->getI18nPaths();
59 59
 
60
-		foreach( $languageIds as $langid )
60
+		foreach ($languageIds as $langid)
61 61
 		{
62
-			if( !isset( $this->i18n[$langid] ) )
62
+			if (!isset($this->i18n[$langid]))
63 63
 			{
64
-				$i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $langid );
64
+				$i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $langid);
65 65
 
66
-				if( function_exists( 'apc_store' ) === true && $this->config->get( 'shop.apc_enabled', false ) == true ) {
67
-					$i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $this->config->get( 'shop.apc_prefix', 'laravel:' ) );
66
+				if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) {
67
+					$i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $this->config->get('shop.apc_prefix', 'laravel:'));
68 68
 				}
69 69
 
70
-				if( $this->config->has( 'shop.i18n.' . $langid ) ) {
71
-					$i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $this->config->get( 'shop.i18n.' . $langid ) );
70
+				if ($this->config->has('shop.i18n.'.$langid)) {
71
+					$i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $this->config->get('shop.i18n.'.$langid));
72 72
 				}
73 73
 
74 74
 				$this->i18n[$langid] = $i18n;
Please login to merge, or discard this patch.
src/default.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -4,20 +4,20 @@  discard block
 block discarded – undo
4 4
 
5 5
 	'apc_enabled' => false,
6 6
 	'apc_prefix' => 'laravel:',
7
-	'extdir' => ( is_dir(base_path('ext')) ? base_path('ext') : dirname(__DIR__) . DIRECTORY_SEPARATOR . 'ext' ),
7
+	'extdir' => (is_dir(base_path('ext')) ? base_path('ext') : dirname(__DIR__).DIRECTORY_SEPARATOR.'ext'),
8 8
 	'uploaddir' => '/',
9 9
 
10 10
 	'page' => array(
11
-		'account-index' => array( 'account/history','account/favorite','account/watch','basket/mini','catalog/session' ),
12
-		'basket-index' => array( 'basket/standard','basket/related' ),
13
-		'catalog-count' => array( 'catalog/count' ),
14
-		'catalog-detail' => array( 'basket/mini','catalog/stage','catalog/detail','catalog/session' ),
15
-		'catalog-list' => array( 'basket/mini','catalog/filter','catalog/stage','catalog/lists' ),
16
-		'catalog-stock' => array( 'catalog/stock' ),
17
-		'catalog-suggest' => array( 'catalog/suggest' ),
18
-		'checkout-confirm' => array( 'checkout/confirm' ),
19
-		'checkout-index' => array( 'checkout/standard' ),
20
-		'checkout-update' => array( 'checkout/update'),
11
+		'account-index' => array('account/history', 'account/favorite', 'account/watch', 'basket/mini', 'catalog/session'),
12
+		'basket-index' => array('basket/standard', 'basket/related'),
13
+		'catalog-count' => array('catalog/count'),
14
+		'catalog-detail' => array('basket/mini', 'catalog/stage', 'catalog/detail', 'catalog/session'),
15
+		'catalog-list' => array('basket/mini', 'catalog/filter', 'catalog/stage', 'catalog/lists'),
16
+		'catalog-stock' => array('catalog/stock'),
17
+		'catalog-suggest' => array('catalog/suggest'),
18
+		'checkout-confirm' => array('checkout/confirm'),
19
+		'checkout-index' => array('checkout/standard'),
20
+		'checkout-update' => array('checkout/update'),
21 21
 	),
22 22
 
23 23
 	'resource' => array(
@@ -28,24 +28,24 @@  discard block
 block discarded – undo
28 28
 			'database' => env('DB_DATABASE', 'laravel'),
29 29
 			'username' => env('DB_USERNAME', 'root'),
30 30
 			'password' => env('DB_PASSWORD', ''),
31
-			'stmt' => array( "SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'" ),
31
+			'stmt' => array("SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'"),
32 32
 			'opt-persistent' => 0,
33 33
 			'limit' => 2,
34 34
 		),
35 35
 		'fs' => array(
36 36
 			'adapter' => 'Standard',
37 37
 			'basedir' => public_path(),
38
-			'tempdir' => storage_path( 'tmp' ),
38
+			'tempdir' => storage_path('tmp'),
39 39
 		),
40 40
 		'fs-admin' => array(
41 41
 			'adapter' => 'Standard',
42
-			'basedir' => public_path( 'uploads' ),
43
-			'tempdir' => storage_path( 'tmp' ),
42
+			'basedir' => public_path('uploads'),
43
+			'tempdir' => storage_path('tmp'),
44 44
 		),
45 45
 		'fs-secure' => array(
46 46
 			'adapter' => 'Standard',
47
-			'basedir' => storage_path( 'secure' ),
48
-			'tempdir' => storage_path( 'tmp' ),
47
+			'basedir' => storage_path('secure'),
48
+			'tempdir' => storage_path('tmp'),
49 49
 		),
50 50
 		'mq' => array(
51 51
 			'adapter' => 'Standard',
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 						# in the "maxwidth" parameter
268 268
 						# 'maxheight' => 280,
269 269
 					),
270
-					'tempdir' => storage_path( 'aimeos' ),
270
+					'tempdir' => storage_path('aimeos'),
271 271
 				),
272 272
 			),
273 273
 		),
Please login to merge, or discard this patch.
src/Aimeos/Shop/Base/Context.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * @param \Illuminate\Contracts\Config\Repository $config Configuration object
51 51
 	 * @param \Illuminate\Session\Store $session Laravel session object
52 52
 	 */
53
-	public function __construct( \Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session )
53
+	public function __construct(\Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session)
54 54
 	{
55 55
 		$this->config = $config;
56 56
 		$this->session = $session;
@@ -63,51 +63,51 @@  discard block
 block discarded – undo
63 63
 	 * @param boolean $locale True to add locale object to context, false if not
64 64
 	 * @return \Aimeos\MShop\Context\Item\Iface Context object
65 65
 	 */
66
-	public function get( $locale = true )
66
+	public function get($locale = true)
67 67
 	{
68
-		if( self::$context === null )
68
+		if (self::$context === null)
69 69
 		{
70 70
 			$context = new \Aimeos\MShop\Context\Item\Standard();
71 71
 
72 72
 			$config = $this->getConfig();
73
-			$context->setConfig( $config );
73
+			$context->setConfig($config);
74 74
 
75
-			$dbm = new \Aimeos\MW\DB\Manager\DBAL( $config );
76
-			$context->setDatabaseManager( $dbm );
75
+			$dbm = new \Aimeos\MW\DB\Manager\DBAL($config);
76
+			$context->setDatabaseManager($dbm);
77 77
 
78
-			$fs = new \Aimeos\MW\Filesystem\Manager\Laravel( app( 'filesystem' ), $config, storage_path( 'aimeos' ) );
79
-			$context->setFilesystemManager( $fs );
78
+			$fs = new \Aimeos\MW\Filesystem\Manager\Laravel(app('filesystem'), $config, storage_path('aimeos'));
79
+			$context->setFilesystemManager($fs);
80 80
 
81
-			$mq = new \Aimeos\MW\MQueue\Manager\Standard( $config );
82
-			$context->setMessageQueueManager( $mq );
81
+			$mq = new \Aimeos\MW\MQueue\Manager\Standard($config);
82
+			$context->setMessageQueueManager($mq);
83 83
 
84
-			$mail = new \Aimeos\MW\Mail\Swift( function() { return app( 'mailer' )->getSwiftMailer(); } );
85
-			$context->setMail( $mail );
84
+			$mail = new \Aimeos\MW\Mail\Swift(function() { return app('mailer')->getSwiftMailer(); } );
85
+			$context->setMail($mail);
86 86
 
87
-			$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context );
88
-			$context->setLogger( $logger );
87
+			$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context);
88
+			$context->setLogger($logger);
89 89
 
90
-			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context );
91
-			$context->setCache( $cache );
90
+			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context);
91
+			$context->setCache($cache);
92 92
 
93 93
 			self::$context = $context;
94 94
 		}
95 95
 
96 96
 		$context = self::$context;
97 97
 
98
-		if( $locale === true )
98
+		if ($locale === true)
99 99
 		{
100
-			$localeItem = $this->getLocale( $context );
100
+			$localeItem = $this->getLocale($context);
101 101
 			$langid = $localeItem->getLanguageId();
102 102
 
103
-			$context->setLocale( $localeItem );
104
-			$context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $langid ) ) );
103
+			$context->setLocale($localeItem);
104
+			$context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($langid)));
105 105
 		}
106 106
 
107
-		$session = new \Aimeos\MW\Session\Laravel5( $this->session );
108
-		$context->setSession( $session );
107
+		$session = new \Aimeos\MW\Session\Laravel5($this->session);
108
+		$context->setSession($session);
109 109
 
110
-		$this->addUser( $context );
110
+		$this->addUser($context);
111 111
 
112 112
 		return $context;
113 113
 	}
@@ -118,20 +118,20 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
120 120
 	 */
121
-	protected function addUser( \Aimeos\MShop\Context\Item\Iface $context )
121
+	protected function addUser(\Aimeos\MShop\Context\Item\Iface $context)
122 122
 	{
123
-		if( ( $userid = Auth::id() ) !== null )
123
+		if (($userid = Auth::id()) !== null)
124 124
 		{
125
-			$context->setUserId( $userid );
126
-			$context->setGroupIds( function() use ( $context, $userid )
125
+			$context->setUserId($userid);
126
+			$context->setGroupIds(function() use ($context, $userid)
127 127
 			{
128
-				$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
129
-				return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups();
128
+				$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
129
+				return $manager->getItem($userid, array('customer/group'))->getGroups();
130 130
 			} );
131 131
 		}
132 132
 
133
-		if( ( $user = Auth::user() ) !== null ) {
134
-			$context->setEditor( $user->name );
133
+		if (($user = Auth::user()) !== null) {
134
+			$context->setEditor($user->name);
135 135
 		}
136 136
 	}
137 137
 
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	protected function getConfig()
145 145
 	{
146
-		$configPaths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getConfigPaths();
147
-		$config = new \Aimeos\MW\Config\PHPArray( $this->config->get( 'shop' ), $configPaths );
146
+		$configPaths = app('\Aimeos\Shop\Base\Aimeos')->get()->getConfigPaths();
147
+		$config = new \Aimeos\MW\Config\PHPArray($this->config->get('shop'), $configPaths);
148 148
 
149
-		if( function_exists( 'apc_store' ) === true && $this->config->get( 'shop.apc_enabled', false ) == true ) {
150
-			$config = new \Aimeos\MW\Config\Decorator\APC( $config, $this->config->get( 'shop.apc_prefix', 'laravel:' ) );
149
+		if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) {
150
+			$config = new \Aimeos\MW\Config\Decorator\APC($config, $this->config->get('shop.apc_prefix', 'laravel:'));
151 151
 		}
152 152
 
153 153
 		return $config;
@@ -160,18 +160,18 @@  discard block
 block discarded – undo
160 160
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
161 161
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item object
162 162
 	 */
163
-	protected function getLocale( \Aimeos\MShop\Context\Item\Iface $context )
163
+	protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context)
164 164
 	{
165
-		if( $this->locale === null )
165
+		if ($this->locale === null)
166 166
 		{
167
-			$site = Route::input( 'site', Input::get( 'site', 'default' ) );
168
-			$currency = Route::input( 'currency', Input::get( 'currency', '' ) );
169
-			$lang = Route::input( 'locale', Input::get( 'locale', '' ) );
167
+			$site = Route::input('site', Input::get('site', 'default'));
168
+			$currency = Route::input('currency', Input::get('currency', ''));
169
+			$lang = Route::input('locale', Input::get('locale', ''));
170 170
 
171
-			$disableSites = $this->config->get( 'shop.disableSites', true );
171
+			$disableSites = $this->config->get('shop.disableSites', true);
172 172
 
173
-			$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
174
-			$this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites );
173
+			$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
174
+			$this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites);
175 175
 		}
176 176
 
177 177
 		return $this->locale;
Please login to merge, or discard this patch.
src/Aimeos/Shop/Controller/JsonadmController.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 	 * @param \Illuminate\Http\Request $request Request object
36 36
 	 * @return \Illuminate\Http\Response Response object containing the generated output
37 37
 	 */
38
-	public function deleteAction( Request $request )
38
+	public function deleteAction(Request $request)
39 39
 	{
40
-		if( config( 'shop.authorize', true ) ) {
41
-			$this->authorize( 'admin', [['admin']] );
40
+		if (config('shop.authorize', true)) {
41
+			$this->authorize('admin', [['admin']]);
42 42
 		}
43 43
 
44 44
 		$status = 500;
45 45
 		$header = $request->headers->all();
46 46
 
47 47
 		$client = $this->createClient();
48
-		$result = $client->delete( (string) $request->getContent(), $header, $status );
48
+		$result = $client->delete((string) $request->getContent(), $header, $status);
49 49
 
50
-		return $this->createResponse( $result, $status, $header );
50
+		return $this->createResponse($result, $status, $header);
51 51
 	}
52 52
 
53 53
 
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
 	 * @param \Illuminate\Http\Request $request Request object
58 58
 	 * @return \Illuminate\Http\Response Response object containing the generated output
59 59
 	 */
60
-	public function getAction( Request $request )
60
+	public function getAction(Request $request)
61 61
 	{
62
-		if( config( 'shop.authorize', true ) ) {
63
-			$this->authorize( 'admin', [['admin', 'editor']] );
62
+		if (config('shop.authorize', true)) {
63
+			$this->authorize('admin', [['admin', 'editor']]);
64 64
 		}
65 65
 
66 66
 		$status = 500;
67 67
 		$header = $request->headers->all();
68 68
 
69 69
 		$client = $this->createClient();
70
-		$result = $client->get( (string) $request->getContent(), $header, $status );
70
+		$result = $client->get((string) $request->getContent(), $header, $status);
71 71
 
72
-		return $this->createResponse( $result, $status, $header );
72
+		return $this->createResponse($result, $status, $header);
73 73
 	}
74 74
 
75 75
 
@@ -79,19 +79,19 @@  discard block
 block discarded – undo
79 79
 	 * @param \Illuminate\Http\Request $request Request object
80 80
 	 * @return \Illuminate\Http\Response Response object containing the generated output
81 81
 	 */
82
-	public function patchAction( Request $request )
82
+	public function patchAction(Request $request)
83 83
 	{
84
-		if( config( 'shop.authorize', true ) ) {
85
-			$this->authorize( 'admin', [['admin']] );
84
+		if (config('shop.authorize', true)) {
85
+			$this->authorize('admin', [['admin']]);
86 86
 		}
87 87
 
88 88
 		$status = 500;
89 89
 		$header = $request->headers->all();
90 90
 
91 91
 		$client = $this->createClient();
92
-		$result = $client->patch( (string) $request->getContent(), $header, $status );
92
+		$result = $client->patch((string) $request->getContent(), $header, $status);
93 93
 
94
-		return $this->createResponse( $result, $status, $header );
94
+		return $this->createResponse($result, $status, $header);
95 95
 	}
96 96
 
97 97
 
@@ -101,19 +101,19 @@  discard block
 block discarded – undo
101 101
 	 * @param \Illuminate\Http\Request $request Request object
102 102
 	 * @return \Illuminate\Http\Response Response object containing the generated output
103 103
 	 */
104
-	public function postAction( Request $request )
104
+	public function postAction(Request $request)
105 105
 	{
106
-		if( config( 'shop.authorize', true ) ) {
107
-			$this->authorize( 'admin', [['admin']] );
106
+		if (config('shop.authorize', true)) {
107
+			$this->authorize('admin', [['admin']]);
108 108
 		}
109 109
 
110 110
 		$status = 500;
111 111
 		$header = $request->headers->all();
112 112
 
113 113
 		$client = $this->createClient();
114
-		$result = $client->post( (string) $request->getContent(), $header, $status );
114
+		$result = $client->post((string) $request->getContent(), $header, $status);
115 115
 
116
-		return $this->createResponse( $result, $status, $header );
116
+		return $this->createResponse($result, $status, $header);
117 117
 	}
118 118
 
119 119
 
@@ -123,19 +123,19 @@  discard block
 block discarded – undo
123 123
 	 * @param \Illuminate\Http\Request $request Request object
124 124
 	 * @return \Illuminate\Http\Response Response object containing the generated output
125 125
 	 */
126
-	public function putAction( Request $request )
126
+	public function putAction(Request $request)
127 127
 	{
128
-		if( config( 'shop.authorize', true ) ) {
129
-			$this->authorize( 'admin', [['admin']] );
128
+		if (config('shop.authorize', true)) {
129
+			$this->authorize('admin', [['admin']]);
130 130
 		}
131 131
 
132 132
 		$status = 500;
133 133
 		$header = $request->headers->all();
134 134
 
135 135
 		$client = $this->createClient();
136
-		$result = $client->put( (string) $request->getContent(), $header, $status );
136
+		$result = $client->put((string) $request->getContent(), $header, $status);
137 137
 
138
-		return $this->createResponse( $result, $status, $header );
138
+		return $this->createResponse($result, $status, $header);
139 139
 	}
140 140
 
141 141
 
@@ -145,19 +145,19 @@  discard block
 block discarded – undo
145 145
 	 * @param \Illuminate\Http\Request $request Request object
146 146
 	 * @return \Illuminate\Http\Response Response object containing the generated output
147 147
 	 */
148
-	public function optionsAction( Request $request )
148
+	public function optionsAction(Request $request)
149 149
 	{
150
-		if( config( 'shop.authorize', true ) ) {
151
-			$this->authorize( 'admin', [['admin', 'editor']] );
150
+		if (config('shop.authorize', true)) {
151
+			$this->authorize('admin', [['admin', 'editor']]);
152 152
 		}
153 153
 
154 154
 		$status = 500;
155 155
 		$header = $request->headers->all();
156 156
 
157 157
 		$client = $this->createClient();
158
-		$result = $client->options( (string) $request->getContent(), $header, $status );
158
+		$result = $client->options((string) $request->getContent(), $header, $status);
159 159
 
160
-		return $this->createResponse( $result, $status, $header );
160
+		return $this->createResponse($result, $status, $header);
161 161
 	}
162 162
 
163 163
 
@@ -168,20 +168,20 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	protected function createClient()
170 170
 	{
171
-		$site = Route::input( 'site', Input::get( 'site', 'default' ) );
172
-		$lang = Input::get( 'lang', config( 'app.locale', 'en' ) );
173
-		$resource = Route::input( 'resource' );
171
+		$site = Route::input('site', Input::get('site', 'default'));
172
+		$lang = Input::get('lang', config('app.locale', 'en'));
173
+		$resource = Route::input('resource');
174 174
 
175
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get();
176
-		$templatePaths = $aimeos->getCustomPaths( 'admin/jsonadm/templates' );
175
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos')->get();
176
+		$templatePaths = $aimeos->getCustomPaths('admin/jsonadm/templates');
177 177
 
178
-		$context = app( '\Aimeos\Shop\Base\Context' )->get( false );
179
-		$context = $this->setLocale( $context, $site, $lang );
178
+		$context = app('\Aimeos\Shop\Base\Context')->get(false);
179
+		$context = $this->setLocale($context, $site, $lang);
180 180
 
181
-		$view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $templatePaths, $lang );
182
-		$context->setView( $view );
181
+		$view = app('\Aimeos\Shop\Base\View')->create($context->getConfig(), $templatePaths, $lang);
182
+		$context->setView($view);
183 183
 
184
-		return \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, $resource );
184
+		return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource);
185 185
 	}
186 186
 
187 187
 
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 	 * @param array $header List of HTTP headers
194 194
 	 * @return \Illuminate\Http\Response HTTP response object
195 195
 	 */
196
-	protected function createResponse( $content, $status, array $header )
196
+	protected function createResponse($content, $status, array $header)
197 197
 	{
198
-		$response = Response::make( $content, $status );
198
+		$response = Response::make($content, $status);
199 199
 
200
-		foreach( $header as $key => $value ) {
201
-			$response->header( $key, $value );
200
+		foreach ($header as $key => $value) {
201
+			$response->header($key, $value);
202 202
 		}
203 203
 
204 204
 		return $response;
@@ -213,23 +213,23 @@  discard block
 block discarded – undo
213 213
 	 * @param string $lang ISO language code, e.g. "en" or "en_GB"
214 214
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
215 215
 	 */
216
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang )
216
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang)
217 217
 	{
218
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
218
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
219 219
 
220 220
 		try
221 221
 		{
222
-			$localeItem = $localeManager->bootstrap( $sitecode, '', '', false );
223
-			$localeItem->setLanguageId( null );
224
-			$localeItem->setCurrencyId( null );
222
+			$localeItem = $localeManager->bootstrap($sitecode, '', '', false);
223
+			$localeItem->setLanguageId(null);
224
+			$localeItem->setCurrencyId(null);
225 225
 		}
226
-		catch( \Aimeos\MShop\Locale\Exception $e )
226
+		catch (\Aimeos\MShop\Locale\Exception $e)
227 227
 		{
228 228
 			$localeItem = $localeManager->createItem();
229 229
 		}
230 230
 
231
-		$context->setLocale( $localeItem );
232
-		$context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang ) ) );
231
+		$context->setLocale($localeItem);
232
+		$context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang)));
233 233
 
234 234
 		return $context;
235 235
 	}
Please login to merge, or discard this patch.
src/Aimeos/Shop/Controller/ExtadmController.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -34,64 +34,64 @@  discard block
 block discarded – undo
34 34
 	 * @param \Illuminate\Http\Request $request Laravel request object
35 35
 	 * @return \Illuminate\Contracts\View\View View for rendering the output
36 36
 	 */
37
-	public function indexAction( Request $request )
37
+	public function indexAction(Request $request)
38 38
 	{
39
-		if( config( 'shop.authorize', true ) ) {
40
-			$this->authorize( 'admin', [['admin']] );
39
+		if (config('shop.authorize', true)) {
40
+			$this->authorize('admin', [['admin']]);
41 41
 		}
42 42
 
43
-		$site = Route::input( 'site', Input::get( 'site', 'default' ) );
44
-		$lang = Route::input( 'lang', Input::get( 'lang', config( 'app.locale', 'en' ) ) );
45
-		$tab = Route::input( 'tab', Input::get( 'tab', 0 ) );
43
+		$site = Route::input('site', Input::get('site', 'default'));
44
+		$lang = Route::input('lang', Input::get('lang', config('app.locale', 'en')));
45
+		$tab = Route::input('tab', Input::get('tab', 0));
46 46
 
47
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' );
47
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos');
48 48
 
49 49
 		$bootstrap = $aimeos->get();
50
-		$cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' );
50
+		$cntlPaths = $bootstrap->getCustomPaths('controller/extjs');
51 51
 
52
-		$context = app( '\Aimeos\Shop\Base\Context' )->get( false );
53
-		$context = $this->setLocale( $context, $site );
52
+		$context = app('\Aimeos\Shop\Base\Context')->get(false);
53
+		$context = $this->setLocale($context, $site);
54 54
 
55
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
55
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
56 56
 		$cssFiles = array();
57 57
 
58
-		foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths )
58
+		foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths)
59 59
 		{
60
-			foreach( $paths as $path )
60
+			foreach ($paths as $path)
61 61
 			{
62
-				$jsbAbsPath = $base . '/' . $path;
62
+				$jsbAbsPath = $base.'/'.$path;
63 63
 
64
-				if( !is_file( $jsbAbsPath ) ) {
65
-					throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) );
64
+				if (!is_file($jsbAbsPath)) {
65
+					throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath));
66 66
 				}
67 67
 
68
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) );
69
-				$cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) );
68
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path));
69
+				$cssFiles = array_merge($cssFiles, $jsb2->getUrls('css'));
70 70
 			}
71 71
 		}
72 72
 
73
-		$jqadmUrl = route( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) );
74
-		$jsonUrl = route( 'aimeos_shop_extadm_json', array( 'site' => $site, '_token' => csrf_token() ) );
75
-		$adminUrl = route( 'aimeos_shop_extadm', array( 'site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>' ) );
73
+		$jqadmUrl = route('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product'));
74
+		$jsonUrl = route('aimeos_shop_extadm_json', array('site' => $site, '_token' => csrf_token()));
75
+		$adminUrl = route('aimeos_shop_extadm', array('site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>'));
76 76
 
77 77
 		$vars = array(
78 78
 			'lang' => $lang,
79 79
 			'cssFiles' => $cssFiles,
80
-			'languages' => $this->getJsonLanguages( $context),
81
-			'config' => $this->getJsonClientConfig( $context ),
82
-			'site' => $this->getJsonSiteItem( $context, $site ),
83
-			'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ),
80
+			'languages' => $this->getJsonLanguages($context),
81
+			'config' => $this->getJsonClientConfig($context),
82
+			'site' => $this->getJsonSiteItem($context, $site),
83
+			'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang),
84 84
 			'searchSchemas' => $controller->getJsonSearchSchemas(),
85 85
 			'itemSchemas' => $controller->getJsonItemSchemas(),
86
-			'smd' => $controller->getJsonSmd( $jsonUrl ),
87
-			'urlTemplate' => str_replace( ['<', '>'], ['{', '}'], urldecode( $adminUrl ) ),
88
-			'uploaddir' => config( 'shop::uploaddir' ),
86
+			'smd' => $controller->getJsonSmd($jsonUrl),
87
+			'urlTemplate' => str_replace(['<', '>'], ['{', '}'], urldecode($adminUrl)),
88
+			'uploaddir' => config('shop::uploaddir'),
89 89
 			'version' => $aimeos->getVersion(),
90 90
 			'jqadmurl' => $jqadmUrl,
91 91
 			'activeTab' => $tab,
92 92
 		);
93 93
 
94
-		return View::make( 'shop::extadm.index', $vars );
94
+		return View::make('shop::extadm.index', $vars);
95 95
 	}
96 96
 
97 97
 
@@ -101,23 +101,23 @@  discard block
 block discarded – undo
101 101
 	 * @param \Illuminate\Http\Request $request Laravel request object
102 102
 	 * @return \Illuminate\Contracts\View\View View for rendering the output
103 103
 	 */
104
-	public function doAction( Request $request )
104
+	public function doAction(Request $request)
105 105
 	{
106
-		if( config( 'shop.authorize', true ) ) {
107
-			$this->authorize( 'admin', [['admin']] );
106
+		if (config('shop.authorize', true)) {
107
+			$this->authorize('admin', [['admin']]);
108 108
 		}
109 109
 
110
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get();
111
-		$cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' );
110
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos')->get();
111
+		$cntlPaths = $aimeos->getCustomPaths('controller/extjs');
112 112
 
113
-		$context = app( '\Aimeos\Shop\Base\Context' )->get( false );
114
-		$context->setView( app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), array() ) );
115
-		$context = $this->setLocale( $context );
113
+		$context = app('\Aimeos\Shop\Base\Context')->get(false);
114
+		$context->setView(app('\Aimeos\Shop\Base\View')->create($context->getConfig(), array()));
115
+		$context = $this->setLocale($context);
116 116
 
117
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
117
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
118 118
 
119
-		$response = $controller->process( Input::instance()->request->all(), $request->getContent() );
120
-		return View::make( 'shop::extadm.do', array( 'output' => $response ) );
119
+		$response = $controller->process(Input::instance()->request->all(), $request->getContent());
120
+		return View::make('shop::extadm.do', array('output' => $response));
121 121
 	}
122 122
 
123 123
 
@@ -128,32 +128,32 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public function fileAction()
130 130
 	{
131
-		if( config( 'shop.authorize', true ) ) {
132
-			$this->authorize( 'admin', [['admin']] );
131
+		if (config('shop.authorize', true)) {
132
+			$this->authorize('admin', [['admin']]);
133 133
 		}
134 134
 
135 135
 		$contents = '';
136 136
 		$jsFiles = array();
137
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get();
137
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos')->get();
138 138
 
139
-		foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths )
139
+		foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths)
140 140
 		{
141
-			foreach( $paths as $path )
141
+			foreach ($paths as $path)
142 142
 			{
143
-				$jsbAbsPath = $base . '/' . $path;
144
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) );
145
-				$jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) );
143
+				$jsbAbsPath = $base.'/'.$path;
144
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath));
145
+				$jsFiles = array_merge($jsFiles, $jsb2->getFiles('js'));
146 146
 			}
147 147
 		}
148 148
 
149
-		foreach( $jsFiles as $file )
149
+		foreach ($jsFiles as $file)
150 150
 		{
151
-			if( ( $content = file_get_contents( $file ) ) !== false ) {
151
+			if (($content = file_get_contents($file)) !== false) {
152 152
 				$contents .= $content;
153 153
 			}
154 154
 		}
155 155
 
156
-		return response( $contents )->header( 'Content-Type', 'application/javascript' );
156
+		return response($contents)->header('Content-Type', 'application/javascript');
157 157
 	}
158 158
 
159 159
 
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
164 164
 	 * @return array List of language IDs with labels
165 165
 	 */
166
-	protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context )
166
+	protected function getJsonLanguages(\Aimeos\MShop\Context\Item\Iface $context)
167 167
 	{
168 168
 		$result = array();
169 169
 
170
-		foreach( app( '\Aimeos\Shop\Base\Aimeos' )->get()->getI18nList( 'admin' ) as $id ) {
171
-			$result[] = array( 'id' => $id, 'label' => $id );
170
+		foreach (app('\Aimeos\Shop\Base\Aimeos')->get()->getI18nList('admin') as $id) {
171
+			$result[] = array('id' => $id, 'label' => $id);
172 172
 		}
173 173
 
174
-		return json_encode( $result );
174
+		return json_encode($result);
175 175
 	}
176 176
 
177 177
 
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context item object
182 182
 	 * @return string JSON encoded configuration object
183 183
 	 */
184
-	protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context )
184
+	protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context)
185 185
 	{
186
-		$config = $context->getConfig()->get( 'admin/extjs', array() );
187
-		return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT );
186
+		$config = $context->getConfig()->get('admin/extjs', array());
187
+		return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT);
188 188
 	}
189 189
 
190 190
 
@@ -195,16 +195,16 @@  discard block
 block discarded – undo
195 195
 	 * @param string $lang ISO language code like "en" or "en_GB"
196 196
 	 * @return string JSON encoded translation object
197 197
 	 */
198
-	protected function getJsonClientI18n( array $i18nPaths, $lang )
198
+	protected function getJsonClientI18n(array $i18nPaths, $lang)
199 199
 	{
200
-		$i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang );
200
+		$i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang);
201 201
 
202 202
 		$content = array(
203
-			'admin' => $i18n->getAll( 'admin' ),
204
-			'admin/ext' => $i18n->getAll( 'admin/ext' ),
203
+			'admin' => $i18n->getAll('admin'),
204
+			'admin/ext' => $i18n->getAll('admin/ext'),
205 205
 		);
206 206
 
207
-		return json_encode( $content, JSON_FORCE_OBJECT );
207
+		return json_encode($content, JSON_FORCE_OBJECT);
208 208
 	}
209 209
 
210 210
 
@@ -216,19 +216,19 @@  discard block
 block discarded – undo
216 216
 	 * @return string JSON encoded site item object
217 217
 	 * @throws Exception If no site item was found for the code
218 218
 	 */
219
-	protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site )
219
+	protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site)
220 220
 	{
221
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' );
221
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site');
222 222
 
223 223
 		$criteria = $manager->createSearch();
224
-		$criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) );
225
-		$items = $manager->searchItems( $criteria );
224
+		$criteria->setConditions($criteria->compare('==', 'locale.site.code', $site));
225
+		$items = $manager->searchItems($criteria);
226 226
 
227
-		if( ( $item = reset( $items ) ) === false ) {
228
-			throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) );
227
+		if (($item = reset($items)) === false) {
228
+			throw new \Exception(sprintf('No site found for code "%1$s"', $site));
229 229
 		}
230 230
 
231
-		return json_encode( $item->toArray() );
231
+		return json_encode($item->toArray());
232 232
 	}
233 233
 
234 234
 
@@ -240,22 +240,22 @@  discard block
 block discarded – undo
240 240
 	 * @param string $locale ISO language code, e.g. "en" or "en_GB"
241 241
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
242 242
 	 */
243
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default' )
243
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default')
244 244
 	{
245
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
245
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
246 246
 
247 247
 		try
248 248
 		{
249
-			$localeItem = $localeManager->bootstrap( $sitecode, '', '', false );
250
-			$localeItem->setLanguageId( null );
251
-			$localeItem->setCurrencyId( null );
249
+			$localeItem = $localeManager->bootstrap($sitecode, '', '', false);
250
+			$localeItem->setLanguageId(null);
251
+			$localeItem->setCurrencyId(null);
252 252
 		}
253
-		catch( \Aimeos\MShop\Locale\Exception $e )
253
+		catch (\Aimeos\MShop\Locale\Exception $e)
254 254
 		{
255 255
 			$localeItem = $localeManager->createItem();
256 256
 		}
257 257
 
258
-		$context->setLocale( $localeItem );
258
+		$context->setLocale($localeItem);
259 259
 
260 260
 		return $context;
261 261
 	}
Please login to merge, or discard this patch.
src/Aimeos/Shop/Base/Support.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param \Aimeos\Shop\Base\Context $context Context provider
31 31
 	 */
32
-	public function __construct( \Aimeos\Shop\Base\Context $context, $site )
32
+	public function __construct(\Aimeos\Shop\Base\Context $context, $site)
33 33
 	{
34
-		$this->context = $context->get( false );
35
-		$this->context = $this->setLocale( $this->context, $site );
34
+		$this->context = $context->get(false);
35
+		$this->context = $this->setLocale($this->context, $site);
36 36
 	}
37 37
 
38 38
 
@@ -43,21 +43,21 @@  discard block
 block discarded – undo
43 43
 	 * @param string|array $groupcodes Unique user/customer group codes that are allowed
44 44
 	 * @return boolean True if user is part of the group, false if not
45 45
 	 */
46
-	public function checkGroup( $userid, $groupcodes )
46
+	public function checkGroup($userid, $groupcodes)
47 47
 	{
48
-		$groupItems = $this->getGroups( (array) $groupcodes );
49
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/lists' );
48
+		$groupItems = $this->getGroups((array) $groupcodes);
49
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/lists');
50 50
 
51 51
 		$search = $manager->createSearch();
52 52
 		$expr = array(
53
-			$search->compare( '==', 'customer.lists.parentid', $userid ),
54
-			$search->compare( '==', 'customer.lists.refid', array_keys( $groupItems ) ),
55
-			$search->compare( '==', 'customer.lists.domain', 'customer/group' ),
53
+			$search->compare('==', 'customer.lists.parentid', $userid),
54
+			$search->compare('==', 'customer.lists.refid', array_keys($groupItems)),
55
+			$search->compare('==', 'customer.lists.domain', 'customer/group'),
56 56
 		);
57
-		$search->setConditions( $search->combine( '&&', $expr ) );
58
-		$search->setSlice( 0, 1 );
57
+		$search->setConditions($search->combine('&&', $expr));
58
+		$search->setSlice(0, 1);
59 59
 
60
-		return (bool) count( $manager->searchItems( $search ) );
60
+		return (bool) count($manager->searchItems($search));
61 61
 	}
62 62
 
63 63
 
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
 	 * @param array $codes List of group codes
68 68
 	 * @return array Associative list of group IDs as keys and \Aimeos\MShop\Customer\Item\Group\Iface as values
69 69
 	 */
70
-	protected function getGroups( array $codes )
70
+	protected function getGroups(array $codes)
71 71
 	{
72
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/group' );
72
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/group');
73 73
 
74 74
 		$search = $manager->createSearch();
75
-		$search->setConditions( $search->compare( '==', 'customer.group.code', $codes ) );
75
+		$search->setConditions($search->compare('==', 'customer.group.code', $codes));
76 76
 
77
-		return $manager->searchItems( $search );
77
+		return $manager->searchItems($search);
78 78
 	}
79 79
 
80 80
 
@@ -85,22 +85,22 @@  discard block
 block discarded – undo
85 85
 	 * @param string Unique site code
86 86
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
87 87
 	 */
88
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site )
88
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site)
89 89
 	{
90
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
90
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
91 91
 
92 92
 		try
93 93
 		{
94
-			$localeItem = $localeManager->bootstrap( $site, '', '', false );
95
-			$localeItem->setLanguageId( null );
96
-			$localeItem->setCurrencyId( null );
94
+			$localeItem = $localeManager->bootstrap($site, '', '', false);
95
+			$localeItem->setLanguageId(null);
96
+			$localeItem->setCurrencyId(null);
97 97
 		}
98
-		catch( \Aimeos\MShop\Locale\Exception $e )
98
+		catch (\Aimeos\MShop\Locale\Exception $e)
99 99
 		{
100 100
 			$localeItem = $localeManager->createItem();
101 101
 		}
102 102
 
103
-		$context->setLocale( $localeItem );
103
+		$context->setLocale($localeItem);
104 104
 
105 105
 		return $context;
106 106
 	}
Please login to merge, or discard this patch.