@@ -11,10 +11,10 @@ |
||
11 | 11 | { |
12 | 12 | $client = static::createClient(); |
13 | 13 | |
14 | - $client->request( 'GET', '/admin' ); |
|
14 | + $client->request('GET', '/admin'); |
|
15 | 15 | $response = $client->getResponse(); |
16 | 16 | |
17 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
18 | - $this->assertContains( '<form class="login"', $response->getContent() ); |
|
17 | + $this->assertEquals(200, $response->getStatusCode()); |
|
18 | + $this->assertContains('<form class="login"', $response->getContent()); |
|
19 | 19 | } |
20 | 20 | } |
@@ -28,18 +28,18 @@ discard block |
||
28 | 28 | * @param Event $event Event instance |
29 | 29 | * @throws \RuntimeException If an error occured |
30 | 30 | */ |
31 | - public static function setupDatabase( Event $event ) |
|
31 | + public static function setupDatabase(Event $event) |
|
32 | 32 | { |
33 | 33 | $options = $env = array(); |
34 | 34 | |
35 | - if( $event->isDevMode() ) { |
|
35 | + if ($event->isDevMode()) { |
|
36 | 36 | $options[] = '--option=setup/default/demo:1'; |
37 | 37 | } else { |
38 | 38 | $env[] = '--env=prod'; |
39 | 39 | } |
40 | 40 | |
41 | - self::executeCommand( $event, 'aimeos:setup', $options + $env ); |
|
42 | - self::executeCommand( $event, 'aimeos:cache', $env ); |
|
41 | + self::executeCommand($event, 'aimeos:setup', $options + $env); |
|
42 | + self::executeCommand($event, 'aimeos:cache', $env); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | * @param Event $event Event instance |
50 | 50 | * @throws \RuntimeException If an error occured |
51 | 51 | */ |
52 | - public static function updateConfig( Event $event ) |
|
52 | + public static function updateConfig(Event $event) |
|
53 | 53 | { |
54 | - $event->getIO()->write( 'Ensure existing config and routing for the shop bundle' ); |
|
54 | + $event->getIO()->write('Ensure existing config and routing for the shop bundle'); |
|
55 | 55 | |
56 | - $options = self::getOptions( $event ); |
|
56 | + $options = self::getOptions($event); |
|
57 | 57 | |
58 | - if( isset( $options['symfony-app-dir'] ) ) |
|
58 | + if (isset($options['symfony-app-dir'])) |
|
59 | 59 | { |
60 | - self::updateConfigFile( $options['symfony-app-dir'] . '/config/config.yml' ); |
|
61 | - self::updateRoutingFile( $options['symfony-app-dir'] . '/config/routing.yml' ); |
|
60 | + self::updateConfigFile($options['symfony-app-dir'].'/config/config.yml'); |
|
61 | + self::updateRoutingFile($options['symfony-app-dir'].'/config/routing.yml'); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -69,26 +69,26 @@ discard block |
||
69 | 69 | * @param Event $event Event instance |
70 | 70 | * @throws \RuntimeException If an error occured |
71 | 71 | */ |
72 | - public static function installBundle( Event $event ) |
|
72 | + public static function installBundle(Event $event) |
|
73 | 73 | { |
74 | - $event->getIO()->write( 'Installing the Aimeos shop bundle' ); |
|
74 | + $event->getIO()->write('Installing the Aimeos shop bundle'); |
|
75 | 75 | |
76 | - $options = self::getOptions( $event ); |
|
76 | + $options = self::getOptions($event); |
|
77 | 77 | $securedir = 'var'; |
78 | 78 | |
79 | - if( isset( $options['symfony-app-dir'] ) && is_dir( $options['symfony-app-dir'] ) ) { |
|
79 | + if (isset($options['symfony-app-dir']) && is_dir($options['symfony-app-dir'])) { |
|
80 | 80 | $securedir = $options['symfony-app-dir']; |
81 | 81 | } |
82 | 82 | |
83 | - if( isset( $options['symfony-var-dir'] ) && is_dir( $options['symfony-var-dir'] ) ) { |
|
83 | + if (isset($options['symfony-var-dir']) && is_dir($options['symfony-var-dir'])) { |
|
84 | 84 | $securedir = $options['symfony-var-dir']; |
85 | 85 | } |
86 | 86 | |
87 | - $webdir = ( isset( $options['symfony-web-dir'] ) ? $options['symfony-web-dir'] : 'public' ); |
|
87 | + $webdir = (isset($options['symfony-web-dir']) ? $options['symfony-web-dir'] : 'public'); |
|
88 | 88 | |
89 | - self::createDirectory( $securedir . '/secure' ); |
|
90 | - self::createDirectory( $webdir . '/preview' ); |
|
91 | - self::createDirectory( $webdir . '/files' ); |
|
89 | + self::createDirectory($securedir.'/secure'); |
|
90 | + self::createDirectory($webdir.'/preview'); |
|
91 | + self::createDirectory($webdir.'/files'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | * @param string $dir Absolute path of the new directory |
99 | 99 | * @throws \RuntimeException If directory couldn't be created |
100 | 100 | */ |
101 | - protected static function createDirectory( $dir ) |
|
101 | + protected static function createDirectory($dir) |
|
102 | 102 | { |
103 | 103 | $perm = 0755; |
104 | 104 | |
105 | - if( !is_dir( $dir ) && !mkdir( $dir, $perm, true ) ) |
|
105 | + if (!is_dir($dir) && !mkdir($dir, $perm, true)) |
|
106 | 106 | { |
107 | 107 | $msg = 'Unable to create directory "%1$s" with permission "%2$s"'; |
108 | - throw new \RuntimeException( sprintf( $msg, $dir, $perm ) ); |
|
108 | + throw new \RuntimeException(sprintf($msg, $dir, $perm)); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -118,28 +118,28 @@ discard block |
||
118 | 118 | * @param array List of configuration options for the given command |
119 | 119 | * @throws \RuntimeException If the command couldn't be executed |
120 | 120 | */ |
121 | - protected static function executeCommand( Event $event, $cmd, array $options = array() ) |
|
121 | + protected static function executeCommand(Event $event, $cmd, array $options = array()) |
|
122 | 122 | { |
123 | - $php = escapeshellarg( self::getPhp() ); |
|
124 | - $console = escapeshellarg( self::getConsoleDir( $event ) . '/console' ); |
|
125 | - $cmd = escapeshellarg( $cmd ); |
|
123 | + $php = escapeshellarg(self::getPhp()); |
|
124 | + $console = escapeshellarg(self::getConsoleDir($event).'/console'); |
|
125 | + $cmd = escapeshellarg($cmd); |
|
126 | 126 | |
127 | - foreach( $options as $key => $option ) { |
|
128 | - $options[$key] = escapeshellarg( $option ); |
|
127 | + foreach ($options as $key => $option) { |
|
128 | + $options[$key] = escapeshellarg($option); |
|
129 | 129 | } |
130 | 130 | |
131 | - if( $event->getIO()->isDecorated() ) { |
|
131 | + if ($event->getIO()->isDecorated()) { |
|
132 | 132 | $console .= ' --ansi'; |
133 | 133 | } |
134 | 134 | |
135 | - $process = new Process( $php . ' ' . $console . ' ' . $cmd . ' ' . implode( ' ', $options ), null, null, null, 3600 ); |
|
135 | + $process = new Process($php.' '.$console.' '.$cmd.' '.implode(' ', $options), null, null, null, 3600); |
|
136 | 136 | |
137 | - $process->run( function( $type, $buffer ) use ( $event ) { |
|
138 | - $event->getIO()->write( $buffer, false ); |
|
137 | + $process->run(function($type, $buffer) use ($event) { |
|
138 | + $event->getIO()->write($buffer, false); |
|
139 | 139 | } ); |
140 | 140 | |
141 | - if( !$process->isSuccessful() ) { |
|
142 | - throw new \RuntimeException( sprintf( 'An error occurred when executing the "%s" command', escapeshellarg( $cmd ) ) ); |
|
141 | + if (!$process->isSuccessful()) { |
|
142 | + throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command', escapeshellarg($cmd))); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | * @return string The path to the console directory |
153 | 153 | * @throws \RuntimeException If console directory couldn't be found |
154 | 154 | */ |
155 | - protected static function getConsoleDir( Event $event ) |
|
155 | + protected static function getConsoleDir(Event $event) |
|
156 | 156 | { |
157 | - $options = self::getOptions( $event ); |
|
157 | + $options = self::getOptions($event); |
|
158 | 158 | |
159 | 159 | $bindir = 'bin'; |
160 | 160 | |
161 | - if( isset( $options['symfony-app-dir'] ) && is_dir( $options['symfony-app-dir'] ) ) { |
|
161 | + if (isset($options['symfony-app-dir']) && is_dir($options['symfony-app-dir'])) { |
|
162 | 162 | $bindir = $options['symfony-app-dir']; |
163 | 163 | } |
164 | 164 | |
165 | - if( isset( $options['symfony-bin-dir'] ) && is_dir( $options['symfony-bin-dir'] ) ) { |
|
165 | + if (isset($options['symfony-bin-dir']) && is_dir($options['symfony-bin-dir'])) { |
|
166 | 166 | $bindir = $options['symfony-bin-dir']; |
167 | 167 | } |
168 | 168 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @param Event $event Command event object |
177 | 177 | * @return array Associative list of option keys and values |
178 | 178 | */ |
179 | - protected static function getOptions( Event $event ) |
|
179 | + protected static function getOptions(Event $event) |
|
180 | 180 | { |
181 | 181 | return $event->getComposer()->getPackage()->getExtra(); |
182 | 182 | } |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | { |
193 | 193 | $phpFinder = new PhpExecutableFinder; |
194 | 194 | |
195 | - if( !( $phpPath = $phpFinder->find() ) ) { |
|
196 | - throw new \RuntimeException( 'The php executable could not be found, add it to your PATH environment variable and try again' ); |
|
195 | + if (!($phpPath = $phpFinder->find())) { |
|
196 | + throw new \RuntimeException('The php executable could not be found, add it to your PATH environment variable and try again'); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | return $phpPath; |
@@ -206,15 +206,15 @@ discard block |
||
206 | 206 | * @param string $filename Name of the YAML config file |
207 | 207 | * @throws \RuntimeException If file is not found |
208 | 208 | */ |
209 | - protected static function updateConfigFile( $filename ) |
|
209 | + protected static function updateConfigFile($filename) |
|
210 | 210 | { |
211 | - if( ( $content = file_get_contents( $filename ) ) === false ) { |
|
212 | - throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) ); |
|
211 | + if (($content = file_get_contents($filename)) === false) { |
|
212 | + throw new \RuntimeException(sprintf('File "%1$s" not found', $filename)); |
|
213 | 213 | } |
214 | 214 | |
215 | - if( self::addAsseticBundle( $content ) === true ) { |
|
215 | + if (self::addAsseticBundle($content) === true) { |
|
216 | 216 | $fs = new Filesystem(); |
217 | - $fs->dumpFile( $filename, $content ); |
|
217 | + $fs->dumpFile($filename, $content); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
@@ -225,29 +225,29 @@ discard block |
||
225 | 225 | * @param string $filename Name of the YAML config file |
226 | 226 | * @throws \RuntimeException If file is not found |
227 | 227 | */ |
228 | - protected static function updateRoutingFile( $filename ) |
|
228 | + protected static function updateRoutingFile($filename) |
|
229 | 229 | { |
230 | 230 | $content = ''; |
231 | 231 | |
232 | - if( file_exists( $filename ) && ( $content = file_get_contents( $filename ) ) === false ) { |
|
233 | - throw new \RuntimeException( sprintf( 'File "%1$s" not readable', $filename ) ); |
|
232 | + if (file_exists($filename) && ($content = file_get_contents($filename)) === false) { |
|
233 | + throw new \RuntimeException(sprintf('File "%1$s" not readable', $filename)); |
|
234 | 234 | } |
235 | 235 | |
236 | - if( strpos( $content, 'fos_user:' ) === false ) |
|
236 | + if (strpos($content, 'fos_user:') === false) |
|
237 | 237 | { |
238 | - $content .= "\n" . 'fos_user: |
|
238 | + $content .= "\n".'fos_user: |
|
239 | 239 | resource: "@FOSUserBundle/Resources/config/routing/all.xml"'; |
240 | 240 | } |
241 | 241 | |
242 | - if( strpos( $content, 'aimeos_shop:' ) === false ) |
|
242 | + if (strpos($content, 'aimeos_shop:') === false) |
|
243 | 243 | { |
244 | - $content .= "\n" . 'aimeos_shop: |
|
244 | + $content .= "\n".'aimeos_shop: |
|
245 | 245 | resource: "@AimeosShopBundle/Resources/config/routing.yml" |
246 | 246 | prefix: /'; |
247 | 247 | } |
248 | 248 | |
249 | 249 | $fs = new Filesystem(); |
250 | - $fs->dumpFile( $filename, $content ); |
|
250 | + $fs->dumpFile($filename, $content); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
@@ -257,14 +257,14 @@ discard block |
||
257 | 257 | * @param string &$content Content of the config.yml file |
258 | 258 | * @return boolean True if modified, false if not |
259 | 259 | */ |
260 | - protected static function addAsseticBundle( &$content ) |
|
260 | + protected static function addAsseticBundle(&$content) |
|
261 | 261 | { |
262 | - if( preg_match( "/ bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content ) !== 1 ) |
|
262 | + if (preg_match("/ bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content) !== 1) |
|
263 | 263 | { |
264 | - $search = array( "/ bundles:[ ]*\[([^\]]+)\]/", "/ bundles:[ ]*\[([ ]*)\]/" ); |
|
265 | - $replace = array( " bundles: [$1,'AimeosShopBundle']", " bundles: ['AimeosShopBundle']" ); |
|
264 | + $search = array("/ bundles:[ ]*\[([^\]]+)\]/", "/ bundles:[ ]*\[([ ]*)\]/"); |
|
265 | + $replace = array(" bundles: [$1,'AimeosShopBundle']", " bundles: ['AimeosShopBundle']"); |
|
266 | 266 | |
267 | - if( ( $content = preg_replace( $search, $replace, $content ) ) !== null ) { |
|
267 | + if (($content = preg_replace($search, $replace, $content)) !== null) { |
|
268 | 268 | return true; |
269 | 269 | } |
270 | 270 | } |
@@ -119,7 +119,7 @@ |
||
119 | 119 | * @param string $site Unique site code |
120 | 120 | * @param string Resource location, e.g. "product/property/type" |
121 | 121 | * @param string $lang Language code |
122 | - * @return \Aimeos\MShop\Context\Item\Iface Context item |
|
122 | + * @return \Aimeos\Admin\JsonAdm\Iface Context item |
|
123 | 123 | */ |
124 | 124 | protected function createAdmin( $site, $resource, $lang ) |
125 | 125 | { |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | * @param string $site Unique site code |
32 | 32 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
33 | 33 | */ |
34 | - public function deleteAction( ServerRequestInterface $request, $resource, $site = 'default' ) |
|
34 | + public function deleteAction(ServerRequestInterface $request, $resource, $site = 'default') |
|
35 | 35 | { |
36 | - $client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) ); |
|
37 | - return $client->delete( $request, new Response() ); |
|
36 | + $client = $this->createAdmin($site, $resource, $request->getAttribute('lang', 'en')); |
|
37 | + return $client->delete($request, new Response()); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | * @param string $site Unique site code |
47 | 47 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
48 | 48 | */ |
49 | - public function getAction( ServerRequestInterface $request, $resource, $site = 'default' ) |
|
49 | + public function getAction(ServerRequestInterface $request, $resource, $site = 'default') |
|
50 | 50 | { |
51 | - $client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) ); |
|
52 | - return $client->get( $request, new Response() ); |
|
51 | + $client = $this->createAdmin($site, $resource, $request->getAttribute('lang', 'en')); |
|
52 | + return $client->get($request, new Response()); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | * @param string $site Unique site code |
62 | 62 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
63 | 63 | */ |
64 | - public function patchAction( ServerRequestInterface $request, $resource, $site = 'default' ) |
|
64 | + public function patchAction(ServerRequestInterface $request, $resource, $site = 'default') |
|
65 | 65 | { |
66 | - $client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) ); |
|
67 | - return $client->patch( $request, new Response() ); |
|
66 | + $client = $this->createAdmin($site, $resource, $request->getAttribute('lang', 'en')); |
|
67 | + return $client->patch($request, new Response()); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | * @param string $site Unique site code |
77 | 77 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
78 | 78 | */ |
79 | - public function postAction( ServerRequestInterface $request, $resource, $site = 'default' ) |
|
79 | + public function postAction(ServerRequestInterface $request, $resource, $site = 'default') |
|
80 | 80 | { |
81 | - $client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) ); |
|
82 | - return $client->post( $request, new Response() ); |
|
81 | + $client = $this->createAdmin($site, $resource, $request->getAttribute('lang', 'en')); |
|
82 | + return $client->post($request, new Response()); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | * @param string $site Unique site code |
92 | 92 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
93 | 93 | */ |
94 | - public function putAction( ServerRequestInterface $request, $resource, $site = 'default' ) |
|
94 | + public function putAction(ServerRequestInterface $request, $resource, $site = 'default') |
|
95 | 95 | { |
96 | - $client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) ); |
|
97 | - return $client->put( $request, new Response() ); |
|
96 | + $client = $this->createAdmin($site, $resource, $request->getAttribute('lang', 'en')); |
|
97 | + return $client->put($request, new Response()); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | * @param string $site Unique site code |
107 | 107 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
108 | 108 | */ |
109 | - public function optionsAction( ServerRequestInterface $request, $resource = '', $site = 'default' ) |
|
109 | + public function optionsAction(ServerRequestInterface $request, $resource = '', $site = 'default') |
|
110 | 110 | { |
111 | - $client = $this->createAdmin( $site, $resource, $request->getAttribute( 'lang', 'en' ) ); |
|
112 | - return $client->options( $request, new Response() ); |
|
111 | + $client = $this->createAdmin($site, $resource, $request->getAttribute('lang', 'en')); |
|
112 | + return $client->options($request, new Response()); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -121,18 +121,18 @@ discard block |
||
121 | 121 | * @param string $lang Language code |
122 | 122 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
123 | 123 | */ |
124 | - protected function createAdmin( $site, $resource, $lang ) |
|
124 | + protected function createAdmin($site, $resource, $lang) |
|
125 | 125 | { |
126 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
127 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jsonadm/templates' ); |
|
126 | + $aimeos = $this->get('aimeos')->get(); |
|
127 | + $templatePaths = $aimeos->getCustomPaths('admin/jsonadm/templates'); |
|
128 | 128 | |
129 | - $context = $this->get( 'aimeos.context' )->get( false, 'backend' ); |
|
130 | - $context->setI18n( $this->get('aimeos.i18n')->get( array( $lang, 'en' ) ) ); |
|
131 | - $context->setLocale( $this->get('aimeos.locale')->getBackend( $context, $site ) ); |
|
129 | + $context = $this->get('aimeos.context')->get(false, 'backend'); |
|
130 | + $context->setI18n($this->get('aimeos.i18n')->get(array($lang, 'en'))); |
|
131 | + $context->setLocale($this->get('aimeos.locale')->getBackend($context, $site)); |
|
132 | 132 | |
133 | - $view = $this->get('aimeos.view')->create( $context, $templatePaths, $lang ); |
|
134 | - $context->setView( $view ); |
|
133 | + $view = $this->get('aimeos.view')->create($context, $templatePaths, $lang); |
|
134 | + $context->setView($view); |
|
135 | 135 | |
136 | - return \Aimeos\Admin\JsonAdm::create( $context, $aimeos, $resource ); |
|
136 | + return \Aimeos\Admin\JsonAdm::create($context, $aimeos, $resource); |
|
137 | 137 | } |
138 | 138 | } |
@@ -27,15 +27,15 @@ |
||
27 | 27 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
28 | 28 | * @return array List of group codes the user is in |
29 | 29 | */ |
30 | - public function getGroups( \Aimeos\MShop\Context\Item\Iface $context ) |
|
30 | + public function getGroups(\Aimeos\MShop\Context\Item\Iface $context) |
|
31 | 31 | { |
32 | 32 | $list = array(); |
33 | - $manager = \Aimeos\MShop::create( $context, 'customer/group' ); |
|
33 | + $manager = \Aimeos\MShop::create($context, 'customer/group'); |
|
34 | 34 | |
35 | 35 | $search = $manager->createSearch(); |
36 | - $search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) ); |
|
36 | + $search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds())); |
|
37 | 37 | |
38 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
38 | + foreach ($manager->searchItems($search) as $item) { |
|
39 | 39 | $list[] = $item->getCode(); |
40 | 40 | } |
41 | 41 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param RequestStack $requestStack Current request stack |
33 | 33 | * @param Container $container Container object to access parameters |
34 | 34 | */ |
35 | - public function __construct( RequestStack $requestStack, Container $container ) |
|
35 | + public function __construct(RequestStack $requestStack, Container $container) |
|
36 | 36 | { |
37 | 37 | $this->requestStack = $requestStack; |
38 | 38 | $this->container = $container; |
@@ -45,19 +45,19 @@ discard block |
||
45 | 45 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
46 | 46 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
47 | 47 | */ |
48 | - public function get( \Aimeos\MShop\Context\Item\Iface $context ) |
|
48 | + public function get(\Aimeos\MShop\Context\Item\Iface $context) |
|
49 | 49 | { |
50 | - if( $this->locale === null ) |
|
50 | + if ($this->locale === null) |
|
51 | 51 | { |
52 | - $status = $this->container->getParameter( 'aimeos_shop.disable_sites' ); |
|
52 | + $status = $this->container->getParameter('aimeos_shop.disable_sites'); |
|
53 | 53 | $request = $this->requestStack->getMasterRequest(); |
54 | 54 | |
55 | - $site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) ); |
|
56 | - $currency = $request->attributes->get( 'currency', $request->query->get( 'currency', '' ) ); |
|
57 | - $lang = $request->attributes->get( 'locale', $request->query->get( 'locale', '' ) ); |
|
55 | + $site = $request->attributes->get('site', $request->query->get('site', 'default')); |
|
56 | + $currency = $request->attributes->get('currency', $request->query->get('currency', '')); |
|
57 | + $lang = $request->attributes->get('locale', $request->query->get('locale', '')); |
|
58 | 58 | |
59 | - $localeManager = \Aimeos\MShop::create( $context, 'locale' ); |
|
60 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $status ); |
|
59 | + $localeManager = \Aimeos\MShop::create($context, 'locale'); |
|
60 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $status); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $this->locale; |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | * @param string $site Unique site code |
72 | 72 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
73 | 73 | */ |
74 | - public function getBackend( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
74 | + public function getBackend(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
75 | 75 | { |
76 | - $localeManager = \Aimeos\MShop::create( $context, 'locale' ); |
|
76 | + $localeManager = \Aimeos\MShop::create($context, 'locale'); |
|
77 | 77 | |
78 | 78 | try { |
79 | - $localeItem = $localeManager->bootstrap( $site, '', '', false, null, true ); |
|
80 | - } catch( \Aimeos\MShop\Exception $e ) { |
|
79 | + $localeItem = $localeManager->bootstrap($site, '', '', false, null, true); |
|
80 | + } catch (\Aimeos\MShop\Exception $e) { |
|
81 | 81 | $localeItem = $localeManager->createItem(); |
82 | 82 | } |
83 | 83 |
@@ -30,15 +30,15 @@ |
||
30 | 30 | * @param InputInterface $input Input object |
31 | 31 | * @return \Aimeos\MShop\Locale\Item\Site\Interface[] List of site items |
32 | 32 | */ |
33 | - protected function getSiteItems( \Aimeos\MShop\Context\Item\Iface $context, InputInterface $input ) |
|
33 | + protected function getSiteItems(\Aimeos\MShop\Context\Item\Iface $context, InputInterface $input) |
|
34 | 34 | { |
35 | - $manager = \Aimeos\MShop::create( $context, 'locale/site' ); |
|
35 | + $manager = \Aimeos\MShop::create($context, 'locale/site'); |
|
36 | 36 | $search = $manager->createSearch(); |
37 | 37 | |
38 | - if( ( $codes = (string) $input->getArgument( 'site' ) ) !== '' ) { |
|
39 | - $search->setConditions( $search->compare( '==', 'locale.site.code', explode( ' ', $codes ) ) ); |
|
38 | + if (($codes = (string) $input->getArgument('site')) !== '') { |
|
39 | + $search->setConditions($search->compare('==', 'locale.site.code', explode(' ', $codes))); |
|
40 | 40 | } |
41 | 41 | |
42 | - return $manager->searchItems( $search ); |
|
42 | + return $manager->searchItems($search); |
|
43 | 43 | } |
44 | 44 | } |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | $client = static::createClient(array(), array( |
13 | 13 | 'PHP_AUTH_USER' => 'admin', |
14 | 14 | 'PHP_AUTH_PW' => 'adminpass', |
15 | - ) ); |
|
15 | + )); |
|
16 | 16 | |
17 | - $client->request( 'GET', '/unittest/jqadm/file/css' ); |
|
17 | + $client->request('GET', '/unittest/jqadm/file/css'); |
|
18 | 18 | |
19 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
20 | - $this->assertContains( '.aimeos', $client->getResponse()->getContent() ); |
|
19 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
20 | + $this->assertContains('.aimeos', $client->getResponse()->getContent()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | $client = static::createClient(array(), array( |
27 | 27 | 'PHP_AUTH_USER' => 'admin', |
28 | 28 | 'PHP_AUTH_PW' => 'adminpass', |
29 | - ) ); |
|
29 | + )); |
|
30 | 30 | |
31 | - $client->request( 'GET', '/unittest/jqadm/file/js' ); |
|
31 | + $client->request('GET', '/unittest/jqadm/file/js'); |
|
32 | 32 | |
33 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
34 | - $this->assertContains( 'Aimeos = {', $client->getResponse()->getContent() ); |
|
33 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
34 | + $this->assertContains('Aimeos = {', $client->getResponse()->getContent()); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | $client = static::createClient(array(), array( |
41 | 41 | 'PHP_AUTH_USER' => 'admin', |
42 | 42 | 'PHP_AUTH_PW' => 'adminpass', |
43 | - ) ); |
|
43 | + )); |
|
44 | 44 | |
45 | - $client->request( 'GET', '/unittest/jqadm/copy/product/1' ); |
|
45 | + $client->request('GET', '/unittest/jqadm/copy/product/1'); |
|
46 | 46 | $response = $client->getResponse(); |
47 | 47 | |
48 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
49 | - $this->assertContains( 'item-product', $response->getContent() ); |
|
48 | + $this->assertEquals(200, $response->getStatusCode()); |
|
49 | + $this->assertContains('item-product', $response->getContent()); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | $client = static::createClient(array(), array( |
56 | 56 | 'PHP_AUTH_USER' => 'admin', |
57 | 57 | 'PHP_AUTH_PW' => 'adminpass', |
58 | - ) ); |
|
58 | + )); |
|
59 | 59 | |
60 | - $client->request( 'GET', '/unittest/jqadm/create/product' ); |
|
60 | + $client->request('GET', '/unittest/jqadm/create/product'); |
|
61 | 61 | $response = $client->getResponse(); |
62 | 62 | |
63 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
64 | - $this->assertContains( 'item-product', $response->getContent() ); |
|
63 | + $this->assertEquals(200, $response->getStatusCode()); |
|
64 | + $this->assertContains('item-product', $response->getContent()); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | $client = static::createClient(array(), array( |
71 | 71 | 'PHP_AUTH_USER' => 'admin', |
72 | 72 | 'PHP_AUTH_PW' => 'adminpass', |
73 | - ) ); |
|
73 | + )); |
|
74 | 74 | |
75 | - $client->request( 'GET', '/unittest/jqadm/delete/product/0' ); |
|
75 | + $client->request('GET', '/unittest/jqadm/delete/product/0'); |
|
76 | 76 | $response = $client->getResponse(); |
77 | 77 | |
78 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
79 | - $this->assertContains( 'list-items', $response->getContent() ); |
|
78 | + $this->assertEquals(200, $response->getStatusCode()); |
|
79 | + $this->assertContains('list-items', $response->getContent()); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | $client = static::createClient(array(), array( |
86 | 86 | 'PHP_AUTH_USER' => 'admin', |
87 | 87 | 'PHP_AUTH_PW' => 'adminpass', |
88 | - ) ); |
|
88 | + )); |
|
89 | 89 | |
90 | - $client->request( 'GET', '/unittest/jqadm/export/order' ); |
|
90 | + $client->request('GET', '/unittest/jqadm/export/order'); |
|
91 | 91 | $response = $client->getResponse(); |
92 | 92 | |
93 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
94 | - $this->assertContains( 'list-items', $response->getContent() ); |
|
93 | + $this->assertEquals(200, $response->getStatusCode()); |
|
94 | + $this->assertContains('list-items', $response->getContent()); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | $client = static::createClient(array(), array( |
101 | 101 | 'PHP_AUTH_USER' => 'admin', |
102 | 102 | 'PHP_AUTH_PW' => 'adminpass', |
103 | - ) ); |
|
103 | + )); |
|
104 | 104 | |
105 | - $client->request( 'GET', '/unittest/jqadm/get/product/1' ); |
|
105 | + $client->request('GET', '/unittest/jqadm/get/product/1'); |
|
106 | 106 | $response = $client->getResponse(); |
107 | 107 | |
108 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
109 | - $this->assertContains( 'item-product', $response->getContent() ); |
|
108 | + $this->assertEquals(200, $response->getStatusCode()); |
|
109 | + $this->assertContains('item-product', $response->getContent()); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | $client = static::createClient(array(), array( |
116 | 116 | 'PHP_AUTH_USER' => 'admin', |
117 | 117 | 'PHP_AUTH_PW' => 'adminpass', |
118 | - ) ); |
|
118 | + )); |
|
119 | 119 | |
120 | - $client->request( 'POST', '/unittest/jqadm/save/product' ); |
|
120 | + $client->request('POST', '/unittest/jqadm/save/product'); |
|
121 | 121 | $response = $client->getResponse(); |
122 | 122 | |
123 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
124 | - $this->assertContains( 'item-product', $response->getContent() ); |
|
123 | + $this->assertEquals(200, $response->getStatusCode()); |
|
124 | + $this->assertContains('item-product', $response->getContent()); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | $client = static::createClient(array(), array( |
131 | 131 | 'PHP_AUTH_USER' => 'admin', |
132 | 132 | 'PHP_AUTH_PW' => 'adminpass', |
133 | - ) ); |
|
133 | + )); |
|
134 | 134 | |
135 | - $client->request( 'GET', '/unittest/jqadm/search/product' ); |
|
135 | + $client->request('GET', '/unittest/jqadm/search/product'); |
|
136 | 136 | $response = $client->getResponse(); |
137 | 137 | |
138 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
139 | - $this->assertContains( 'list-items', $response->getContent() ); |
|
138 | + $this->assertEquals(200, $response->getStatusCode()); |
|
139 | + $this->assertContains('list-items', $response->getContent()); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | $client = static::createClient(array(), array( |
146 | 146 | 'PHP_AUTH_USER' => 'admin', |
147 | 147 | 'PHP_AUTH_PW' => 'adminpass', |
148 | - ) ); |
|
148 | + )); |
|
149 | 149 | |
150 | - $client->request( 'GET', '/invalid/jqadm/search/product' ); |
|
150 | + $client->request('GET', '/invalid/jqadm/search/product'); |
|
151 | 151 | $response = $client->getResponse(); |
152 | 152 | |
153 | - $this->assertEquals( 500, $response->getStatusCode() ); |
|
153 | + $this->assertEquals(500, $response->getStatusCode()); |
|
154 | 154 | } |
155 | 155 | } |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @param string Resource location, e.g. "customer" |
31 | 31 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
32 | 32 | */ |
33 | - public function deleteAction( ServerRequestInterface $request, $resource ) |
|
33 | + public function deleteAction(ServerRequestInterface $request, $resource) |
|
34 | 34 | { |
35 | - return $this->createClient( $request, $resource )->delete( $request, new Response() ); |
|
35 | + return $this->createClient($request, $resource)->delete($request, new Response()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * @param string Resource location, e.g. "customer" |
44 | 44 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
45 | 45 | */ |
46 | - public function getAction( ServerRequestInterface $request, $resource ) |
|
46 | + public function getAction(ServerRequestInterface $request, $resource) |
|
47 | 47 | { |
48 | - return $this->createClient( $request, $resource )->get( $request, new Response() ); |
|
48 | + return $this->createClient($request, $resource)->get($request, new Response()); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * @param string Resource location, e.g. "customer" |
57 | 57 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
58 | 58 | */ |
59 | - public function patchAction( ServerRequestInterface $request, $resource ) |
|
59 | + public function patchAction(ServerRequestInterface $request, $resource) |
|
60 | 60 | { |
61 | - return $this->createClient( $request, $resource )->patch( $request, new Response() ); |
|
61 | + return $this->createClient($request, $resource)->patch($request, new Response()); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * @param string Resource location, e.g. "customer" |
70 | 70 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
71 | 71 | */ |
72 | - public function postAction( ServerRequestInterface $request, $resource ) |
|
72 | + public function postAction(ServerRequestInterface $request, $resource) |
|
73 | 73 | { |
74 | - return $this->createClient( $request, $resource )->post( $request, new Response() ); |
|
74 | + return $this->createClient($request, $resource)->post($request, new Response()); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * @param string Resource location, e.g. "customer" |
83 | 83 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
84 | 84 | */ |
85 | - public function putAction( ServerRequestInterface $request, $resource ) |
|
85 | + public function putAction(ServerRequestInterface $request, $resource) |
|
86 | 86 | { |
87 | - return $this->createClient( $request, $resource )->put( $request, new Response() ); |
|
87 | + return $this->createClient($request, $resource)->put($request, new Response()); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @param string Resource location, e.g. "customer" |
96 | 96 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
97 | 97 | */ |
98 | - public function optionsAction( ServerRequestInterface $request, $resource = '' ) |
|
98 | + public function optionsAction(ServerRequestInterface $request, $resource = '') |
|
99 | 99 | { |
100 | - return $this->createClient( $request, $resource )->options( $request, new Response() ); |
|
100 | + return $this->createClient($request, $resource)->options($request, new Response()); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -108,19 +108,19 @@ discard block |
||
108 | 108 | * @param string Resource location, e.g. "customer" |
109 | 109 | * @return \Aimeos\Client\JsonApi\Iface JSON API client |
110 | 110 | */ |
111 | - protected function createClient( ServerRequestInterface $request, $resource ) |
|
111 | + protected function createClient(ServerRequestInterface $request, $resource) |
|
112 | 112 | { |
113 | 113 | $args = $request->getAttributes(); |
114 | 114 | $params = $request->getQueryParams(); |
115 | - $related = ( isset( $args['related'] ) ? $args['related'] : ( isset( $params['related'] ) ? $params['related'] : null ) ); |
|
115 | + $related = (isset($args['related']) ? $args['related'] : (isset($params['related']) ? $params['related'] : null)); |
|
116 | 116 | |
117 | - $tmplPaths = $this->container->get( 'aimeos' )->get()->getCustomPaths( 'client/jsonapi/templates' ); |
|
118 | - $context = $this->container->get( 'aimeos.context' )->get(); |
|
117 | + $tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths('client/jsonapi/templates'); |
|
118 | + $context = $this->container->get('aimeos.context')->get(); |
|
119 | 119 | $langid = $context->getLocale()->getLanguageId(); |
120 | 120 | |
121 | - $view = $this->container->get( 'aimeos.view' )->create( $context, $tmplPaths, $langid ); |
|
122 | - $context->setView( $view ); |
|
121 | + $view = $this->container->get('aimeos.view')->create($context, $tmplPaths, $langid); |
|
122 | + $context->setView($view); |
|
123 | 123 | |
124 | - return \Aimeos\Client\JsonApi::create( $context, $resource . '/' . $related ); |
|
124 | + return \Aimeos\Client\JsonApi::create($context, $resource.'/'.$related); |
|
125 | 125 | } |
126 | 126 | } |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | public function indexAction() |
31 | 31 | { |
32 | 32 | $params = []; |
33 | - $shop = $this->container->get( 'shop' ); |
|
33 | + $shop = $this->container->get('shop'); |
|
34 | 34 | |
35 | - foreach( $this->container->getParameter( 'aimeos_shop.page' )['account-index'] as $name ) |
|
35 | + foreach ($this->container->getParameter('aimeos_shop.page')['account-index'] as $name) |
|
36 | 36 | { |
37 | - $params['aiheader'][$name] = $shop->get( $name )->getHeader(); |
|
38 | - $params['aibody'][$name] = $shop->get( $name )->getBody(); |
|
37 | + $params['aiheader'][$name] = $shop->get($name)->getHeader(); |
|
38 | + $params['aibody'][$name] = $shop->get($name)->getBody(); |
|
39 | 39 | } |
40 | 40 | |
41 | - return $this->render( 'AimeosShopBundle:Account:index.html.twig', $params )->setPrivate()->setMaxAge( 300 ); |
|
41 | + return $this->render('AimeosShopBundle:Account:index.html.twig', $params)->setPrivate()->setMaxAge(300); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function downloadAction() |
51 | 51 | { |
52 | - $response = $this->container->get( 'shop' )->get( 'account/download' )->getView()->response(); |
|
53 | - return Response::create( (string) $response->getBody(), $response->getStatusCode(), $response->getHeaders() ); |
|
52 | + $response = $this->container->get('shop')->get('account/download')->getView()->response(); |
|
53 | + return Response::create((string) $response->getBody(), $response->getStatusCode(), $response->getHeaders()); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function favoriteComponentAction() |
63 | 63 | { |
64 | - $client = $this->container->get( 'shop' )->get( 'account/favorite' ); |
|
65 | - $this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() ); |
|
64 | + $client = $this->container->get('shop')->get('account/favorite'); |
|
65 | + $this->container->get('twig')->addGlobal('aiheader', (string) $client->getHeader()); |
|
66 | 66 | |
67 | - return new Response( (string) $client->getBody() ); |
|
67 | + return new Response((string) $client->getBody()); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function historyComponentAction() |
77 | 77 | { |
78 | - $client = $this->container->get( 'shop' )->get( 'account/history' ); |
|
79 | - $this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() ); |
|
78 | + $client = $this->container->get('shop')->get('account/history'); |
|
79 | + $this->container->get('twig')->addGlobal('aiheader', (string) $client->getHeader()); |
|
80 | 80 | |
81 | - return new Response( (string) $client->getBody() ); |
|
81 | + return new Response((string) $client->getBody()); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function profileComponentAction() |
91 | 91 | { |
92 | - $client = $this->container->get( 'shop' )->get( 'account/profile' ); |
|
93 | - $this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() ); |
|
92 | + $client = $this->container->get('shop')->get('account/profile'); |
|
93 | + $this->container->get('twig')->addGlobal('aiheader', (string) $client->getHeader()); |
|
94 | 94 | |
95 | - return new Response( (string) $client->getBody() ); |
|
95 | + return new Response((string) $client->getBody()); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function watchComponentAction() |
105 | 105 | { |
106 | - $client = $this->container->get( 'shop' )->get( 'account/watch' ); |
|
107 | - $this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() ); |
|
106 | + $client = $this->container->get('shop')->get('account/watch'); |
|
107 | + $this->container->get('twig')->addGlobal('aiheader', (string) $client->getHeader()); |
|
108 | 108 | |
109 | - return new Response( (string) $client->getBody() ); |
|
109 | + return new Response((string) $client->getBody()); |
|
110 | 110 | } |
111 | 111 | } |