@@ -35,18 +35,18 @@ discard block |
||
| 35 | 35 | * @param string $classname Name of the setup task class |
| 36 | 36 | * @return boolean True if class is found, false if not |
| 37 | 37 | */ |
| 38 | - public static function autoload( $classname ) |
|
| 38 | + public static function autoload($classname) |
|
| 39 | 39 | { |
| 40 | - if( strncmp( $classname, 'Aimeos\\MW\\Setup\\Task\\', 21 ) === 0 ) |
|
| 40 | + if (strncmp($classname, 'Aimeos\\MW\\Setup\\Task\\', 21) === 0) |
|
| 41 | 41 | { |
| 42 | - $fileName = substr( $classname, 21 ) . '.php'; |
|
| 43 | - $paths = explode( PATH_SEPARATOR, get_include_path() ); |
|
| 42 | + $fileName = substr($classname, 21) . '.php'; |
|
| 43 | + $paths = explode(PATH_SEPARATOR, get_include_path()); |
|
| 44 | 44 | |
| 45 | - foreach( $paths as $path ) |
|
| 45 | + foreach ($paths as $path) |
|
| 46 | 46 | { |
| 47 | 47 | $file = $path . DIRECTORY_SEPARATOR . $fileName; |
| 48 | 48 | |
| 49 | - if( file_exists( $file ) === true && ( include_once $file ) !== false ) { |
|
| 49 | + if (file_exists($file) === true && (include_once $file) !== false) { |
|
| 50 | 50 | return true; |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -63,33 +63,33 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function fire() |
| 65 | 65 | { |
| 66 | - $ctx = $this->getLaravel()->make( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
| 67 | - $ctx->setEditor( 'aimeos:setup' ); |
|
| 66 | + $ctx = $this->getLaravel()->make('\Aimeos\Shop\Base\Context')->get(false); |
|
| 67 | + $ctx->setEditor('aimeos:setup'); |
|
| 68 | 68 | |
| 69 | 69 | $config = $ctx->getConfig(); |
| 70 | - $site = $this->argument( 'site' ); |
|
| 71 | - $template = $this->argument( 'tplsite' ); |
|
| 70 | + $site = $this->argument('site'); |
|
| 71 | + $template = $this->argument('tplsite'); |
|
| 72 | 72 | |
| 73 | - $config->set( 'setup/site', $site ); |
|
| 74 | - $dbconfig = $this->getDbConfig( $config ); |
|
| 75 | - $this->setOptions( $config ); |
|
| 73 | + $config->set('setup/site', $site); |
|
| 74 | + $dbconfig = $this->getDbConfig($config); |
|
| 75 | + $this->setOptions($config); |
|
| 76 | 76 | |
| 77 | - $taskPaths = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get()->getSetupPaths( $template ); |
|
| 77 | + $taskPaths = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get()->getSetupPaths($template); |
|
| 78 | 78 | |
| 79 | 79 | $includePaths = $taskPaths; |
| 80 | 80 | $includePaths[] = get_include_path(); |
| 81 | 81 | |
| 82 | - if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) { |
|
| 83 | - throw new Exception( 'Unable to extend include path' ); |
|
| 82 | + if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) { |
|
| 83 | + throw new Exception('Unable to extend include path'); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - spl_autoload_register( '\Aimeos\Shop\Command\SetupCommand::autoload', true ); |
|
| 86 | + spl_autoload_register('\Aimeos\Shop\Command\SetupCommand::autoload', true); |
|
| 87 | 87 | |
| 88 | - $manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx ); |
|
| 88 | + $manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx); |
|
| 89 | 89 | |
| 90 | - $this->info( sprintf( 'Initializing or updating the Aimeos database tables for site "%1$s"', $site ) ); |
|
| 90 | + $this->info(sprintf('Initializing or updating the Aimeos database tables for site "%1$s"', $site)); |
|
| 91 | 91 | |
| 92 | - $manager->run( 'mysql' ); |
|
| 92 | + $manager->run('mysql'); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | protected function getArguments() |
| 102 | 102 | { |
| 103 | 103 | return array( |
| 104 | - array( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ), |
|
| 105 | - array( 'tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default' ), |
|
| 104 | + array('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'), |
|
| 105 | + array('tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default'), |
|
| 106 | 106 | ); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | protected function getOptions() |
| 116 | 116 | { |
| 117 | 117 | return array( |
| 118 | - array( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() ), |
|
| 118 | + array('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array()), |
|
| 119 | 119 | ); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | * @param \Aimeos\MW\Config\Iface $conf Config object |
| 127 | 127 | * @return array Multi-dimensional associative list of database configuration parameters |
| 128 | 128 | */ |
| 129 | - protected function getDbConfig( \Aimeos\MW\Config\Iface $conf ) |
|
| 129 | + protected function getDbConfig(\Aimeos\MW\Config\Iface $conf) |
|
| 130 | 130 | { |
| 131 | - $dbconfig = $conf->get( 'resource', array() ); |
|
| 131 | + $dbconfig = $conf->get('resource', array()); |
|
| 132 | 132 | |
| 133 | - foreach( $dbconfig as $rname => $dbconf ) |
|
| 133 | + foreach ($dbconfig as $rname => $dbconf) |
|
| 134 | 134 | { |
| 135 | - if( strncmp( $rname, 'db', 2 ) !== 0 ) { |
|
| 136 | - unset( $dbconfig[$rname] ); |
|
| 135 | + if (strncmp($rname, 'db', 2) !== 0) { |
|
| 136 | + unset($dbconfig[$rname]); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
@@ -148,12 +148,12 @@ discard block |
||
| 148 | 148 | * @param array Associative list of database configurations |
| 149 | 149 | * @throws \RuntimeException If the format of the options is invalid |
| 150 | 150 | */ |
| 151 | - protected function setOptions( \Aimeos\MW\Config\Iface $conf ) |
|
| 151 | + protected function setOptions(\Aimeos\MW\Config\Iface $conf) |
|
| 152 | 152 | { |
| 153 | - foreach( (array) $this->option( 'option' ) as $option ) |
|
| 153 | + foreach ((array) $this->option('option') as $option) |
|
| 154 | 154 | { |
| 155 | - list( $name, $value ) = explode( ':', $option ); |
|
| 156 | - $conf->set( $name, $value ); |
|
| 155 | + list($name, $value) = explode(':', $option); |
|
| 156 | + $conf->set($name, $value); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | } |