Completed
Push — master ( 008b5d...87a11c )
by Aimeos
03:29
created
src/Aimeos/Shop/Base/Context.php 1 patch
Spacing   +44 added lines, -44 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,14 +143,14 @@  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( array(), $configPaths );
146
+		$configPaths = app('\Aimeos\Shop\Base\Aimeos')->get()->getConfigPaths();
147
+		$config = new \Aimeos\MW\Config\PHPArray(array(), $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
-		return new \Aimeos\MW\Config\Decorator\Memory( $config, $this->config->get( 'shop' ) );
153
+		return new \Aimeos\MW\Config\Decorator\Memory($config, $this->config->get('shop'));
154 154
 	}
155 155
 
156 156
 
@@ -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.