@@ -30,64 +30,64 @@ discard block |
||
30 | 30 | * @param Request $request Symfony request object |
31 | 31 | * @return Response Generated output for the admin interface |
32 | 32 | */ |
33 | - public function indexAction( Request $request ) |
|
33 | + public function indexAction(Request $request) |
|
34 | 34 | { |
35 | - $site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) ); |
|
36 | - $lang = $request->attributes->get( 'lang', $request->query->get( 'lang', 'en' ) ); |
|
37 | - $tab = $request->attributes->get( 'tab', $request->query->get( 'tab', 0 ) ); |
|
35 | + $site = $request->attributes->get('site', $request->query->get('site', 'default')); |
|
36 | + $lang = $request->attributes->get('lang', $request->query->get('lang', 'en')); |
|
37 | + $tab = $request->attributes->get('tab', $request->query->get('tab', 0)); |
|
38 | 38 | |
39 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
40 | - $context->setLocale( $this->get( 'aimeos_locale' )->getBackend( $context, $site ) ); |
|
39 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
40 | + $context->setLocale($this->get('aimeos_locale')->getBackend($context, $site)); |
|
41 | 41 | |
42 | - $aimeos = $this->get( 'aimeos' ); |
|
42 | + $aimeos = $this->get('aimeos'); |
|
43 | 43 | $bootstrap = $aimeos->get(); |
44 | 44 | |
45 | - $cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' ); |
|
46 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
45 | + $cntlPaths = $bootstrap->getCustomPaths('controller/extjs'); |
|
46 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
47 | 47 | $cssFiles = array(); |
48 | 48 | |
49 | - foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
49 | + foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths) |
|
50 | 50 | { |
51 | - foreach( $paths as $path ) |
|
51 | + foreach ($paths as $path) |
|
52 | 52 | { |
53 | - $jsbAbsPath = $base . '/' . $path; |
|
53 | + $jsbAbsPath = $base.'/'.$path; |
|
54 | 54 | |
55 | - if( !is_file( $jsbAbsPath ) ) { |
|
56 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
55 | + if (!is_file($jsbAbsPath)) { |
|
56 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
57 | 57 | } |
58 | 58 | |
59 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
60 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
59 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
60 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | - $params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' ); |
|
65 | - $adminUrl = $this->generateUrl( 'aimeos_shop_extadm', $params ); |
|
64 | + $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); |
|
65 | + $adminUrl = $this->generateUrl('aimeos_shop_extadm', $params); |
|
66 | 66 | |
67 | - $token = $this->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' )->getValue(); |
|
68 | - $jsonUrl = $this->generateUrl( 'aimeos_shop_extadm_json', array( '_token' => $token, 'site' => $site ) ); |
|
67 | + $token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue(); |
|
68 | + $jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site)); |
|
69 | 69 | |
70 | - $jqadmUrl = $this->generateUrl( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product', 'lang' => $lang ) ); |
|
70 | + $jqadmUrl = $this->generateUrl('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product', 'lang' => $lang)); |
|
71 | 71 | |
72 | 72 | $vars = array( |
73 | 73 | 'lang' => $lang, |
74 | 74 | 'cssFiles' => $cssFiles, |
75 | 75 | 'languages' => $this->getJsonLanguages(), |
76 | - 'config' => $this->getJsonClientConfig( $context ), |
|
77 | - 'site' => $this->getJsonSiteItem( $context, $site ), |
|
78 | - 'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ), |
|
76 | + 'config' => $this->getJsonClientConfig($context), |
|
77 | + 'site' => $this->getJsonSiteItem($context, $site), |
|
78 | + 'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang), |
|
79 | 79 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
80 | 80 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
81 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
82 | - 'urlTemplate' => urldecode( $adminUrl ), |
|
83 | - 'uploaddir' => $this->container->getParameter( 'aimeos_shop.uploaddir' ), |
|
84 | - 'extensions' => implode( ',', $bootstrap->getExtensions() ), |
|
81 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
82 | + 'urlTemplate' => urldecode($adminUrl), |
|
83 | + 'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'), |
|
84 | + 'extensions' => implode(',', $bootstrap->getExtensions()), |
|
85 | 85 | 'version' => $aimeos->getVersion(), |
86 | 86 | 'jqadmurl' => $jqadmUrl, |
87 | 87 | 'activeTab' => $tab, |
88 | 88 | ); |
89 | 89 | |
90 | - return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars ); |
|
90 | + return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -97,23 +97,23 @@ discard block |
||
97 | 97 | * @param Request $request Symfony request object |
98 | 98 | * @return Response JSON RPC message response |
99 | 99 | */ |
100 | - public function doAction( Request $request ) |
|
100 | + public function doAction(Request $request) |
|
101 | 101 | { |
102 | 102 | $csrfProvider = $this->get('security.csrf.token_manager'); |
103 | 103 | |
104 | - if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token', $request->query->get( '_token' ) ) ) !== true ) { |
|
105 | - throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' ); |
|
104 | + if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) { |
|
105 | + throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid'); |
|
106 | 106 | } |
107 | 107 | |
108 | - $cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' ); |
|
109 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
110 | - $context->setView( $this->get( 'aimeos_view' )->create( $context, array() ) ); |
|
111 | - $context->setLocale( $this->get( 'aimeos_locale' )->getBackend( $context, 'default' ) ); |
|
108 | + $cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs'); |
|
109 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
110 | + $context->setView($this->get('aimeos_view')->create($context, array())); |
|
111 | + $context->setLocale($this->get('aimeos_locale')->getBackend($context, 'default')); |
|
112 | 112 | |
113 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
113 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
114 | 114 | |
115 | - $response = $controller->process( $request->request->all(), $request->getContent() ); |
|
116 | - return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) ); |
|
115 | + $response = $controller->process($request->request->all(), $request->getContent()); |
|
116 | + return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response)); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -126,27 +126,27 @@ discard block |
||
126 | 126 | { |
127 | 127 | $contents = ''; |
128 | 128 | $jsFiles = array(); |
129 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
129 | + $aimeos = $this->get('aimeos')->get(); |
|
130 | 130 | |
131 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
131 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
132 | 132 | { |
133 | - foreach( $paths as $path ) |
|
133 | + foreach ($paths as $path) |
|
134 | 134 | { |
135 | - $jsbAbsPath = $base . '/' . $path; |
|
136 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
137 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
135 | + $jsbAbsPath = $base.'/'.$path; |
|
136 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
137 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - foreach( $jsFiles as $file ) |
|
141 | + foreach ($jsFiles as $file) |
|
142 | 142 | { |
143 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
143 | + if (($content = file_get_contents($file)) !== false) { |
|
144 | 144 | $contents .= $content; |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - $response = new Response( $contents ); |
|
149 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
148 | + $response = new Response($contents); |
|
149 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
150 | 150 | |
151 | 151 | return $response; |
152 | 152 | } |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | { |
162 | 162 | $result = array(); |
163 | 163 | |
164 | - foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) { |
|
165 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
164 | + foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) { |
|
165 | + $result[] = array('id' => $id, 'label' => $id); |
|
166 | 166 | } |
167 | 167 | |
168 | - return json_encode( $result ); |
|
168 | + return json_encode($result); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
176 | 176 | * @return string JSON encoded configuration object |
177 | 177 | */ |
178 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
178 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
179 | 179 | { |
180 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
181 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
180 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
181 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -189,16 +189,16 @@ discard block |
||
189 | 189 | * @param string $lang ISO language code like "en" or "en_GB" |
190 | 190 | * @return string JSON encoded translation object |
191 | 191 | */ |
192 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
192 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
193 | 193 | { |
194 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang ); |
|
194 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang); |
|
195 | 195 | |
196 | 196 | $content = array( |
197 | - 'admin' => $i18n->getAll( 'admin' ), |
|
198 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
197 | + 'admin' => $i18n->getAll('admin'), |
|
198 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
199 | 199 | ); |
200 | 200 | |
201 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
201 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -210,18 +210,18 @@ discard block |
||
210 | 210 | * @return string JSON encoded site item object |
211 | 211 | * @throws Exception If no site item was found for the code |
212 | 212 | */ |
213 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
213 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
214 | 214 | { |
215 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
215 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
216 | 216 | |
217 | 217 | $criteria = $manager->createSearch(); |
218 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
219 | - $items = $manager->searchItems( $criteria ); |
|
218 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
219 | + $items = $manager->searchItems($criteria); |
|
220 | 220 | |
221 | - if( ( $item = reset( $items ) ) === false ) { |
|
222 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
221 | + if (($item = reset($items)) === false) { |
|
222 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
223 | 223 | } |
224 | 224 | |
225 | - return json_encode( $item->toArray() ); |
|
225 | + return json_encode($item->toArray()); |
|
226 | 226 | } |
227 | 227 | } |
@@ -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,20 +49,20 @@ 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'] ) || !is_dir( $options['symfony-app-dir'] ) ) |
|
58 | + if (!isset($options['symfony-app-dir']) || !is_dir($options['symfony-app-dir'])) |
|
59 | 59 | { |
60 | 60 | $msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available'; |
61 | - throw new \RuntimeException( sprintf( $msg, 'symfony-app-dir', $options['symfony-app-dir'] ) ); |
|
61 | + throw new \RuntimeException(sprintf($msg, 'symfony-app-dir', $options['symfony-app-dir'])); |
|
62 | 62 | } |
63 | 63 | |
64 | - self::updateConfigFile( $options['symfony-app-dir'] . '/config/config.yml' ); |
|
65 | - self::updateRoutingFile( $options['symfony-app-dir'] . '/config/routing.yml' ); |
|
64 | + self::updateConfigFile($options['symfony-app-dir'].'/config/config.yml'); |
|
65 | + self::updateRoutingFile($options['symfony-app-dir'].'/config/routing.yml'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -72,28 +72,28 @@ discard block |
||
72 | 72 | * @param Event $event Event instance |
73 | 73 | * @throws \RuntimeException If an error occured |
74 | 74 | */ |
75 | - public static function installBundle( Event $event ) |
|
75 | + public static function installBundle(Event $event) |
|
76 | 76 | { |
77 | - $event->getIO()->write( 'Installing the Aimeos shop bundle' ); |
|
77 | + $event->getIO()->write('Installing the Aimeos shop bundle'); |
|
78 | 78 | |
79 | - $options = self::getOptions( $event ); |
|
79 | + $options = self::getOptions($event); |
|
80 | 80 | |
81 | - if( !isset( $options['symfony-app-dir'] ) || !is_dir( $options['symfony-app-dir'] ) ) |
|
81 | + if (!isset($options['symfony-app-dir']) || !is_dir($options['symfony-app-dir'])) |
|
82 | 82 | { |
83 | 83 | $msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available'; |
84 | - throw new \RuntimeException( sprintf( $msg, 'symfony-app-dir', $options['symfony-app-dir'] ) ); |
|
84 | + throw new \RuntimeException(sprintf($msg, 'symfony-app-dir', $options['symfony-app-dir'])); |
|
85 | 85 | } |
86 | 86 | |
87 | - if( !isset( $options['symfony-web-dir'] ) || !is_dir( $options['symfony-web-dir'] ) ) |
|
87 | + if (!isset($options['symfony-web-dir']) || !is_dir($options['symfony-web-dir'])) |
|
88 | 88 | { |
89 | 89 | $msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available'; |
90 | - throw new \RuntimeException( sprintf( $msg, 'symfony-web-dir', $options['symfony-web-dir'] ) ); |
|
90 | + throw new \RuntimeException(sprintf($msg, 'symfony-web-dir', $options['symfony-web-dir'])); |
|
91 | 91 | } |
92 | 92 | |
93 | - self::createDirectory( $options['symfony-app-dir'] . '/secure' ); |
|
94 | - self::createDirectory( $options['symfony-web-dir'] . '/uploads' ); |
|
95 | - self::createDirectory( $options['symfony-web-dir'] . '/preview' ); |
|
96 | - self::createDirectory( $options['symfony-web-dir'] . '/files' ); |
|
93 | + self::createDirectory($options['symfony-app-dir'].'/secure'); |
|
94 | + self::createDirectory($options['symfony-web-dir'].'/uploads'); |
|
95 | + self::createDirectory($options['symfony-web-dir'].'/preview'); |
|
96 | + self::createDirectory($options['symfony-web-dir'].'/files'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | * @param string $dir Absolute path of the new directory |
104 | 104 | * @throws \RuntimeException If directory couldn't be created |
105 | 105 | */ |
106 | - protected static function createDirectory( $dir ) |
|
106 | + protected static function createDirectory($dir) |
|
107 | 107 | { |
108 | 108 | $perm = 0755; |
109 | 109 | |
110 | - if( !is_dir( $dir ) && !mkdir( $dir, $perm, true ) ) |
|
110 | + if (!is_dir($dir) && !mkdir($dir, $perm, true)) |
|
111 | 111 | { |
112 | 112 | $msg = 'Unable to create directory "%1$s" with permission "%2$s"'; |
113 | - throw new \RuntimeException( sprintf( $msg, $dir, $perm ) ); |
|
113 | + throw new \RuntimeException(sprintf($msg, $dir, $perm)); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
@@ -123,28 +123,28 @@ discard block |
||
123 | 123 | * @param array List of configuration options for the given command |
124 | 124 | * @throws \RuntimeException If the command couldn't be executed |
125 | 125 | */ |
126 | - protected static function executeCommand( Event $event, $cmd, array $options = array() ) |
|
126 | + protected static function executeCommand(Event $event, $cmd, array $options = array()) |
|
127 | 127 | { |
128 | - $php = escapeshellarg( self::getPhp() ); |
|
129 | - $console = escapeshellarg( self::getConsoleDir( $event ) . '/console' ); |
|
130 | - $cmd = escapeshellarg( $cmd ); |
|
128 | + $php = escapeshellarg(self::getPhp()); |
|
129 | + $console = escapeshellarg(self::getConsoleDir($event).'/console'); |
|
130 | + $cmd = escapeshellarg($cmd); |
|
131 | 131 | |
132 | - foreach( $options as $key => $option ) { |
|
133 | - $options[$key] = escapeshellarg( $option ); |
|
132 | + foreach ($options as $key => $option) { |
|
133 | + $options[$key] = escapeshellarg($option); |
|
134 | 134 | } |
135 | 135 | |
136 | - if( $event->getIO()->isDecorated() ) { |
|
136 | + if ($event->getIO()->isDecorated()) { |
|
137 | 137 | $console .= ' --ansi'; |
138 | 138 | } |
139 | 139 | |
140 | - $process = new Process( $php . ' ' . $console . ' ' . $cmd . ' ' . implode( ' ', $options ), null, null, null, 3600 ); |
|
140 | + $process = new Process($php.' '.$console.' '.$cmd.' '.implode(' ', $options), null, null, null, 3600); |
|
141 | 141 | |
142 | - $process->run( function( $type, $buffer ) use ( $event ) { |
|
143 | - $event->getIO()->write( $buffer, false ); |
|
142 | + $process->run(function($type, $buffer) use ($event) { |
|
143 | + $event->getIO()->write($buffer, false); |
|
144 | 144 | } ); |
145 | 145 | |
146 | - if( !$process->isSuccessful() ) { |
|
147 | - throw new \RuntimeException( sprintf( 'An error occurred when executing the "%s" command', escapeshellarg( $cmd ) ) ); |
|
146 | + if (!$process->isSuccessful()) { |
|
147 | + throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command', escapeshellarg($cmd))); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | * @return string The path to the console directory |
158 | 158 | * @throws \RuntimeException If console directory couldn't be found |
159 | 159 | */ |
160 | - protected static function getConsoleDir( Event $event ) |
|
160 | + protected static function getConsoleDir(Event $event) |
|
161 | 161 | { |
162 | - $options = self::getOptions( $event ); |
|
162 | + $options = self::getOptions($event); |
|
163 | 163 | |
164 | - if( isset( $options['symfony-bin-dir'] ) && is_dir( $options['symfony-bin-dir'] ) ) { |
|
164 | + if (isset($options['symfony-bin-dir']) && is_dir($options['symfony-bin-dir'])) { |
|
165 | 165 | return $options['symfony-bin-dir']; |
166 | 166 | } |
167 | 167 | |
168 | - if( isset( $options['symfony-app-dir'] ) && is_dir( $options['symfony-app-dir'] ) ) { |
|
168 | + if (isset($options['symfony-app-dir']) && is_dir($options['symfony-app-dir'])) { |
|
169 | 169 | return $options['symfony-app-dir']; |
170 | 170 | } |
171 | 171 | |
172 | - throw new \RuntimeException( sprintf( 'Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir' ) ); |
|
172 | + throw new \RuntimeException(sprintf('Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir')); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param Event $event Command event object |
180 | 180 | * @return array Associative list of option keys and values |
181 | 181 | */ |
182 | - protected static function getOptions( Event $event ) |
|
182 | + protected static function getOptions(Event $event) |
|
183 | 183 | { |
184 | 184 | return $event->getComposer()->getPackage()->getExtra(); |
185 | 185 | } |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | { |
196 | 196 | $phpFinder = new PhpExecutableFinder; |
197 | 197 | |
198 | - if( !( $phpPath = $phpFinder->find() ) ) { |
|
199 | - throw new \RuntimeException( 'The php executable could not be found, add it to your PATH environment variable and try again' ); |
|
198 | + if (!($phpPath = $phpFinder->find())) { |
|
199 | + throw new \RuntimeException('The php executable could not be found, add it to your PATH environment variable and try again'); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return $phpPath; |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | * @param string $filename Name of the YAML config file |
210 | 210 | * @throws \RuntimeException If file is not found |
211 | 211 | */ |
212 | - protected static function updateConfigFile( $filename ) |
|
212 | + protected static function updateConfigFile($filename) |
|
213 | 213 | { |
214 | - if( ( $content = file_get_contents( $filename ) ) === false ) { |
|
215 | - throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) ); |
|
214 | + if (($content = file_get_contents($filename)) === false) { |
|
215 | + throw new \RuntimeException(sprintf('File "%1$s" not found', $filename)); |
|
216 | 216 | } |
217 | 217 | |
218 | - if( self::addAsseticBundle( $content ) === true ) { |
|
218 | + if (self::addAsseticBundle($content) === true) { |
|
219 | 219 | $fs = new Filesystem(); |
220 | - $fs->dumpFile( $filename, $content ); |
|
220 | + $fs->dumpFile($filename, $content); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
@@ -228,56 +228,56 @@ discard block |
||
228 | 228 | * @param string $filename Name of the YAML config file |
229 | 229 | * @throws \RuntimeException If file is not found |
230 | 230 | */ |
231 | - protected static function updateRoutingFile( $filename ) |
|
231 | + protected static function updateRoutingFile($filename) |
|
232 | 232 | { |
233 | - if( ( $content = file_get_contents( $filename ) ) === false ) { |
|
234 | - throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) ); |
|
233 | + if (($content = file_get_contents($filename)) === false) { |
|
234 | + throw new \RuntimeException(sprintf('File "%1$s" not found', $filename)); |
|
235 | 235 | } |
236 | 236 | |
237 | - if( strpos( $content, 'aimeos_shop:' ) === false ) |
|
237 | + if (strpos($content, 'aimeos_shop:') === false) |
|
238 | 238 | { |
239 | - $content .= "\n" . 'aimeos_shop: |
|
239 | + $content .= "\n".'aimeos_shop: |
|
240 | 240 | resource: "@AimeosShopBundle/Resources/config/routing.yml" |
241 | 241 | prefix: /'; |
242 | 242 | } |
243 | 243 | |
244 | - if( strpos( $content, 'aimeos_shop_adm:' ) === false ) |
|
244 | + if (strpos($content, 'aimeos_shop_adm:') === false) |
|
245 | 245 | { |
246 | - $content .= "\n" . 'aimeos_shop_adm: |
|
246 | + $content .= "\n".'aimeos_shop_adm: |
|
247 | 247 | resource: "@AimeosShopBundle/Resources/config/routing_adm.yml" |
248 | 248 | prefix: /'; |
249 | 249 | } |
250 | 250 | |
251 | - if( strpos( $content, 'aimeos_shop_extadm:' ) === false ) |
|
251 | + if (strpos($content, 'aimeos_shop_extadm:') === false) |
|
252 | 252 | { |
253 | - $content .= "\n" . 'aimeos_shop_extadm: |
|
253 | + $content .= "\n".'aimeos_shop_extadm: |
|
254 | 254 | resource: "@AimeosShopBundle/Resources/config/routing_extadm.yml" |
255 | 255 | prefix: /admin/{site}/extadm'; |
256 | 256 | } |
257 | 257 | |
258 | - if( strpos( $content, 'aimeos_shop_jqadm:' ) === false ) |
|
258 | + if (strpos($content, 'aimeos_shop_jqadm:') === false) |
|
259 | 259 | { |
260 | - $content .= "\n" . 'aimeos_shop_jqadm: |
|
260 | + $content .= "\n".'aimeos_shop_jqadm: |
|
261 | 261 | resource: "@AimeosShopBundle/Resources/config/routing_jqadm.yml" |
262 | 262 | prefix: /admin/{site}/jqadm'; |
263 | 263 | } |
264 | 264 | |
265 | - if( strpos( $content, 'aimeos_shop_jsonadm:' ) === false ) |
|
265 | + if (strpos($content, 'aimeos_shop_jsonadm:') === false) |
|
266 | 266 | { |
267 | - $content .= "\n" . 'aimeos_shop_jsonadm: |
|
267 | + $content .= "\n".'aimeos_shop_jsonadm: |
|
268 | 268 | resource: "@AimeosShopBundle/Resources/config/routing_jsonadm.yml" |
269 | 269 | prefix: /admin/{site}/jsonadm'; |
270 | 270 | } |
271 | 271 | |
272 | - if( strpos( $content, 'aimeos_shop_jsonapi:' ) === false ) |
|
272 | + if (strpos($content, 'aimeos_shop_jsonapi:') === false) |
|
273 | 273 | { |
274 | - $content .= "\n" . 'aimeos_shop_jsonapi: |
|
274 | + $content .= "\n".'aimeos_shop_jsonapi: |
|
275 | 275 | resource: "@AimeosShopBundle/Resources/config/routing_jsonapi.yml" |
276 | 276 | prefix: /jsonapi'; |
277 | 277 | } |
278 | 278 | |
279 | 279 | $fs = new Filesystem(); |
280 | - $fs->dumpFile( $filename, $content ); |
|
280 | + $fs->dumpFile($filename, $content); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | * @param string &$content Content of the config.yml file |
288 | 288 | * @return boolean True if modified, false if not |
289 | 289 | */ |
290 | - protected static function addAsseticBundle( &$content ) |
|
290 | + protected static function addAsseticBundle(&$content) |
|
291 | 291 | { |
292 | - if( preg_match( "/ bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content ) !== 1 ) |
|
292 | + if (preg_match("/ bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content) !== 1) |
|
293 | 293 | { |
294 | - $search = array( "/ bundles:[ ]*\[([^\]]+)\]/", "/ bundles:[ ]*\[([ ]*)\]/" ); |
|
295 | - $replace = array( " bundles: [$1,'AimeosShopBundle']", " bundles: ['AimeosShopBundle']" ); |
|
294 | + $search = array("/ bundles:[ ]*\[([^\]]+)\]/", "/ bundles:[ ]*\[([ ]*)\]/"); |
|
295 | + $replace = array(" bundles: [$1,'AimeosShopBundle']", " bundles: ['AimeosShopBundle']"); |
|
296 | 296 | |
297 | - if( ( $content = preg_replace( $search, $replace, $content ) ) !== null ) { |
|
297 | + if (($content = preg_replace($search, $replace, $content)) !== null) { |
|
298 | 298 | return true; |
299 | 299 | } |
300 | 300 | } |