@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | $client = static::createClient(array(), array( |
13 | 13 | 'PHP_AUTH_USER' => 'admin', |
14 | 14 | 'PHP_AUTH_PW' => 'adminpass', |
15 | - ) ); |
|
16 | - $crawler = $client->request( 'GET', '/admin/unittest/de/0' ); |
|
15 | + )); |
|
16 | + $crawler = $client->request('GET', '/admin/unittest/de/0'); |
|
17 | 17 | |
18 | - $this->assertEquals( 1, $crawler->filter( 'head:contains("/admin/{site}/{lang}/{tab}")' )->count() ); |
|
19 | - $this->assertEquals( 1, $crawler->filter( 'body:contains("You need to enable javascript!")' )->count() ); |
|
18 | + $this->assertEquals(1, $crawler->filter('head:contains("/admin/{site}/{lang}/{tab}")')->count()); |
|
19 | + $this->assertEquals(1, $crawler->filter('body:contains("You need to enable javascript!")')->count()); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | $client = static::createClient(array(), array( |
26 | 26 | 'PHP_AUTH_USER' => 'admin', |
27 | 27 | 'PHP_AUTH_PW' => 'adminpass', |
28 | - ) ); |
|
28 | + )); |
|
29 | 29 | |
30 | - $token = $client->getContainer()->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' ); |
|
30 | + $token = $client->getContainer()->get('security.csrf.token_manager')->getToken('aimeos_admin_token'); |
|
31 | 31 | |
32 | - $client->request( 'POST', '/admin/do?_token=' . $token->getValue(), |
|
32 | + $client->request('POST', '/admin/do?_token=' . $token->getValue(), |
|
33 | 33 | array(), array(), array('CONTENT_TYPE' => 'application/json'), |
34 | 34 | '[{"jsonrpc":"2.0","method":"Product_Type.searchItems","params":{"site":"unittest"},"id":2}]' |
35 | 35 | ); |
36 | 36 | |
37 | - $this->assertStringStartsWith( '{', $client->getResponse()->getContent() ); |
|
37 | + $this->assertStringStartsWith('{', $client->getResponse()->getContent()); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | $client = static::createClient(array(), array( |
44 | 44 | 'PHP_AUTH_USER' => 'admin', |
45 | 45 | 'PHP_AUTH_PW' => 'adminpass', |
46 | - ) ); |
|
46 | + )); |
|
47 | 47 | |
48 | - $client->request( 'GET', '/admin/file' ); |
|
48 | + $client->request('GET', '/admin/file'); |
|
49 | 49 | |
50 | - $this->assertContains( 'EXTUTIL', $client->getResponse()->getContent() ); |
|
50 | + $this->assertContains('EXTUTIL', $client->getResponse()->getContent()); |
|
51 | 51 | } |
52 | 52 | } |
@@ -14,13 +14,13 @@ |
||
14 | 14 | $kernel = $this->createKernel(); |
15 | 15 | $kernel->boot(); |
16 | 16 | |
17 | - $application = new Application( $kernel ); |
|
18 | - $application->add( new Command\JobsCommand() ); |
|
17 | + $application = new Application($kernel); |
|
18 | + $application->add(new Command\JobsCommand()); |
|
19 | 19 | |
20 | - $command = $application->find( 'aimeos:jobs' ); |
|
21 | - $commandTester = new CommandTester( $command ); |
|
22 | - $commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest', 'jobs' => 'index/rebuild' ) ); |
|
20 | + $command = $application->find('aimeos:jobs'); |
|
21 | + $commandTester = new CommandTester($command); |
|
22 | + $commandTester->execute(array('command' => $command->getName(), 'site' => 'unittest', 'jobs' => 'index/rebuild')); |
|
23 | 23 | |
24 | - $this->assertEquals( 0, $commandTester->getStatusCode() ); |
|
24 | + $this->assertEquals(0, $commandTester->getStatusCode()); |
|
25 | 25 | } |
26 | 26 | } |
@@ -14,13 +14,13 @@ |
||
14 | 14 | $kernel = $this->createKernel(); |
15 | 15 | $kernel->boot(); |
16 | 16 | |
17 | - $application = new Application( $kernel ); |
|
18 | - $application->add( new Command\CacheCommand() ); |
|
17 | + $application = new Application($kernel); |
|
18 | + $application->add(new Command\CacheCommand()); |
|
19 | 19 | |
20 | - $command = $application->find( 'aimeos:cache' ); |
|
21 | - $commandTester = new CommandTester( $command ); |
|
22 | - $commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest' ) ); |
|
20 | + $command = $application->find('aimeos:cache'); |
|
21 | + $commandTester = new CommandTester($command); |
|
22 | + $commandTester->execute(array('command' => $command->getName(), 'site' => 'unittest')); |
|
23 | 23 | |
24 | - $this->assertEquals( 0, $commandTester->getStatusCode() ); |
|
24 | + $this->assertEquals(0, $commandTester->getStatusCode()); |
|
25 | 25 | } |
26 | 26 | } |
@@ -14,13 +14,13 @@ |
||
14 | 14 | $kernel = $this->createKernel(); |
15 | 15 | $kernel->boot(); |
16 | 16 | |
17 | - $application = new Application( $kernel ); |
|
18 | - $application->add( new Command\SetupCommand() ); |
|
17 | + $application = new Application($kernel); |
|
18 | + $application->add(new Command\SetupCommand()); |
|
19 | 19 | |
20 | - $command = $application->find( 'aimeos:setup' ); |
|
21 | - $commandTester = new CommandTester( $command ); |
|
22 | - $commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest', 'tplsite' => 'unittest', '--option' => 'setup/default/demo:0' ) ); |
|
20 | + $command = $application->find('aimeos:setup'); |
|
21 | + $commandTester = new CommandTester($command); |
|
22 | + $commandTester->execute(array('command' => $command->getName(), 'site' => 'unittest', 'tplsite' => 'unittest', '--option' => 'setup/default/demo:0')); |
|
23 | 23 | |
24 | - $this->assertEquals( 0, $commandTester->getStatusCode() ); |
|
24 | + $this->assertEquals(0, $commandTester->getStatusCode()); |
|
25 | 25 | } |
26 | 26 | } |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | * @param CommandEvent $event CommandEvent instance |
26 | 26 | * @throws \RuntimeException If an error occured |
27 | 27 | */ |
28 | - public static function setupDatabase( CommandEvent $event ) |
|
28 | + public static function setupDatabase(CommandEvent $event) |
|
29 | 29 | { |
30 | 30 | $options = $env = array(); |
31 | 31 | |
32 | - if( $event->isDevMode() ) { |
|
32 | + if ($event->isDevMode()) { |
|
33 | 33 | $options[] = '--option=setup/default/demo:1'; |
34 | 34 | } else { |
35 | 35 | $env[] = '--env=prod'; |
36 | 36 | } |
37 | 37 | |
38 | - self::executeCommand( $event, 'aimeos:setup', $options + $env ); |
|
39 | - self::executeCommand( $event, 'aimeos:cache', $env ); |
|
38 | + self::executeCommand($event, 'aimeos:setup', $options + $env); |
|
39 | + self::executeCommand($event, 'aimeos:cache', $env); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -46,27 +46,27 @@ discard block |
||
46 | 46 | * @param CommandEvent $event CommandEvent instance |
47 | 47 | * @throws \RuntimeException If an error occured |
48 | 48 | */ |
49 | - public static function installBundle( CommandEvent $event ) |
|
49 | + public static function installBundle(CommandEvent $event) |
|
50 | 50 | { |
51 | - $event->getIO()->write( 'Installing the Aimeos shop bundle' ); |
|
51 | + $event->getIO()->write('Installing the Aimeos shop bundle'); |
|
52 | 52 | |
53 | - $options = self::getOptions( $event ); |
|
53 | + $options = self::getOptions($event); |
|
54 | 54 | |
55 | - if( !isset( $options['symfony-app-dir'] ) || !is_dir( $options['symfony-app-dir'] ) ) |
|
55 | + if (!isset($options['symfony-app-dir']) || !is_dir($options['symfony-app-dir'])) |
|
56 | 56 | { |
57 | 57 | $msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available'; |
58 | - throw new \RuntimeException( sprintf( $msg, 'symfony-app-dir', $options['symfony-app-dir'] ) ); |
|
58 | + throw new \RuntimeException(sprintf($msg, 'symfony-app-dir', $options['symfony-app-dir'])); |
|
59 | 59 | } |
60 | 60 | |
61 | - if( !isset( $options['symfony-web-dir'] ) || !is_dir( $options['symfony-web-dir'] ) ) |
|
61 | + if (!isset($options['symfony-web-dir']) || !is_dir($options['symfony-web-dir'])) |
|
62 | 62 | { |
63 | 63 | $msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available'; |
64 | - throw new \RuntimeException( sprintf( $msg, 'symfony-web-dir', $options['symfony-web-dir'] ) ); |
|
64 | + throw new \RuntimeException(sprintf($msg, 'symfony-web-dir', $options['symfony-web-dir'])); |
|
65 | 65 | } |
66 | 66 | |
67 | - self::updateConfigFile( $options['symfony-app-dir'] . '/config/config.yml' ); |
|
68 | - self::updateRoutingFile( $options['symfony-app-dir'] . '/config/routing.yml' ); |
|
69 | - self::createDirectory( $options['symfony-web-dir'] . '/uploads' ); |
|
67 | + self::updateConfigFile($options['symfony-app-dir'] . '/config/config.yml'); |
|
68 | + self::updateRoutingFile($options['symfony-app-dir'] . '/config/routing.yml'); |
|
69 | + self::createDirectory($options['symfony-web-dir'] . '/uploads'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | * @param string $dir Absolute path of the new directory |
77 | 77 | * @throws \RuntimeException If directory couldn't be created |
78 | 78 | */ |
79 | - protected static function createDirectory( $dir ) |
|
79 | + protected static function createDirectory($dir) |
|
80 | 80 | { |
81 | 81 | $perm = 0755; |
82 | 82 | |
83 | - if( !is_dir( $dir ) && !mkdir( $dir, $perm, true ) ) |
|
83 | + if (!is_dir($dir) && !mkdir($dir, $perm, true)) |
|
84 | 84 | { |
85 | 85 | $msg = 'Unable to create directory "%1$s" with permission "%2$s"'; |
86 | - throw new \RuntimeException( sprintf( $msg, $dir, $perm ) ); |
|
86 | + throw new \RuntimeException(sprintf($msg, $dir, $perm)); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
@@ -96,28 +96,28 @@ discard block |
||
96 | 96 | * @param array List of configuration options for the given command |
97 | 97 | * @throws \RuntimeException If the command couldn't be executed |
98 | 98 | */ |
99 | - protected static function executeCommand( CommandEvent $event, $cmd, array $options = array() ) |
|
99 | + protected static function executeCommand(CommandEvent $event, $cmd, array $options = array()) |
|
100 | 100 | { |
101 | - $php = escapeshellarg( self::getPhp() ); |
|
102 | - $console = escapeshellarg( self::getConsoleDir( $event ) . '/console' ); |
|
103 | - $cmd = escapeshellarg( $cmd ); |
|
101 | + $php = escapeshellarg(self::getPhp()); |
|
102 | + $console = escapeshellarg(self::getConsoleDir($event) . '/console'); |
|
103 | + $cmd = escapeshellarg($cmd); |
|
104 | 104 | |
105 | - foreach( $options as $key => $option ) { |
|
106 | - $options[$key] = escapeshellarg( $option ); |
|
105 | + foreach ($options as $key => $option) { |
|
106 | + $options[$key] = escapeshellarg($option); |
|
107 | 107 | } |
108 | 108 | |
109 | - if( $event->getIO()->isDecorated() ) { |
|
109 | + if ($event->getIO()->isDecorated()) { |
|
110 | 110 | $console .= ' --ansi'; |
111 | 111 | } |
112 | 112 | |
113 | - $process = new Process( $php . ' ' . $console . ' ' . $cmd . ' ' . implode( ' ', $options ), null, null, null, 3600 ); |
|
113 | + $process = new Process($php . ' ' . $console . ' ' . $cmd . ' ' . implode(' ', $options), null, null, null, 3600); |
|
114 | 114 | |
115 | - $process->run( function( $type, $buffer ) use ( $event ) { |
|
116 | - $event->getIO()->write( $buffer, false ); |
|
115 | + $process->run(function($type, $buffer) use ($event) { |
|
116 | + $event->getIO()->write($buffer, false); |
|
117 | 117 | } ); |
118 | 118 | |
119 | - if( !$process->isSuccessful() ) { |
|
120 | - throw new \RuntimeException( sprintf( 'An error occurred when executing the "%s" command', escapeshellarg( $cmd ) ) ); |
|
119 | + if (!$process->isSuccessful()) { |
|
120 | + throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command', escapeshellarg($cmd))); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | * @return string The path to the console directory |
131 | 131 | * @throws \RuntimeException If console directory couldn't be found |
132 | 132 | */ |
133 | - protected static function getConsoleDir( CommandEvent $event ) |
|
133 | + protected static function getConsoleDir(CommandEvent $event) |
|
134 | 134 | { |
135 | - $options = self::getOptions( $event ); |
|
135 | + $options = self::getOptions($event); |
|
136 | 136 | |
137 | - if( isset( $options['symfony-bin-dir'] ) && is_dir( $options['symfony-bin-dir'] ) ) { |
|
137 | + if (isset($options['symfony-bin-dir']) && is_dir($options['symfony-bin-dir'])) { |
|
138 | 138 | return $options['symfony-bin-dir']; |
139 | 139 | } |
140 | 140 | |
141 | - if( isset( $options['symfony-app-dir'] ) && is_dir( $options['symfony-app-dir'] ) ) { |
|
141 | + if (isset($options['symfony-app-dir']) && is_dir($options['symfony-app-dir'])) { |
|
142 | 142 | return $options['symfony-app-dir']; |
143 | 143 | } |
144 | 144 | |
145 | - throw new \RuntimeException( sprintf( 'Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir' ) ); |
|
145 | + throw new \RuntimeException(sprintf('Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir')); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @param CommandEvent $event Command event object |
153 | 153 | * @return array Associative list of option keys and values |
154 | 154 | */ |
155 | - protected static function getOptions( CommandEvent $event ) |
|
155 | + protected static function getOptions(CommandEvent $event) |
|
156 | 156 | { |
157 | 157 | return $event->getComposer()->getPackage()->getExtra(); |
158 | 158 | } |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | { |
169 | 169 | $phpFinder = new PhpExecutableFinder; |
170 | 170 | |
171 | - if( !( $phpPath = $phpFinder->find() ) ) { |
|
172 | - throw new \RuntimeException( 'The php executable could not be found, add it to your PATH environment variable and try again' ); |
|
171 | + if (!($phpPath = $phpFinder->find())) { |
|
172 | + throw new \RuntimeException('The php executable could not be found, add it to your PATH environment variable and try again'); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | return $phpPath; |
@@ -182,15 +182,15 @@ discard block |
||
182 | 182 | * @param string $filename Name of the YAML config file |
183 | 183 | * @throws \RuntimeException If file is not found |
184 | 184 | */ |
185 | - protected static function updateConfigFile( $filename ) |
|
185 | + protected static function updateConfigFile($filename) |
|
186 | 186 | { |
187 | - if( ( $content = file_get_contents( $filename ) ) === false ) { |
|
188 | - throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) ); |
|
187 | + if (($content = file_get_contents($filename)) === false) { |
|
188 | + throw new \RuntimeException(sprintf('File "%1$s" not found', $filename)); |
|
189 | 189 | } |
190 | 190 | |
191 | - if( self::addAsseticBundle( $content ) === true ) { |
|
191 | + if (self::addAsseticBundle($content) === true) { |
|
192 | 192 | $fs = new Filesystem(); |
193 | - $fs->dumpFile( $filename, $content ); |
|
193 | + $fs->dumpFile($filename, $content); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
@@ -201,15 +201,15 @@ discard block |
||
201 | 201 | * @param string $filename Name of the YAML config file |
202 | 202 | * @throws \RuntimeException If file is not found |
203 | 203 | */ |
204 | - protected static function updateRoutingFile( $filename ) |
|
204 | + protected static function updateRoutingFile($filename) |
|
205 | 205 | { |
206 | 206 | $update = false; |
207 | 207 | |
208 | - if( ( $content = file_get_contents( $filename ) ) === false ) { |
|
209 | - throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) ); |
|
208 | + if (($content = file_get_contents($filename)) === false) { |
|
209 | + throw new \RuntimeException(sprintf('File "%1$s" not found', $filename)); |
|
210 | 210 | } |
211 | 211 | |
212 | - if( strpos( $content, 'aimeos_shop:' ) === false ) |
|
212 | + if (strpos($content, 'aimeos_shop:') === false) |
|
213 | 213 | { |
214 | 214 | $content .= "\n" . 'aimeos_shop: |
215 | 215 | resource: "@AimeosShopBundle/Resources/config/routing.yml" |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | $update = true; |
219 | 219 | } |
220 | 220 | |
221 | - if( $update === true ) |
|
221 | + if ($update === true) |
|
222 | 222 | { |
223 | 223 | $fs = new Filesystem(); |
224 | - $fs->dumpFile( $filename, $content ); |
|
224 | + $fs->dumpFile($filename, $content); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | * @param string &$content Content of the config.yml file |
233 | 233 | * @return boolean True if modified, false if not |
234 | 234 | */ |
235 | - protected static function addAsseticBundle( &$content ) |
|
235 | + protected static function addAsseticBundle(&$content) |
|
236 | 236 | { |
237 | - if( preg_match( "/ bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content ) !== 1 ) |
|
237 | + if (preg_match("/ bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content) !== 1) |
|
238 | 238 | { |
239 | - $search = array( "/ bundles:[ ]*\[([^\]]+)\]/", "/ bundles:[ ]*\[([ ]*)\]/" ); |
|
240 | - $replace = array( " bundles: [$1,'AimeosShopBundle']", " bundles: ['AimeosShopBundle']" ); |
|
239 | + $search = array("/ bundles:[ ]*\[([^\]]+)\]/", "/ bundles:[ ]*\[([ ]*)\]/"); |
|
240 | + $replace = array(" bundles: [$1,'AimeosShopBundle']", " bundles: ['AimeosShopBundle']"); |
|
241 | 241 | |
242 | - if( ( $content = preg_replace( $search, $replace, $content ) ) !== null ) { |
|
242 | + if (($content = preg_replace($search, $replace, $content)) !== null) { |
|
243 | 243 | return true; |
244 | 244 | } |
245 | 245 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getRoles() |
211 | 211 | { |
212 | - return array( 'ROLE_USER' ); |
|
212 | + return array('ROLE_USER'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -226,23 +226,23 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function serialize() |
228 | 228 | { |
229 | - return serialize( array( |
|
229 | + return serialize(array( |
|
230 | 230 | $this->id, |
231 | 231 | $this->username, |
232 | 232 | $this->password, |
233 | - ) ); |
|
233 | + )); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
237 | 237 | /** |
238 | 238 | * @see \Serializable::unserialize() |
239 | 239 | */ |
240 | - public function unserialize( $serialized ) |
|
240 | + public function unserialize($serialized) |
|
241 | 241 | { |
242 | 242 | list ( |
243 | 243 | $this->id, |
244 | 244 | $this->username, |
245 | 245 | $this->password, |
246 | - ) = unserialize( $serialized ); |
|
246 | + ) = unserialize($serialized); |
|
247 | 247 | } |
248 | 248 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getSalutation() |
211 | 211 | { |
212 | - return ( isset( $this->salutation ) ? (string) $this->salutation : \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN ); |
|
212 | + return (isset($this->salutation) ? (string) $this->salutation : \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function setSalutation($salutation) |
222 | 222 | { |
223 | - switch( $salutation ) |
|
223 | + switch ($salutation) |
|
224 | 224 | { |
225 | 225 | case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN: |
226 | 226 | case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_COMPANY: |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR: |
230 | 230 | break; |
231 | 231 | default: |
232 | - throw new \Exception( sprintf( 'Address salutation "%1$s" is unknown', $value ) ); |
|
232 | + throw new \Exception(sprintf('Address salutation "%1$s" is unknown', $value)); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | $this->salutation = (string) $salutation; |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | */ |
442 | 442 | public function setCountryId($countryid) |
443 | 443 | { |
444 | - $this->countryid = strtoupper( (string) $countryid ); |
|
444 | + $this->countryid = strtoupper((string) $countryid); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | */ |
464 | 464 | public function setLanguageId($langid) |
465 | 465 | { |
466 | - $this->langid = strtolower( (string) $langid ); |
|
466 | + $this->langid = strtolower((string) $langid); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | |
@@ -542,8 +542,8 @@ discard block |
||
542 | 542 | { |
543 | 543 | $pattern = '#^([a-z]+://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?(/.*)?$#'; |
544 | 544 | |
545 | - if( $website !== '' && preg_match( $pattern, $website ) !== 1 ) { |
|
546 | - throw new \Exception( sprintf( 'Invalid web site URL "%1$s"', $website ) ); |
|
545 | + if ($website !== '' && preg_match($pattern, $website) !== 1) { |
|
546 | + throw new \Exception(sprintf('Invalid web site URL "%1$s"', $website)); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | $this->website = (string) $website; |
@@ -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 | } |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function get() |
44 | 44 | { |
45 | - if( $this->object === null ) |
|
45 | + if ($this->object === null) |
|
46 | 46 | { |
47 | - $extDirs = (array) $this->container->getParameter( 'aimeos_shop.extdir' ); |
|
48 | - $this->object = new \Aimeos\Bootstrap( $extDirs, false ); |
|
47 | + $extDirs = (array) $this->container->getParameter('aimeos_shop.extdir'); |
|
48 | + $this->object = new \Aimeos\Bootstrap($extDirs, false); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $this->object; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param Container $container Container object to access parameters |
30 | 30 | */ |
31 | - public function __construct( Container $container ) |
|
31 | + public function __construct(Container $container) |
|
32 | 32 | { |
33 | 33 | $this->container = $container; |
34 | 34 | } |
@@ -40,23 +40,23 @@ discard block |
||
40 | 40 | * @param string $pageName Name of the configured page |
41 | 41 | * @return array Associative list with body and header output separated by client name |
42 | 42 | */ |
43 | - public function getSections( $pageName ) |
|
43 | + public function getSections($pageName) |
|
44 | 44 | { |
45 | 45 | $context = $this->container->get('aimeos_context')->get(); |
46 | - $pagesConfig = $this->container->getParameter( 'aimeos_shop.page' ); |
|
47 | - $result = array( 'aibody' => array(), 'aiheader' => array() ); |
|
46 | + $pagesConfig = $this->container->getParameter('aimeos_shop.page'); |
|
47 | + $result = array('aibody' => array(), 'aiheader' => array()); |
|
48 | 48 | |
49 | 49 | $langid = $context->getLocale()->getLanguageId(); |
50 | - $tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths( 'client/html/templates' ); |
|
51 | - $view = $this->container->get('aimeos_view')->create( $context->getConfig(), $tmplPaths, $langid ); |
|
52 | - $context->setView( $view ); |
|
50 | + $tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths('client/html/templates'); |
|
51 | + $view = $this->container->get('aimeos_view')->create($context->getConfig(), $tmplPaths, $langid); |
|
52 | + $context->setView($view); |
|
53 | 53 | |
54 | - if( isset( $pagesConfig[$pageName] ) ) |
|
54 | + if (isset($pagesConfig[$pageName])) |
|
55 | 55 | { |
56 | - foreach( (array) $pagesConfig[$pageName] as $clientName ) |
|
56 | + foreach ((array) $pagesConfig[$pageName] as $clientName) |
|
57 | 57 | { |
58 | - $client = \Aimeos\Client\Html\Factory::createClient( $context, $tmplPaths, $clientName ); |
|
59 | - $client->setView( clone $view ); |
|
58 | + $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); |
|
59 | + $client->setView(clone $view); |
|
60 | 60 | $client->process(); |
61 | 61 | |
62 | 62 | $result['aibody'][$clientName] = $client->getBody(); |