@@ -10,17 +10,17 @@ |
||
10 | 10 | public function testAccount() |
11 | 11 | { |
12 | 12 | $client = static::createClient(); |
13 | - $client->request( 'GET', '/unittest/de/EUR/myaccount' ); |
|
13 | + $client->request('GET', '/unittest/de/EUR/myaccount'); |
|
14 | 14 | |
15 | - $this->assertContains( 'aimeos account-history', $client->getResponse()->getContent() ); |
|
15 | + $this->assertContains('aimeos account-history', $client->getResponse()->getContent()); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | |
19 | 19 | public function testDownload() |
20 | 20 | { |
21 | 21 | $client = static::createClient(); |
22 | - $client->request( 'GET', '/unittest/de/EUR/myaccount/download/0' ); |
|
22 | + $client->request('GET', '/unittest/de/EUR/myaccount/download/0'); |
|
23 | 23 | |
24 | - $this->assertEquals( 401, $client->getResponse()->getStatusCode() ); |
|
24 | + $this->assertEquals(401, $client->getResponse()->getStatusCode()); |
|
25 | 25 | } |
26 | 26 | } |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | protected function configure() |
30 | 30 | { |
31 | 31 | $names = ''; |
32 | - $aimeos = new \Aimeos\Bootstrap( array() ); |
|
33 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/jobs' ); |
|
34 | - $controllers = \Aimeos\Controller\Jobs\Factory::getControllers( $this->getBareContext(), $aimeos, $cntlPaths ); |
|
32 | + $aimeos = new \Aimeos\Bootstrap(array()); |
|
33 | + $cntlPaths = $aimeos->getCustomPaths('controller/jobs'); |
|
34 | + $controllers = \Aimeos\Controller\Jobs\Factory::getControllers($this->getBareContext(), $aimeos, $cntlPaths); |
|
35 | 35 | |
36 | - foreach( $controllers as $key => $controller ) { |
|
37 | - $names .= str_pad( $key, 30 ) . $controller->getName() . PHP_EOL; |
|
36 | + foreach ($controllers as $key => $controller) { |
|
37 | + $names .= str_pad($key, 30) . $controller->getName() . PHP_EOL; |
|
38 | 38 | } |
39 | 39 | |
40 | - $this->setName( 'aimeos:jobs' ); |
|
41 | - $this->setDescription( 'Executes the job controllers' ); |
|
42 | - $this->addArgument( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' ); |
|
43 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' ); |
|
44 | - $this->setHelp( "Available jobs are:\n" . $names ); |
|
40 | + $this->setName('aimeos:jobs'); |
|
41 | + $this->setDescription('Executes the job controllers'); |
|
42 | + $this->addArgument('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"'); |
|
43 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)'); |
|
44 | + $this->setHelp("Available jobs are:\n" . $names); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -51,23 +51,23 @@ discard block |
||
51 | 51 | * @param InputInterface $input Input object |
52 | 52 | * @param OutputInterface $output Output object |
53 | 53 | */ |
54 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
54 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
55 | 55 | { |
56 | 56 | $context = $this->getContext(); |
57 | - $aimeos = $this->getContainer()->get( 'aimeos' )->get(); |
|
57 | + $aimeos = $this->getContainer()->get('aimeos')->get(); |
|
58 | 58 | |
59 | - $jobs = explode( ' ', $input->getArgument( 'jobs' ) ); |
|
60 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
59 | + $jobs = explode(' ', $input->getArgument('jobs')); |
|
60 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
61 | 61 | |
62 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
62 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
63 | 63 | { |
64 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false ); |
|
65 | - $context->setLocale( $localeItem ); |
|
64 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false); |
|
65 | + $context->setLocale($localeItem); |
|
66 | 66 | |
67 | - $output->writeln( sprintf( 'Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode() ) ); |
|
67 | + $output->writeln(sprintf('Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode())); |
|
68 | 68 | |
69 | - foreach( $jobs as $jobname ) { |
|
70 | - \Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run(); |
|
69 | + foreach ($jobs as $jobname) { |
|
70 | + \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run(); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | { |
83 | 83 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
84 | 84 | |
85 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), array() ); |
|
86 | - $ctx->setConfig( $conf ); |
|
85 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), array()); |
|
86 | + $ctx->setConfig($conf); |
|
87 | 87 | |
88 | - $locale = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' )->createItem(); |
|
89 | - $locale->setLanguageId( 'en' ); |
|
90 | - $ctx->setLocale( $locale ); |
|
88 | + $locale = \Aimeos\MShop\Factory::createManager($ctx, 'locale')->createItem(); |
|
89 | + $locale->setLanguageId('en'); |
|
90 | + $ctx->setLocale($locale); |
|
91 | 91 | |
92 | - $i18n = new \Aimeos\MW\Translation\None( 'en' ); |
|
93 | - $ctx->setI18n( array( 'en' => $i18n ) ); |
|
92 | + $i18n = new \Aimeos\MW\Translation\None('en'); |
|
93 | + $ctx->setI18n(array('en' => $i18n)); |
|
94 | 94 | |
95 | 95 | return $ctx; |
96 | 96 | } |
@@ -105,19 +105,19 @@ discard block |
||
105 | 105 | { |
106 | 106 | $container = $this->getContainer(); |
107 | 107 | $aimeos = $container->get('aimeos')->get(); |
108 | - $context = $container->get( 'aimeos_context' )->get( false ); |
|
108 | + $context = $container->get('aimeos_context')->get(false); |
|
109 | 109 | |
110 | - $tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' ); |
|
111 | - $tmplPaths = array_merge( $tmplPaths, $aimeos->getCustomPaths( 'client/html/templates' ) ); |
|
112 | - $view = $container->get('aimeos_view')->create( $context->getConfig(), $tmplPaths ); |
|
110 | + $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); |
|
111 | + $tmplPaths = array_merge($tmplPaths, $aimeos->getCustomPaths('client/html/templates')); |
|
112 | + $view = $container->get('aimeos_view')->create($context->getConfig(), $tmplPaths); |
|
113 | 113 | |
114 | - $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' ); |
|
115 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
116 | - $i18n = $this->getContainer()->get( 'aimeos_i18n' )->get( $langids ); |
|
114 | + $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language'); |
|
115 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
116 | + $i18n = $this->getContainer()->get('aimeos_i18n')->get($langids); |
|
117 | 117 | |
118 | - $context->setEditor( 'aimeos:jobs' ); |
|
119 | - $context->setView( $view ); |
|
120 | - $context->setI18n( $i18n ); |
|
118 | + $context->setEditor('aimeos:jobs'); |
|
119 | + $context->setView($view); |
|
120 | + $context->setI18n($i18n); |
|
121 | 121 | |
122 | 122 | return $context; |
123 | 123 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param Container $container Container object to access parameters |
31 | 31 | */ |
32 | - public function __construct( Container $container ) |
|
32 | + public function __construct(Container $container) |
|
33 | 33 | { |
34 | 34 | $this->container = $container; |
35 | 35 | } |
@@ -41,27 +41,27 @@ discard block |
||
41 | 41 | * @param array $languageIds List of two letter ISO language IDs |
42 | 42 | * @return \Aimeos\MW\Translation\Interface[] List of translation objects |
43 | 43 | */ |
44 | - public function get( array $languageIds ) |
|
44 | + public function get(array $languageIds) |
|
45 | 45 | { |
46 | - $i18nPaths = $this->container->get( 'aimeos' )->get()->getI18nPaths(); |
|
46 | + $i18nPaths = $this->container->get('aimeos')->get()->getI18nPaths(); |
|
47 | 47 | |
48 | - foreach( $languageIds as $langid ) |
|
48 | + foreach ($languageIds as $langid) |
|
49 | 49 | { |
50 | - if( !isset( $this->i18n[$langid] ) ) |
|
50 | + if (!isset($this->i18n[$langid])) |
|
51 | 51 | { |
52 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $langid ); |
|
52 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $langid); |
|
53 | 53 | |
54 | - $apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' ); |
|
55 | - $prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' ); |
|
54 | + $apc = (bool) $this->container->getParameter('aimeos_shop.apc_enable'); |
|
55 | + $prefix = $this->container->getParameter('aimeos_shop.apc_prefix'); |
|
56 | 56 | |
57 | - if( function_exists( 'apc_store' ) === true && $apc === true ) { |
|
58 | - $i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $prefix ); |
|
57 | + if (function_exists('apc_store') === true && $apc === true) { |
|
58 | + $i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $prefix); |
|
59 | 59 | } |
60 | 60 | |
61 | - $translations = $this->container->getParameter( 'aimeos_shop.i18n' ); |
|
61 | + $translations = $this->container->getParameter('aimeos_shop.i18n'); |
|
62 | 62 | |
63 | - if( isset( $translations[$langid] ) ) { |
|
64 | - $i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $translations[$langid] ); |
|
63 | + if (isset($translations[$langid])) { |
|
64 | + $i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $translations[$langid]); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $this->i18n[$langid] = $i18n; |
@@ -28,18 +28,18 @@ discard block |
||
28 | 28 | * @param CommandEvent $event CommandEvent instance |
29 | 29 | * @throws \RuntimeException If an error occured |
30 | 30 | */ |
31 | - public static function setupDatabase( CommandEvent $event ) |
|
31 | + public static function setupDatabase(CommandEvent $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,30 +49,30 @@ discard block |
||
49 | 49 | * @param CommandEvent $event CommandEvent instance |
50 | 50 | * @throws \RuntimeException If an error occured |
51 | 51 | */ |
52 | - public static function installBundle( CommandEvent $event ) |
|
52 | + public static function installBundle(CommandEvent $event) |
|
53 | 53 | { |
54 | - $event->getIO()->write( 'Installing the Aimeos shop bundle' ); |
|
54 | + $event->getIO()->write('Installing the Aimeos 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 | - if( !isset( $options['symfony-web-dir'] ) || !is_dir( $options['symfony-web-dir'] ) ) |
|
64 | + if (!isset($options['symfony-web-dir']) || !is_dir($options['symfony-web-dir'])) |
|
65 | 65 | { |
66 | 66 | $msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available'; |
67 | - throw new \RuntimeException( sprintf( $msg, 'symfony-web-dir', $options['symfony-web-dir'] ) ); |
|
67 | + throw new \RuntimeException(sprintf($msg, 'symfony-web-dir', $options['symfony-web-dir'])); |
|
68 | 68 | } |
69 | 69 | |
70 | - self::updateConfigFile( $options['symfony-app-dir'] . '/config/config.yml' ); |
|
71 | - self::updateRoutingFile( $options['symfony-app-dir'] . '/config/routing.yml' ); |
|
72 | - self::createDirectory( $options['symfony-app-dir'] . '/secure' ); |
|
73 | - self::createDirectory( $options['symfony-web-dir'] . '/uploads' ); |
|
74 | - self::createDirectory( $options['symfony-web-dir'] . '/preview' ); |
|
75 | - self::createDirectory( $options['symfony-web-dir'] . '/files' ); |
|
70 | + self::updateConfigFile($options['symfony-app-dir'] . '/config/config.yml'); |
|
71 | + self::updateRoutingFile($options['symfony-app-dir'] . '/config/routing.yml'); |
|
72 | + self::createDirectory($options['symfony-app-dir'] . '/secure'); |
|
73 | + self::createDirectory($options['symfony-web-dir'] . '/uploads'); |
|
74 | + self::createDirectory($options['symfony-web-dir'] . '/preview'); |
|
75 | + self::createDirectory($options['symfony-web-dir'] . '/files'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | * @param string $dir Absolute path of the new directory |
83 | 83 | * @throws \RuntimeException If directory couldn't be created |
84 | 84 | */ |
85 | - protected static function createDirectory( $dir ) |
|
85 | + protected static function createDirectory($dir) |
|
86 | 86 | { |
87 | 87 | $perm = 0755; |
88 | 88 | |
89 | - if( !is_dir( $dir ) && !mkdir( $dir, $perm, true ) ) |
|
89 | + if (!is_dir($dir) && !mkdir($dir, $perm, true)) |
|
90 | 90 | { |
91 | 91 | $msg = 'Unable to create directory "%1$s" with permission "%2$s"'; |
92 | - throw new \RuntimeException( sprintf( $msg, $dir, $perm ) ); |
|
92 | + throw new \RuntimeException(sprintf($msg, $dir, $perm)); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -102,28 +102,28 @@ discard block |
||
102 | 102 | * @param array List of configuration options for the given command |
103 | 103 | * @throws \RuntimeException If the command couldn't be executed |
104 | 104 | */ |
105 | - protected static function executeCommand( CommandEvent $event, $cmd, array $options = array() ) |
|
105 | + protected static function executeCommand(CommandEvent $event, $cmd, array $options = array()) |
|
106 | 106 | { |
107 | - $php = escapeshellarg( self::getPhp() ); |
|
108 | - $console = escapeshellarg( self::getConsoleDir( $event ) . '/console' ); |
|
109 | - $cmd = escapeshellarg( $cmd ); |
|
107 | + $php = escapeshellarg(self::getPhp()); |
|
108 | + $console = escapeshellarg(self::getConsoleDir($event) . '/console'); |
|
109 | + $cmd = escapeshellarg($cmd); |
|
110 | 110 | |
111 | - foreach( $options as $key => $option ) { |
|
112 | - $options[$key] = escapeshellarg( $option ); |
|
111 | + foreach ($options as $key => $option) { |
|
112 | + $options[$key] = escapeshellarg($option); |
|
113 | 113 | } |
114 | 114 | |
115 | - if( $event->getIO()->isDecorated() ) { |
|
115 | + if ($event->getIO()->isDecorated()) { |
|
116 | 116 | $console .= ' --ansi'; |
117 | 117 | } |
118 | 118 | |
119 | - $process = new Process( $php . ' ' . $console . ' ' . $cmd . ' ' . implode( ' ', $options ), null, null, null, 3600 ); |
|
119 | + $process = new Process($php . ' ' . $console . ' ' . $cmd . ' ' . implode(' ', $options), null, null, null, 3600); |
|
120 | 120 | |
121 | - $process->run( function( $type, $buffer ) use ( $event ) { |
|
122 | - $event->getIO()->write( $buffer, false ); |
|
121 | + $process->run(function($type, $buffer) use ($event) { |
|
122 | + $event->getIO()->write($buffer, false); |
|
123 | 123 | } ); |
124 | 124 | |
125 | - if( !$process->isSuccessful() ) { |
|
126 | - throw new \RuntimeException( sprintf( 'An error occurred when executing the "%s" command', escapeshellarg( $cmd ) ) ); |
|
125 | + if (!$process->isSuccessful()) { |
|
126 | + throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command', escapeshellarg($cmd))); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -136,19 +136,19 @@ discard block |
||
136 | 136 | * @return string The path to the console directory |
137 | 137 | * @throws \RuntimeException If console directory couldn't be found |
138 | 138 | */ |
139 | - protected static function getConsoleDir( CommandEvent $event ) |
|
139 | + protected static function getConsoleDir(CommandEvent $event) |
|
140 | 140 | { |
141 | - $options = self::getOptions( $event ); |
|
141 | + $options = self::getOptions($event); |
|
142 | 142 | |
143 | - if( isset( $options['symfony-bin-dir'] ) && is_dir( $options['symfony-bin-dir'] ) ) { |
|
143 | + if (isset($options['symfony-bin-dir']) && is_dir($options['symfony-bin-dir'])) { |
|
144 | 144 | return $options['symfony-bin-dir']; |
145 | 145 | } |
146 | 146 | |
147 | - if( isset( $options['symfony-app-dir'] ) && is_dir( $options['symfony-app-dir'] ) ) { |
|
147 | + if (isset($options['symfony-app-dir']) && is_dir($options['symfony-app-dir'])) { |
|
148 | 148 | return $options['symfony-app-dir']; |
149 | 149 | } |
150 | 150 | |
151 | - throw new \RuntimeException( sprintf( 'Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir' ) ); |
|
151 | + throw new \RuntimeException(sprintf('Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir')); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @param CommandEvent $event Command event object |
159 | 159 | * @return array Associative list of option keys and values |
160 | 160 | */ |
161 | - protected static function getOptions( CommandEvent $event ) |
|
161 | + protected static function getOptions(CommandEvent $event) |
|
162 | 162 | { |
163 | 163 | return $event->getComposer()->getPackage()->getExtra(); |
164 | 164 | } |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | { |
175 | 175 | $phpFinder = new PhpExecutableFinder; |
176 | 176 | |
177 | - if( !( $phpPath = $phpFinder->find() ) ) { |
|
178 | - throw new \RuntimeException( 'The php executable could not be found, add it to your PATH environment variable and try again' ); |
|
177 | + if (!($phpPath = $phpFinder->find())) { |
|
178 | + throw new \RuntimeException('The php executable could not be found, add it to your PATH environment variable and try again'); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return $phpPath; |
@@ -188,15 +188,15 @@ discard block |
||
188 | 188 | * @param string $filename Name of the YAML config file |
189 | 189 | * @throws \RuntimeException If file is not found |
190 | 190 | */ |
191 | - protected static function updateConfigFile( $filename ) |
|
191 | + protected static function updateConfigFile($filename) |
|
192 | 192 | { |
193 | - if( ( $content = file_get_contents( $filename ) ) === false ) { |
|
194 | - throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) ); |
|
193 | + if (($content = file_get_contents($filename)) === false) { |
|
194 | + throw new \RuntimeException(sprintf('File "%1$s" not found', $filename)); |
|
195 | 195 | } |
196 | 196 | |
197 | - if( self::addAsseticBundle( $content ) === true ) { |
|
197 | + if (self::addAsseticBundle($content) === true) { |
|
198 | 198 | $fs = new Filesystem(); |
199 | - $fs->dumpFile( $filename, $content ); |
|
199 | + $fs->dumpFile($filename, $content); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
@@ -207,15 +207,15 @@ discard block |
||
207 | 207 | * @param string $filename Name of the YAML config file |
208 | 208 | * @throws \RuntimeException If file is not found |
209 | 209 | */ |
210 | - protected static function updateRoutingFile( $filename ) |
|
210 | + protected static function updateRoutingFile($filename) |
|
211 | 211 | { |
212 | 212 | $update = false; |
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( strpos( $content, 'aimeos_shop:' ) === false ) |
|
218 | + if (strpos($content, 'aimeos_shop:') === false) |
|
219 | 219 | { |
220 | 220 | $content .= "\n" . 'aimeos_shop: |
221 | 221 | resource: "@AimeosShopBundle/Resources/config/routing.yml" |
@@ -224,10 +224,10 @@ discard block |
||
224 | 224 | $update = true; |
225 | 225 | } |
226 | 226 | |
227 | - if( $update === true ) |
|
227 | + if ($update === true) |
|
228 | 228 | { |
229 | 229 | $fs = new Filesystem(); |
230 | - $fs->dumpFile( $filename, $content ); |
|
230 | + $fs->dumpFile($filename, $content); |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
@@ -238,14 +238,14 @@ discard block |
||
238 | 238 | * @param string &$content Content of the config.yml file |
239 | 239 | * @return boolean True if modified, false if not |
240 | 240 | */ |
241 | - protected static function addAsseticBundle( &$content ) |
|
241 | + protected static function addAsseticBundle(&$content) |
|
242 | 242 | { |
243 | - if( preg_match( "/ bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content ) !== 1 ) |
|
243 | + if (preg_match("/ bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content) !== 1) |
|
244 | 244 | { |
245 | - $search = array( "/ bundles:[ ]*\[([^\]]+)\]/", "/ bundles:[ ]*\[([ ]*)\]/" ); |
|
246 | - $replace = array( " bundles: [$1,'AimeosShopBundle']", " bundles: ['AimeosShopBundle']" ); |
|
245 | + $search = array("/ bundles:[ ]*\[([^\]]+)\]/", "/ bundles:[ ]*\[([ ]*)\]/"); |
|
246 | + $replace = array(" bundles: [$1,'AimeosShopBundle']", " bundles: ['AimeosShopBundle']"); |
|
247 | 247 | |
248 | - if( ( $content = preg_replace( $search, $replace, $content ) ) !== null ) { |
|
248 | + if (($content = preg_replace($search, $replace, $content)) !== null) { |
|
249 | 249 | return true; |
250 | 250 | } |
251 | 251 | } |
@@ -30,62 +30,62 @@ 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', 'default' ); |
|
36 | - $lang = $request->query->get( 'lang', 'en' ); |
|
35 | + $site = $request->attributes->get('site', 'default'); |
|
36 | + $lang = $request->query->get('lang', 'en'); |
|
37 | 37 | |
38 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
39 | - $context = $this->setLocale( $context, $site, $lang ); |
|
38 | + $context = $this->get('aimeos_context')->get(false); |
|
39 | + $context = $this->setLocale($context, $site, $lang); |
|
40 | 40 | |
41 | - $aimeos = $this->get( 'aimeos' ); |
|
41 | + $aimeos = $this->get('aimeos'); |
|
42 | 42 | $bootstrap = $aimeos->get(); |
43 | 43 | |
44 | - $cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' ); |
|
45 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
44 | + $cntlPaths = $bootstrap->getCustomPaths('controller/extjs'); |
|
45 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
46 | 46 | $cssFiles = array(); |
47 | 47 | |
48 | - foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
48 | + foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths) |
|
49 | 49 | { |
50 | - foreach( $paths as $path ) |
|
50 | + foreach ($paths as $path) |
|
51 | 51 | { |
52 | 52 | $jsbAbsPath = $base . '/' . $path; |
53 | 53 | |
54 | - if( !is_file( $jsbAbsPath ) ) { |
|
55 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
54 | + if (!is_file($jsbAbsPath)) { |
|
55 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
56 | 56 | } |
57 | 57 | |
58 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
59 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
58 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
59 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - $params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' ); |
|
64 | - $adminUrl = $this->generateUrl( 'aimeos_shop_extadm', $params ); |
|
63 | + $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); |
|
64 | + $adminUrl = $this->generateUrl('aimeos_shop_extadm', $params); |
|
65 | 65 | |
66 | - $token = $this->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' )->getValue(); |
|
67 | - $jsonUrl = $this->generateUrl( 'aimeos_shop_extadm_json', array( '_token' => $token, 'site' => $site ) ); |
|
66 | + $token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue(); |
|
67 | + $jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site)); |
|
68 | 68 | |
69 | - $jqadmUrl = $this->generateUrl( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) ); |
|
69 | + $jqadmUrl = $this->generateUrl('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); |
|
70 | 70 | |
71 | 71 | $vars = array( |
72 | 72 | 'lang' => $lang, |
73 | 73 | 'cssFiles' => $cssFiles, |
74 | 74 | 'languages' => $this->getJsonLanguages(), |
75 | - 'config' => $this->getJsonClientConfig( $context ), |
|
76 | - 'site' => $this->getJsonSiteItem( $context, $site ), |
|
77 | - 'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ), |
|
75 | + 'config' => $this->getJsonClientConfig($context), |
|
76 | + 'site' => $this->getJsonSiteItem($context, $site), |
|
77 | + 'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang), |
|
78 | 78 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
79 | 79 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
80 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
81 | - 'urlTemplate' => urldecode( $adminUrl ), |
|
82 | - 'uploaddir' => $this->container->getParameter( 'aimeos_shop.uploaddir' ), |
|
83 | - 'activeTab' => $request->query->get( 'tab', 0 ), |
|
80 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
81 | + 'urlTemplate' => urldecode($adminUrl), |
|
82 | + 'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'), |
|
83 | + 'activeTab' => $request->query->get('tab', 0), |
|
84 | 84 | 'version' => $aimeos->getVersion(), |
85 | 85 | 'jqadmurl' => $jqadmUrl, |
86 | 86 | ); |
87 | 87 | |
88 | - return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars ); |
|
88 | + return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -95,23 +95,23 @@ discard block |
||
95 | 95 | * @param Request $request Symfony request object |
96 | 96 | * @return Response JSON RPC message response |
97 | 97 | */ |
98 | - public function doAction( Request $request ) |
|
98 | + public function doAction(Request $request) |
|
99 | 99 | { |
100 | 100 | $csrfProvider = $this->get('security.csrf.token_manager'); |
101 | 101 | |
102 | - if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token', $request->query->get( '_token' ) ) ) !== true ) { |
|
103 | - throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' ); |
|
102 | + if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) { |
|
103 | + throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid'); |
|
104 | 104 | } |
105 | 105 | |
106 | - $cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' ); |
|
107 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
108 | - $context->setView( $this->get( 'aimeos_view' )->create( $context->getConfig(), array() ) ); |
|
109 | - $context = $this->setLocale( $context ); |
|
106 | + $cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs'); |
|
107 | + $context = $this->get('aimeos_context')->get(false); |
|
108 | + $context->setView($this->get('aimeos_view')->create($context->getConfig(), array())); |
|
109 | + $context = $this->setLocale($context); |
|
110 | 110 | |
111 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
111 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
112 | 112 | |
113 | - $response = $controller->process( $request->request->all(), 'php://input' ); |
|
114 | - return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) ); |
|
113 | + $response = $controller->process($request->request->all(), 'php://input'); |
|
114 | + return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response)); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -124,27 +124,27 @@ discard block |
||
124 | 124 | { |
125 | 125 | $contents = ''; |
126 | 126 | $jsFiles = array(); |
127 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
127 | + $aimeos = $this->get('aimeos')->get(); |
|
128 | 128 | |
129 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
129 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
130 | 130 | { |
131 | - foreach( $paths as $path ) |
|
131 | + foreach ($paths as $path) |
|
132 | 132 | { |
133 | 133 | $jsbAbsPath = $base . '/' . $path; |
134 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
135 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
134 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
135 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | - foreach( $jsFiles as $file ) |
|
139 | + foreach ($jsFiles as $file) |
|
140 | 140 | { |
141 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
141 | + if (($content = file_get_contents($file)) !== false) { |
|
142 | 142 | $contents .= $content; |
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | - $response = new Response( $contents ); |
|
147 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
146 | + $response = new Response($contents); |
|
147 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
148 | 148 | |
149 | 149 | return $response; |
150 | 150 | } |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | { |
160 | 160 | $result = array(); |
161 | 161 | |
162 | - foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) { |
|
163 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
162 | + foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) { |
|
163 | + $result[] = array('id' => $id, 'label' => $id); |
|
164 | 164 | } |
165 | 165 | |
166 | - return json_encode( $result ); |
|
166 | + return json_encode($result); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
174 | 174 | * @return string JSON encoded configuration object |
175 | 175 | */ |
176 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
176 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
177 | 177 | { |
178 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
179 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
178 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
179 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -187,16 +187,16 @@ discard block |
||
187 | 187 | * @param string $lang ISO language code like "en" or "en_GB" |
188 | 188 | * @return string JSON encoded translation object |
189 | 189 | */ |
190 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
190 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
191 | 191 | { |
192 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang ); |
|
192 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang); |
|
193 | 193 | |
194 | 194 | $content = array( |
195 | - 'admin' => $i18n->getAll( 'admin' ), |
|
196 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
195 | + 'admin' => $i18n->getAll('admin'), |
|
196 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
197 | 197 | ); |
198 | 198 | |
199 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
199 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -208,19 +208,19 @@ discard block |
||
208 | 208 | * @return string JSON encoded site item object |
209 | 209 | * @throws Exception If no site item was found for the code |
210 | 210 | */ |
211 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
211 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
212 | 212 | { |
213 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
213 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
214 | 214 | |
215 | 215 | $criteria = $manager->createSearch(); |
216 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
217 | - $items = $manager->searchItems( $criteria ); |
|
216 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
217 | + $items = $manager->searchItems($criteria); |
|
218 | 218 | |
219 | - if( ( $item = reset( $items ) ) === false ) { |
|
220 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
219 | + if (($item = reset($items)) === false) { |
|
220 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
221 | 221 | } |
222 | 222 | |
223 | - return json_encode( $item->toArray() ); |
|
223 | + return json_encode($item->toArray()); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -232,17 +232,17 @@ discard block |
||
232 | 232 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
233 | 233 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
234 | 234 | */ |
235 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
235 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
236 | 236 | { |
237 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
237 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
238 | 238 | |
239 | 239 | try { |
240 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
241 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
240 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
241 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
242 | 242 | $localeItem = $localeManager->createItem(); |
243 | 243 | } |
244 | 244 | |
245 | - $context->setLocale( $localeItem ); |
|
245 | + $context->setLocale($localeItem); |
|
246 | 246 | |
247 | 247 | return $context; |
248 | 248 | } |
@@ -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 | } |
@@ -29,35 +29,35 @@ discard block |
||
29 | 29 | * @param $type File type, i.e. "css" or "js" |
30 | 30 | * @return Response Response object |
31 | 31 | */ |
32 | - public function fileAction( $type ) |
|
32 | + public function fileAction($type) |
|
33 | 33 | { |
34 | 34 | $contents = ''; |
35 | 35 | $files = array(); |
36 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
36 | + $aimeos = $this->get('aimeos')->get(); |
|
37 | 37 | |
38 | - foreach( $aimeos->getCustomPaths( 'admin/jqadm' ) as $base => $paths ) |
|
38 | + foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths) |
|
39 | 39 | { |
40 | - foreach( $paths as $path ) |
|
40 | + foreach ($paths as $path) |
|
41 | 41 | { |
42 | 42 | $jsbAbsPath = $base . '/' . $path; |
43 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
44 | - $files = array_merge( $files, $jsb2->getFiles( $type ) ); |
|
43 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
44 | + $files = array_merge($files, $jsb2->getFiles($type)); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - foreach( $files as $file ) |
|
48 | + foreach ($files as $file) |
|
49 | 49 | { |
50 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
50 | + if (($content = file_get_contents($file)) !== false) { |
|
51 | 51 | $contents .= $content; |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - $response = new Response( $contents ); |
|
55 | + $response = new Response($contents); |
|
56 | 56 | |
57 | - if( $type === 'js' ) { |
|
58 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
59 | - } elseif( $type === 'css' ) { |
|
60 | - $response->headers->set( 'Content-Type', 'text/css' ); |
|
57 | + if ($type === 'js') { |
|
58 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
59 | + } elseif ($type === 'css') { |
|
60 | + $response->headers->set('Content-Type', 'text/css'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $response; |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | * @param string $site Unique site code |
73 | 73 | * @return Response Generated output |
74 | 74 | */ |
75 | - public function copyAction( Request $request, $resource, $site = 'default' ) |
|
75 | + public function copyAction(Request $request, $resource, $site = 'default') |
|
76 | 76 | { |
77 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
78 | - return $this->getHtml( $cntl->copy() ); |
|
77 | + $cntl = $this->createClient($request, $site, $resource); |
|
78 | + return $this->getHtml($cntl->copy()); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | * @param string $site Unique site code |
88 | 88 | * @return Response Generated output |
89 | 89 | */ |
90 | - public function createAction( Request $request, $resource, $site = 'default' ) |
|
90 | + public function createAction(Request $request, $resource, $site = 'default') |
|
91 | 91 | { |
92 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
93 | - return $this->getHtml( $cntl->create() ); |
|
92 | + $cntl = $this->createClient($request, $site, $resource); |
|
93 | + return $this->getHtml($cntl->create()); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | * @param string $site Unique site code |
103 | 103 | * @return Response Generated output |
104 | 104 | */ |
105 | - public function deleteAction( Request $request, $resource, $site = 'default' ) |
|
105 | + public function deleteAction(Request $request, $resource, $site = 'default') |
|
106 | 106 | { |
107 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
108 | - return $this->getHtml( $cntl->delete() . $cntl->search() ); |
|
107 | + $cntl = $this->createClient($request, $site, $resource); |
|
108 | + return $this->getHtml($cntl->delete() . $cntl->search()); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | * @param string $site Unique site code |
118 | 118 | * @return Response Generated output |
119 | 119 | */ |
120 | - public function getAction( Request $request, $resource, $site = 'default' ) |
|
120 | + public function getAction(Request $request, $resource, $site = 'default') |
|
121 | 121 | { |
122 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
123 | - return $this->getHtml( $cntl->get() ); |
|
122 | + $cntl = $this->createClient($request, $site, $resource); |
|
123 | + return $this->getHtml($cntl->get()); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | * @param string $site Unique site code |
133 | 133 | * @return Response Generated output |
134 | 134 | */ |
135 | - public function saveAction( Request $request, $resource, $site = 'default' ) |
|
135 | + public function saveAction(Request $request, $resource, $site = 'default') |
|
136 | 136 | { |
137 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
138 | - return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) ); |
|
137 | + $cntl = $this->createClient($request, $site, $resource); |
|
138 | + return $this->getHtml(($cntl->save() ?: $cntl->search())); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | * @param string $site Unique site code |
148 | 148 | * @return Response Generated output |
149 | 149 | */ |
150 | - public function searchAction( Request $request, $resource, $site = 'default' ) |
|
150 | + public function searchAction(Request $request, $resource, $site = 'default') |
|
151 | 151 | { |
152 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
153 | - return $this->getHtml( $cntl->search() ); |
|
152 | + $cntl = $this->createClient($request, $site, $resource); |
|
153 | + return $this->getHtml($cntl->search()); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -162,20 +162,20 @@ discard block |
||
162 | 162 | * @param string $resource Resource location, e.g. "product" |
163 | 163 | * @return \Aimeos\Admin\JQAdm\Iface Context item |
164 | 164 | */ |
165 | - protected function createClient( Request $request, $site, $resource ) |
|
165 | + protected function createClient(Request $request, $site, $resource) |
|
166 | 166 | { |
167 | - $lang = $request->get( 'lang', 'en' ); |
|
167 | + $lang = $request->get('lang', 'en'); |
|
168 | 168 | |
169 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
170 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
169 | + $aimeos = $this->get('aimeos')->get(); |
|
170 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
171 | 171 | |
172 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
173 | - $context = $this->setLocale( $context, $site, $lang ); |
|
172 | + $context = $this->get('aimeos_context')->get(false); |
|
173 | + $context = $this->setLocale($context, $site, $lang); |
|
174 | 174 | |
175 | - $view = $this->get( 'aimeos_view' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
176 | - $context->setView( $view ); |
|
175 | + $view = $this->get('aimeos_view')->create($context->getConfig(), $templatePaths, $lang); |
|
176 | + $context->setView($view); |
|
177 | 177 | |
178 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
178 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | * @param string $content Content from admin client |
186 | 186 | * @return Response View for rendering the output |
187 | 187 | */ |
188 | - protected function getHtml( $content ) |
|
188 | + protected function getHtml($content) |
|
189 | 189 | { |
190 | - $version = $this->get( 'aimeos' )->getVersion(); |
|
191 | - $content = str_replace( array( '{type}', '{version}' ), array( 'Symfony', $version ), $content ); |
|
190 | + $version = $this->get('aimeos')->getVersion(); |
|
191 | + $content = str_replace(array('{type}', '{version}'), array('Symfony', $version), $content); |
|
192 | 192 | |
193 | - return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) ); |
|
193 | + return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content)); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -202,23 +202,23 @@ discard block |
||
202 | 202 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
203 | 203 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
204 | 204 | */ |
205 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site, $lang ) |
|
205 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site, $lang) |
|
206 | 206 | { |
207 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
207 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
208 | 208 | |
209 | 209 | try |
210 | 210 | { |
211 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
212 | - $localeItem->setLanguageId( null ); |
|
213 | - $localeItem->setCurrencyId( null ); |
|
211 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
212 | + $localeItem->setLanguageId(null); |
|
213 | + $localeItem->setCurrencyId(null); |
|
214 | 214 | } |
215 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
215 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
216 | 216 | { |
217 | 217 | $localeItem = $localeManager->createItem(); |
218 | 218 | } |
219 | 219 | |
220 | - $context->setLocale( $localeItem ); |
|
221 | - $context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) ); |
|
220 | + $context->setLocale($localeItem); |
|
221 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en'))); |
|
222 | 222 | |
223 | 223 | return $context; |
224 | 224 | } |
@@ -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', '/jqadm/file/css' ); |
|
17 | + $client->request('GET', '/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', '/jqadm/file/js' ); |
|
31 | + $client->request('GET', '/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/0' ); |
|
45 | + $client->request('GET', '/unittest/jqadm/copy/product/0'); |
|
46 | 46 | $response = $client->getResponse(); |
47 | 47 | |
48 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
49 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
48 | + $this->assertEquals(200, $response->getStatusCode()); |
|
49 | + $this->assertContains('<div class="product-item', $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( '<div class="product-item', $response->getContent() ); |
|
63 | + $this->assertEquals(200, $response->getStatusCode()); |
|
64 | + $this->assertContains('<div class="product-item', $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( '<table class="list-items', $response->getContent() ); |
|
78 | + $this->assertEquals(200, $response->getStatusCode()); |
|
79 | + $this->assertContains('<table class="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/get/product/0' ); |
|
90 | + $client->request('GET', '/unittest/jqadm/get/product/0'); |
|
91 | 91 | $response = $client->getResponse(); |
92 | 92 | |
93 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
94 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
93 | + $this->assertEquals(200, $response->getStatusCode()); |
|
94 | + $this->assertContains('<div class="product-item', $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( 'POST', '/unittest/jqadm/save/product/0' ); |
|
105 | + $client->request('POST', '/unittest/jqadm/save/product/0'); |
|
106 | 106 | $response = $client->getResponse(); |
107 | 107 | |
108 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
109 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
108 | + $this->assertEquals(200, $response->getStatusCode()); |
|
109 | + $this->assertContains('<div class="product-item', $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( 'GET', '/unittest/jqadm/search/product' ); |
|
120 | + $client->request('GET', '/unittest/jqadm/search/product'); |
|
121 | 121 | $response = $client->getResponse(); |
122 | 122 | |
123 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
124 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
123 | + $this->assertEquals(200, $response->getStatusCode()); |
|
124 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -130,12 +130,12 @@ 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', '/invalid/jqadm/search/product' ); |
|
135 | + $client->request('GET', '/invalid/jqadm/search/product'); |
|
136 | 136 | $response = $client->getResponse(); |
137 | 137 | |
138 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
139 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
138 | + $this->assertEquals(200, $response->getStatusCode()); |
|
139 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
140 | 140 | } |
141 | 141 | } |
@@ -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; |
@@ -47,57 +47,57 @@ discard block |
||
47 | 47 | * @param string|null $locale Code of the current language or null for no translation |
48 | 48 | * @return \Aimeos\MW\View\Iface View object |
49 | 49 | */ |
50 | - public function create( \Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null ) |
|
50 | + public function create(\Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null) |
|
51 | 51 | { |
52 | 52 | $params = $fixed = array(); |
53 | 53 | $request = $this->requestStack->getMasterRequest(); |
54 | 54 | |
55 | - if( $locale !== null ) |
|
55 | + if ($locale !== null) |
|
56 | 56 | { |
57 | - $params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' ); |
|
57 | + $params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params'); |
|
58 | 58 | $fixed = $this->getFixedParams(); |
59 | 59 | |
60 | - $i18n = $this->container->get('aimeos_i18n')->get( array( $locale ) ); |
|
60 | + $i18n = $this->container->get('aimeos_i18n')->get(array($locale)); |
|
61 | 61 | $translation = $i18n[$locale]; |
62 | 62 | } |
63 | 63 | else |
64 | 64 | { |
65 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
65 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
69 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
70 | 70 | |
71 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
72 | - $view->addHelper( 'translate', $helper ); |
|
71 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
72 | + $view->addHelper('translate', $helper); |
|
73 | 73 | |
74 | - $helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed ); |
|
75 | - $view->addHelper( 'url', $helper ); |
|
74 | + $helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed); |
|
75 | + $view->addHelper('url', $helper); |
|
76 | 76 | |
77 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
78 | - $view->addHelper( 'param', $helper ); |
|
77 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
78 | + $view->addHelper('param', $helper); |
|
79 | 79 | |
80 | - $config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) ); |
|
81 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
82 | - $view->addHelper( 'config', $helper ); |
|
80 | + $config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client')); |
|
81 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
82 | + $view->addHelper('config', $helper); |
|
83 | 83 | |
84 | - $sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' ); |
|
85 | - $sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' ); |
|
86 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000 ); |
|
87 | - $view->addHelper( 'number', $helper ); |
|
84 | + $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); |
|
85 | + $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); |
|
86 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); |
|
87 | + $view->addHelper('number', $helper); |
|
88 | 88 | |
89 | - if( $request !== null ) |
|
89 | + if ($request !== null) |
|
90 | 90 | { |
91 | - $helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request ); |
|
92 | - $view->addHelper( 'request', $helper ); |
|
91 | + $helper = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request); |
|
92 | + $view->addHelper('request', $helper); |
|
93 | 93 | } |
94 | 94 | |
95 | - $helper = new \Aimeos\MW\View\Helper\Response\Symfony2( $view ); |
|
96 | - $view->addHelper( 'response', $helper ); |
|
95 | + $helper = new \Aimeos\MW\View\Helper\Response\Symfony2($view); |
|
96 | + $view->addHelper('response', $helper); |
|
97 | 97 | |
98 | - $token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' ); |
|
99 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() ); |
|
100 | - $view->addHelper( 'csrf', $helper ); |
|
98 | + $token = $this->container->get('security.csrf.token_manager')->getToken('_token'); |
|
99 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', $token->getValue()); |
|
100 | + $view->addHelper('csrf', $helper); |
|
101 | 101 | |
102 | 102 | return $view; |
103 | 103 | } |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | $urlparams = array(); |
114 | 114 | $attr = $this->requestStack->getMasterRequest()->attributes; |
115 | 115 | |
116 | - if( ( $site = $attr->get( 'site' ) ) !== null ) { |
|
116 | + if (($site = $attr->get('site')) !== null) { |
|
117 | 117 | $urlparams['site'] = $site; |
118 | 118 | } |
119 | 119 | |
120 | - if( ( $lang = $attr->get( 'locale' ) ) !== null ) { |
|
120 | + if (($lang = $attr->get('locale')) !== null) { |
|
121 | 121 | $urlparams['locale'] = $lang; |
122 | 122 | } |
123 | 123 | |
124 | - if( ( $currency = $attr->get( 'currency' ) ) !== null ) { |
|
124 | + if (($currency = $attr->get('currency')) !== null) { |
|
125 | 125 | $urlparams['currency'] = $currency; |
126 | 126 | } |
127 | 127 |