Completed
Push — master ( fe1a0b...681530 )
by Aimeos
14:27
created
src/Bootstrap.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @param \Slim\App $app Slim application
28 28
 	 * @param array $settings Multi-dimensional array of configuration settings
29 29
 	 */
30
-	public function __construct( \Slim\App $app, array $settings )
30
+	public function __construct(\Slim\App $app, array $settings)
31 31
 	{
32 32
 		$this->app = $app;
33 33
 		$this->settings = $settings;
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
 	 * @param string $path Absolute or relative path to the Aimeos route file
41 41
 	 * @return \Aimeos\Slim\Bootstrap Self instance
42 42
 	 */
43
-	public function routes( $path )
43
+	public function routes($path)
44 44
 	{
45 45
 		$app = $this->app;
46 46
 		$settings = $this->settings;
47 47
 
48
-		$config = function( $key, $default ) use ( $settings )
48
+		$config = function($key, $default) use ($settings)
49 49
 		{
50
-			foreach( explode( '/', trim( $key, '/' ) ) as $part )
50
+			foreach (explode('/', trim($key, '/')) as $part)
51 51
 			{
52
-				if( isset( $settings[$part] ) ) {
52
+				if (isset($settings[$part])) {
53 53
 					$settings = $settings[$part];
54 54
 				} else {
55 55
 					return $default;
@@ -71,52 +71,52 @@  discard block
 block discarded – undo
71 71
 	 * @param string $extdir Absolute or relative path to the Aimeos extension directory
72 72
 	 * @return \Aimeos\Slim\Bootstrap Self instance
73 73
 	 */
74
-	public function setup( $extdir = '../ext' )
74
+	public function setup($extdir = '../ext')
75 75
 	{
76 76
 		$container = $this->app->getContainer();
77 77
 
78
-		$container['router'] = function( $c ) {
78
+		$container['router'] = function($c) {
79 79
 			return new \Aimeos\Slim\Router();
80 80
 		};
81 81
 
82
-		$container['mailer'] = function( $c ) {
83
-			return \Swift_Mailer::newInstance( \Swift_SendmailTransport::newInstance() );
82
+		$container['mailer'] = function($c) {
83
+			return \Swift_Mailer::newInstance(\Swift_SendmailTransport::newInstance());
84 84
 		};
85 85
 
86 86
 
87
-		$default = require __DIR__ . DIRECTORY_SEPARATOR . 'aimeos-default.php';
88
-		$settings = array_replace_recursive( $default, $this->settings );
87
+		$default = require __DIR__.DIRECTORY_SEPARATOR.'aimeos-default.php';
88
+		$settings = array_replace_recursive($default, $this->settings);
89 89
 
90
-		$container['aimeos'] = function( $c ) use ( $extdir ) {
91
-			return new \Aimeos\Bootstrap( (array) $extdir, false );
90
+		$container['aimeos'] = function($c) use ($extdir) {
91
+			return new \Aimeos\Bootstrap((array) $extdir, false);
92 92
 		};
93 93
 
94
-		$container['aimeos_config'] = function( $c ) use ( $settings ) {
95
-			return new \Aimeos\Slim\Base\Config( $c, $settings );
94
+		$container['aimeos_config'] = function($c) use ($settings) {
95
+			return new \Aimeos\Slim\Base\Config($c, $settings);
96 96
 		};
97 97
 
98
-		$container['aimeos_context'] = function( $c ) {
99
-			return new \Aimeos\Slim\Base\Context( $c );
98
+		$container['aimeos_context'] = function($c) {
99
+			return new \Aimeos\Slim\Base\Context($c);
100 100
 		};
101 101
 
102
-		$container['aimeos_i18n'] = function( $c ) {
103
-			return new \Aimeos\Slim\Base\I18n( $c );
102
+		$container['aimeos_i18n'] = function($c) {
103
+			return new \Aimeos\Slim\Base\I18n($c);
104 104
 		};
105 105
 
106
-		$container['aimeos_locale'] = function( $c ) {
107
-			return new \Aimeos\Slim\Base\Locale( $c );
106
+		$container['aimeos_locale'] = function($c) {
107
+			return new \Aimeos\Slim\Base\Locale($c);
108 108
 		};
109 109
 
110
-		$container['aimeos_page'] = function( $c ) {
111
-			return new \Aimeos\Slim\Base\Page( $c );
110
+		$container['aimeos_page'] = function($c) {
111
+			return new \Aimeos\Slim\Base\Page($c);
112 112
 		};
113 113
 
114
-		$container['aimeos_view'] = function( $c ) {
115
-			return new \Aimeos\Slim\Base\View( $c );
114
+		$container['aimeos_view'] = function($c) {
115
+			return new \Aimeos\Slim\Base\View($c);
116 116
 		};
117 117
 
118 118
 		// add client IP address to requests
119
-		$this->app->add( new \RKA\Middleware\IpAddress( true, [] ) );
119
+		$this->app->add(new \RKA\Middleware\IpAddress(true, []));
120 120
 
121 121
 		return $this;
122 122
 	}
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public static function getVersion()
131 131
 	{
132
-		$basedir = dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) . DIRECTORY_SEPARATOR;
132
+		$basedir = dirname(dirname(dirname(dirname(__DIR__)))).DIRECTORY_SEPARATOR;
133 133
 
134
-		if( ( $content = @file_get_contents( $basedir . 'composer.lock' ) ) !== false
135
-			&& ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] )
134
+		if (($content = @file_get_contents($basedir.'composer.lock')) !== false
135
+			&& ($content = json_decode($content, true)) !== null && isset($content['packages'])
136 136
 		) {
137
-			foreach( (array) $content['packages'] as $item )
137
+			foreach ((array) $content['packages'] as $item)
138 138
 			{
139
-				if( $item['name'] === 'aimeos/aimeos-slim' ) {
139
+				if ($item['name'] === 'aimeos/aimeos-slim') {
140 140
 					return $item['version'];
141 141
 				}
142 142
 			}
Please login to merge, or discard this patch.
src/Base/Context.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param ContainerInterface $container Dependency container
31 31
 	 */
32
-	public function __construct( ContainerInterface $container )
32
+	public function __construct(ContainerInterface $container)
33 33
 	{
34 34
 		$this->container = $container;
35 35
 	}
@@ -43,34 +43,34 @@  discard block
 block discarded – undo
43 43
 	 * @param string $type Configuration type ("frontend" or "backend")
44 44
 	 * @return \Aimeos\MShop\Context\Item\Iface Context object
45 45
 	 */
46
-	public function get( $locale = true, array $attributes = array(), $type = 'frontend' )
46
+	public function get($locale = true, array $attributes = array(), $type = 'frontend')
47 47
 	{
48
-		$config = $this->container->get( 'aimeos_config' )->get( $type );
48
+		$config = $this->container->get('aimeos_config')->get($type);
49 49
 
50
-		if( $this->context === null )
50
+		if ($this->context === null)
51 51
 		{
52 52
 			$context = new \Aimeos\MShop\Context\Item\Standard();
53
-			$context->setConfig( $config );
53
+			$context->setConfig($config);
54 54
 
55
-			$this->addDataBaseManager( $context );
56
-			$this->addFilesystemManager( $context );
57
-			$this->addMessageQueueManager( $context );
58
-			$this->addLogger( $context );
59
-			$this->addCache( $context );
60
-			$this->addMailer( $context);
61
-			$this->addSession( $context );
62
-			$this->addUser( $context );
55
+			$this->addDataBaseManager($context);
56
+			$this->addFilesystemManager($context);
57
+			$this->addMessageQueueManager($context);
58
+			$this->addLogger($context);
59
+			$this->addCache($context);
60
+			$this->addMailer($context);
61
+			$this->addSession($context);
62
+			$this->addUser($context);
63 63
 
64 64
 			$this->context = $context;
65 65
 		}
66 66
 
67
-		$this->context->setConfig( $config );
67
+		$this->context->setConfig($config);
68 68
 
69
-		if( $locale === true )
69
+		if ($locale === true)
70 70
 		{
71
-			$localeItem = $this->container->get( 'aimeos_locale' )->get( $this->context, $attributes );
72
-			$this->context->setLocale( $localeItem );
73
-			$this->context->setI18n( $this->container->get( 'aimeos_i18n' )->get( array( $localeItem->getLanguageId() ) ) );
71
+			$localeItem = $this->container->get('aimeos_locale')->get($this->context, $attributes);
72
+			$this->context->setLocale($localeItem);
73
+			$this->context->setI18n($this->container->get('aimeos_i18n')->get(array($localeItem->getLanguageId())));
74 74
 		}
75 75
 
76 76
 		return $this->context;
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object including config
84 84
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
85 85
 	 */
86
-	protected function addCache( \Aimeos\MShop\Context\Item\Iface $context )
86
+	protected function addCache(\Aimeos\MShop\Context\Item\Iface $context)
87 87
 	{
88
-		$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context );
89
-		$context->setCache( $cache );
88
+		$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context);
89
+		$context->setCache($cache);
90 90
 
91 91
 		return $context;
92 92
 	}
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
99 99
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
100 100
 	 */
101
-	protected function addDatabaseManager( \Aimeos\MShop\Context\Item\Iface $context )
101
+	protected function addDatabaseManager(\Aimeos\MShop\Context\Item\Iface $context)
102 102
 	{
103
-		$dbm = new \Aimeos\MW\DB\Manager\DBAL( $context->getConfig() );
104
-		$context->setDatabaseManager( $dbm );
103
+		$dbm = new \Aimeos\MW\DB\Manager\DBAL($context->getConfig());
104
+		$context->setDatabaseManager($dbm);
105 105
 
106 106
 		return $context;
107 107
 	}
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
114 114
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
115 115
 	 */
116
-	protected function addFilesystemManager( \Aimeos\MShop\Context\Item\Iface $context )
116
+	protected function addFilesystemManager(\Aimeos\MShop\Context\Item\Iface $context)
117 117
 	{
118
-		$fs = new \Aimeos\MW\Filesystem\Manager\Standard( $context->getConfig() );
119
-		$context->setFilesystemManager( $fs );
118
+		$fs = new \Aimeos\MW\Filesystem\Manager\Standard($context->getConfig());
119
+		$context->setFilesystemManager($fs);
120 120
 
121 121
 		return $context;
122 122
 	}
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
129 129
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
130 130
 	 */
131
-	protected function addLogger( \Aimeos\MShop\Context\Item\Iface $context )
131
+	protected function addLogger(\Aimeos\MShop\Context\Item\Iface $context)
132 132
 	{
133
-		$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context );
134
-		$context->setLogger( $logger );
133
+		$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context);
134
+		$context->setLogger($logger);
135 135
 
136 136
 		return $context;
137 137
 	}
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
145 145
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
146 146
 	 */
147
-	protected function addMailer( \Aimeos\MShop\Context\Item\Iface $context )
147
+	protected function addMailer(\Aimeos\MShop\Context\Item\Iface $context)
148 148
 	{
149
-		$mail = new \Aimeos\MW\Mail\Swift( $this->container->get( 'mailer' ) );
150
-		$context->setMail( $mail );
149
+		$mail = new \Aimeos\MW\Mail\Swift($this->container->get('mailer'));
150
+		$context->setMail($mail);
151 151
 
152 152
 		return $context;
153 153
 	}
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
160 160
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
161 161
 	 */
162
-	protected function addMessageQueueManager( \Aimeos\MShop\Context\Item\Iface $context )
162
+	protected function addMessageQueueManager(\Aimeos\MShop\Context\Item\Iface $context)
163 163
 	{
164
-		$mq = new \Aimeos\MW\MQueue\Manager\Standard( $context->getConfig() );
165
-		$context->setMessageQueueManager( $mq );
164
+		$mq = new \Aimeos\MW\MQueue\Manager\Standard($context->getConfig());
165
+		$context->setMessageQueueManager($mq);
166 166
 
167 167
 		return $context;
168 168
 	}
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
175 175
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
176 176
 	 */
177
-	protected function addSession( \Aimeos\MShop\Context\Item\Iface $context )
177
+	protected function addSession(\Aimeos\MShop\Context\Item\Iface $context)
178 178
 	{
179 179
 		$session = new \Aimeos\MW\Session\PHP();
180
-		$context->setSession( $session );
180
+		$context->setSession($session);
181 181
 
182 182
 		return $context;
183 183
 	}
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
190 190
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
191 191
 	 */
192
-	protected function addUser( \Aimeos\MShop\Context\Item\Iface $context )
192
+	protected function addUser(\Aimeos\MShop\Context\Item\Iface $context)
193 193
 	{
194 194
 		$ipaddr = $this->container->request->getAttribute('ip_address');
195
-		$context->setEditor( $ipaddr );
195
+		$context->setEditor($ipaddr);
196 196
 
197 197
 		return $context;
198 198
 	}
Please login to merge, or discard this patch.