@@ -31,15 +31,15 @@ discard block |
||
| 31 | 31 | * @param string $site Unique site code |
| 32 | 32 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
| 33 | 33 | */ |
| 34 | - public function deleteAction( Request $request, $resource, $site = 'default' ) |
|
| 34 | + public function deleteAction(Request $request, $resource, $site = 'default') |
|
| 35 | 35 | { |
| 36 | 36 | $status = 500; |
| 37 | 37 | $header = $request->headers->all(); |
| 38 | 38 | |
| 39 | - $client = $this->createClient( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
| 40 | - $result = $client->delete( $request->getContent(), $header, $status ); |
|
| 39 | + $client = $this->createClient($site, $resource, $request->get('lang', 'en')); |
|
| 40 | + $result = $client->delete($request->getContent(), $header, $status); |
|
| 41 | 41 | |
| 42 | - return $this->createResponse( $result, $status, $header ); |
|
| 42 | + return $this->createResponse($result, $status, $header); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -51,15 +51,15 @@ discard block |
||
| 51 | 51 | * @param string $site Unique site code |
| 52 | 52 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
| 53 | 53 | */ |
| 54 | - public function getAction( Request $request, $resource, $site = 'default' ) |
|
| 54 | + public function getAction(Request $request, $resource, $site = 'default') |
|
| 55 | 55 | { |
| 56 | 56 | $status = 500; |
| 57 | 57 | $header = $request->headers->all(); |
| 58 | 58 | |
| 59 | - $client = $this->createClient( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
| 60 | - $result = $client->get( $request->getContent(), $header, $status ); |
|
| 59 | + $client = $this->createClient($site, $resource, $request->get('lang', 'en')); |
|
| 60 | + $result = $client->get($request->getContent(), $header, $status); |
|
| 61 | 61 | |
| 62 | - return $this->createResponse( $result, $status, $header ); |
|
| 62 | + return $this->createResponse($result, $status, $header); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
@@ -71,15 +71,15 @@ discard block |
||
| 71 | 71 | * @param string $site Unique site code |
| 72 | 72 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
| 73 | 73 | */ |
| 74 | - public function patchAction( Request $request, $resource, $site = 'default' ) |
|
| 74 | + public function patchAction(Request $request, $resource, $site = 'default') |
|
| 75 | 75 | { |
| 76 | 76 | $status = 500; |
| 77 | 77 | $header = $request->headers->all(); |
| 78 | 78 | |
| 79 | - $client = $this->createClient( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
| 80 | - $result = $client->patch( $request->getContent(), $header, $status ); |
|
| 79 | + $client = $this->createClient($site, $resource, $request->get('lang', 'en')); |
|
| 80 | + $result = $client->patch($request->getContent(), $header, $status); |
|
| 81 | 81 | |
| 82 | - return $this->createResponse( $result, $status, $header ); |
|
| 82 | + return $this->createResponse($result, $status, $header); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
@@ -91,15 +91,15 @@ discard block |
||
| 91 | 91 | * @param string $site Unique site code |
| 92 | 92 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
| 93 | 93 | */ |
| 94 | - public function postAction( Request $request, $resource, $site = 'default' ) |
|
| 94 | + public function postAction(Request $request, $resource, $site = 'default') |
|
| 95 | 95 | { |
| 96 | 96 | $status = 500; |
| 97 | 97 | $header = $request->headers->all(); |
| 98 | 98 | |
| 99 | - $client = $this->createClient( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
| 100 | - $result = $client->post( $request->getContent(), $header, $status ); |
|
| 99 | + $client = $this->createClient($site, $resource, $request->get('lang', 'en')); |
|
| 100 | + $result = $client->post($request->getContent(), $header, $status); |
|
| 101 | 101 | |
| 102 | - return $this->createResponse( $result, $status, $header ); |
|
| 102 | + return $this->createResponse($result, $status, $header); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -111,15 +111,15 @@ discard block |
||
| 111 | 111 | * @param string $site Unique site code |
| 112 | 112 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
| 113 | 113 | */ |
| 114 | - public function putAction( Request $request, $resource, $site = 'default' ) |
|
| 114 | + public function putAction(Request $request, $resource, $site = 'default') |
|
| 115 | 115 | { |
| 116 | 116 | $status = 500; |
| 117 | 117 | $header = $request->headers->all(); |
| 118 | 118 | |
| 119 | - $client = $this->createClient( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
| 120 | - $result = $client->put( $request->getContent(), $header, $status ); |
|
| 119 | + $client = $this->createClient($site, $resource, $request->get('lang', 'en')); |
|
| 120 | + $result = $client->put($request->getContent(), $header, $status); |
|
| 121 | 121 | |
| 122 | - return $this->createResponse( $result, $status, $header ); |
|
| 122 | + return $this->createResponse($result, $status, $header); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |
@@ -131,15 +131,15 @@ discard block |
||
| 131 | 131 | * @param string $site Unique site code |
| 132 | 132 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
| 133 | 133 | */ |
| 134 | - public function optionsAction( Request $request, $resource = '', $site = 'default' ) |
|
| 134 | + public function optionsAction(Request $request, $resource = '', $site = 'default') |
|
| 135 | 135 | { |
| 136 | 136 | $status = 500; |
| 137 | 137 | $header = $request->headers->all(); |
| 138 | 138 | |
| 139 | - $client = $this->createClient( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
| 140 | - $result = $client->options( $request->getContent(), $header, $status ); |
|
| 139 | + $client = $this->createClient($site, $resource, $request->get('lang', 'en')); |
|
| 140 | + $result = $client->options($request->getContent(), $header, $status); |
|
| 141 | 141 | |
| 142 | - return $this->createResponse( $result, $status, $header ); |
|
| 142 | + return $this->createResponse($result, $status, $header); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
@@ -151,18 +151,18 @@ discard block |
||
| 151 | 151 | * @param string $lang Language code |
| 152 | 152 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
| 153 | 153 | */ |
| 154 | - protected function createClient( $site, $resource, $lang ) |
|
| 154 | + protected function createClient($site, $resource, $lang) |
|
| 155 | 155 | { |
| 156 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
| 157 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jsonadm/templates' ); |
|
| 156 | + $aimeos = $this->get('aimeos')->get(); |
|
| 157 | + $templatePaths = $aimeos->getCustomPaths('admin/jsonadm/templates'); |
|
| 158 | 158 | |
| 159 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
| 160 | - $context = $this->setLocale( $context, $site, $lang ); |
|
| 159 | + $context = $this->get('aimeos_context')->get(false); |
|
| 160 | + $context = $this->setLocale($context, $site, $lang); |
|
| 161 | 161 | |
| 162 | - $view = $this->get('aimeos_view')->create( $context->getConfig(), $templatePaths, $lang ); |
|
| 163 | - $context->setView( $view ); |
|
| 162 | + $view = $this->get('aimeos_view')->create($context->getConfig(), $templatePaths, $lang); |
|
| 163 | + $context->setView($view); |
|
| 164 | 164 | |
| 165 | - return \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
| 165 | + return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | * @param array $header List of HTTP headers |
| 175 | 175 | * @return Response HTTP response object |
| 176 | 176 | */ |
| 177 | - protected function createResponse( $content, $status, array $header ) |
|
| 177 | + protected function createResponse($content, $status, array $header) |
|
| 178 | 178 | { |
| 179 | 179 | $response = new Response(); |
| 180 | - $response->setContent( $content ); |
|
| 181 | - $response->setStatusCode( $status ); |
|
| 180 | + $response->setContent($content); |
|
| 181 | + $response->setStatusCode($status); |
|
| 182 | 182 | |
| 183 | - foreach( $header as $key => $value ) { |
|
| 184 | - $response->headers->set( $key, $value ); |
|
| 183 | + foreach ($header as $key => $value) { |
|
| 184 | + $response->headers->set($key, $value); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | return $response; |
@@ -196,23 +196,23 @@ discard block |
||
| 196 | 196 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
| 197 | 197 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 198 | 198 | */ |
| 199 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site, $lang ) |
|
| 199 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site, $lang) |
|
| 200 | 200 | { |
| 201 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 201 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 202 | 202 | |
| 203 | 203 | try |
| 204 | 204 | { |
| 205 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
| 206 | - $localeItem->setLanguageId( null ); |
|
| 207 | - $localeItem->setCurrencyId( null ); |
|
| 205 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
| 206 | + $localeItem->setLanguageId(null); |
|
| 207 | + $localeItem->setCurrencyId(null); |
|
| 208 | 208 | } |
| 209 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 209 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
| 210 | 210 | { |
| 211 | 211 | $localeItem = $localeManager->createItem(); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - $context->setLocale( $localeItem ); |
|
| 215 | - $context->setI18n( $this->get('aimeos_i18n')->get( array( $lang ) ) ); |
|
| 214 | + $context->setLocale($localeItem); |
|
| 215 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang))); |
|
| 216 | 216 | |
| 217 | 217 | return $context; |
| 218 | 218 | } |