Completed
Push — master ( 07ecc6...3ea813 )
by Aimeos
02:56
created
src/Command/Jobs.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -34,28 +34,28 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @param array $argv Associative array from $_SERVER['argv']
36 36
 	 */
37
-	public static function run( array $argv )
37
+	public static function run(array $argv)
38 38
 	{
39
-		array_shift( $argv );
40
-		$options = self::getOptions( $argv );
39
+		array_shift($argv);
40
+		$options = self::getOptions($argv);
41 41
 
42
-		if( ( $jobs = array_shift( $argv ) ) === null ) {
42
+		if (($jobs = array_shift($argv)) === null) {
43 43
 			throw new \Aimeos\Slim\Command\Exception();
44 44
 		}
45
-		$sites = array_shift( $argv );
45
+		$sites = array_shift($argv);
46 46
 
47
-		$config = self::getConfig( $options );
47
+		$config = self::getConfig($options);
48 48
 
49
-		$app = new \Slim\App( $config );
50
-		$aimeos = new \Aimeos\Slim\Bootstrap( $app, $config );
51
-		$aimeos->setup( ( isset( $options['extdir'] ) ? $options['extdir'] : './ext' ) )
52
-			->routes( ( isset( $options['routes'] ) ? $options['routes'] : './src/aimeos-routes.php' ) );
49
+		$app = new \Slim\App($config);
50
+		$aimeos = new \Aimeos\Slim\Bootstrap($app, $config);
51
+		$aimeos->setup((isset($options['extdir']) ? $options['extdir'] : './ext'))
52
+			->routes((isset($options['routes']) ? $options['routes'] : './src/aimeos-routes.php'));
53 53
 
54 54
 		$container = $app->getContainer();
55
-		$context = self::getContext( $container );
55
+		$context = self::getContext($container);
56 56
 
57
-		$siteItems = self::getSiteItems( $context, $sites );
58
-		self::execute( $container->get( 'aimeos' ), $context, $siteItems, $jobs );
57
+		$siteItems = self::getSiteItems($context, $sites);
58
+		self::execute($container->get('aimeos'), $context, $siteItems, $jobs);
59 59
 	}
60 60
 
61 61
 
@@ -65,16 +65,16 @@  discard block
 block discarded – undo
65 65
 	 * @param array $options Associative list of given options
66 66
 	 * @return array Multi-dimensional array of configuration settings
67 67
 	 */
68
-	protected static function getConfig( array $options )
68
+	protected static function getConfig(array $options)
69 69
 	{
70 70
 		$config = array();
71 71
 
72
-		if( isset( $options['config'] ) )
72
+		if (isset($options['config']))
73 73
 		{
74
-			foreach( (array) $options['config'] as $path )
74
+			foreach ((array) $options['config'] as $path)
75 75
 			{
76
-				if( is_file( $path ) ) {
77
-					$config = array_replace_recursive( $config, require $path );
76
+				if (is_file($path)) {
77
+					$config = array_replace_recursive($config, require $path);
78 78
 				}
79 79
 			}
80 80
 		}
@@ -89,25 +89,25 @@  discard block
 block discarded – undo
89 89
 	 * @param \Interop\Container\ContainerInterface $container Dependency injection container
90 90
 	 * @return \Aimeos\MShop\Context\Item\Standard Context object
91 91
 	 */
92
-	protected static function getContext( \Interop\Container\ContainerInterface $container )
92
+	protected static function getContext(\Interop\Container\ContainerInterface $container)
93 93
 	{
94
-		$aimeos = $container->get( 'aimeos' );
95
-		$context = $container->get( 'aimeos_context' )->get( false, array(), 'command' );
94
+		$aimeos = $container->get('aimeos');
95
+		$context = $container->get('aimeos_context')->get(false, array(), 'command');
96 96
 
97 97
 		$env = \Slim\Http\Environment::mock();
98
-		$request = \Slim\Http\Request::createFromEnvironment( $env );
98
+		$request = \Slim\Http\Request::createFromEnvironment($env);
99 99
 		$response = new \Slim\Http\Response();
100 100
 
101
-		$tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' );
102
-		$view = $container->get( 'aimeos_view' )->create( $context->getConfig(), $request, $response, array(), $tmplPaths );
101
+		$tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates');
102
+		$view = $container->get('aimeos_view')->create($context->getConfig(), $request, $response, array(), $tmplPaths);
103 103
 
104
-		$langManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' );
105
-		$langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) );
106
-		$i18n = $container->get( 'aimeos_i18n' )->get( $langids );
104
+		$langManager = \Aimeos\MShop\Factory::createManager($context, 'locale/language');
105
+		$langids = array_keys($langManager->searchItems($langManager->createSearch(true)));
106
+		$i18n = $container->get('aimeos_i18n')->get($langids);
107 107
 
108
-		$context->setEditor( 'aimeos:jobs' );
109
-		$context->setView( $view );
110
-		$context->setI18n( $i18n );
108
+		$context->setEditor('aimeos:jobs');
109
+		$context->setView($view);
110
+		$context->setI18n($i18n);
111 111
 
112 112
 		return $context;
113 113
 	}
@@ -120,22 +120,22 @@  discard block
 block discarded – undo
120 120
 	 * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object
121 121
 	 * @param array $siteItems List of site items implementing \Aimeos\MShop\Locale\Site\Iface
122 122
 	 */
123
-	protected static function execute( \Aimeos\Bootstrap $aimeos, \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems, $jobs )
123
+	protected static function execute(\Aimeos\Bootstrap $aimeos, \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems, $jobs)
124 124
 	{
125
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
125
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
126 126
 
127
-		foreach( $siteItems as $siteItem )
127
+		foreach ($siteItems as $siteItem)
128 128
 		{
129
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false );
130
-			$localeItem->setLanguageId( null );
131
-			$localeItem->setCurrencyId( null );
129
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false);
130
+			$localeItem->setLanguageId(null);
131
+			$localeItem->setCurrencyId(null);
132 132
 
133
-			$ctx->setLocale( $localeItem );
133
+			$ctx->setLocale($localeItem);
134 134
 
135
-			printf( "Executing the Aimeos jobs for \"%s\"\n", $siteItem->getCode() );
135
+			printf("Executing the Aimeos jobs for \"%s\"\n", $siteItem->getCode());
136 136
 
137
-			foreach( (array) explode( ' ', $jobs ) as $jobname ) {
138
-				\Aimeos\Controller\Jobs\Factory::createController( $ctx, $aimeos, $jobname )->run();
137
+			foreach ((array) explode(' ', $jobs) as $jobname) {
138
+				\Aimeos\Controller\Jobs\Factory::createController($ctx, $aimeos, $jobname)->run();
139 139
 			}
140 140
 		}
141 141
 	}
Please login to merge, or discard this patch.
src/Command/Cache.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @param array $argv Associative array from $_SERVER['argv']
36 36
 	 */
37
-	public static function run( array $argv )
37
+	public static function run(array $argv)
38 38
 	{
39
-		array_shift( $argv );
40
-		$options = self::getOptions( $argv );
41
-		$sites = array_shift( $argv );
39
+		array_shift($argv);
40
+		$options = self::getOptions($argv);
41
+		$sites = array_shift($argv);
42 42
 
43
-		$extdirs = ( isset( $options['extdir'] ) ? (array) $options['extdir'] : array() );
44
-		$aimeos = new \Aimeos\Bootstrap( $extdirs );
43
+		$extdirs = (isset($options['extdir']) ? (array) $options['extdir'] : array());
44
+		$aimeos = new \Aimeos\Bootstrap($extdirs);
45 45
 
46
-		$ctx = self::getContext( $aimeos->getConfigPaths(), $options );
47
-		$siteItems = self::getSiteItems( $ctx, $sites );
46
+		$ctx = self::getContext($aimeos->getConfigPaths(), $options);
47
+		$siteItems = self::getSiteItems($ctx, $sites);
48 48
 
49
-		self::clear( $ctx, $siteItems );
49
+		self::clear($ctx, $siteItems);
50 50
 	}
51 51
 
52 52
 
@@ -57,38 +57,38 @@  discard block
 block discarded – undo
57 57
 	 * @param array $options Associative list of configuration options as key/value pairs
58 58
 	 * @return \Aimeos\MShop\Context\Item\Iface Context object
59 59
 	 */
60
-	protected static function getContext( array $confPaths, array $options )
60
+	protected static function getContext(array $confPaths, array $options)
61 61
 	{
62 62
 		$config = array();
63 63
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
64 64
 
65
-		if( isset( $options['config'] ) )
65
+		if (isset($options['config']))
66 66
 		{
67
-			foreach( (array) $options['config'] as $path )
67
+			foreach ((array) $options['config'] as $path)
68 68
 			{
69
-				if( is_file( $path ) ) {
70
-					$config = array_replace_recursive( $config, require $path );
69
+				if (is_file($path)) {
70
+					$config = array_replace_recursive($config, require $path);
71 71
 				} else {
72 72
 					$confPaths[] = $path;
73 73
 				}
74 74
 			}
75 75
 		}
76 76
 
77
-		$conf = new \Aimeos\MW\Config\PHPArray( $config, $confPaths );
78
-		$conf = new \Aimeos\MW\Config\Decorator\Memory( $conf );
77
+		$conf = new \Aimeos\MW\Config\PHPArray($config, $confPaths);
78
+		$conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
79 79
 
80
-		if( ( $cfg = $conf->get( 'command' ) ) !== null ) {
81
-			$conf = new \Aimeos\MW\Config\Decorator\Memory( $conf, $cfg );
80
+		if (($cfg = $conf->get('command')) !== null) {
81
+			$conf = new \Aimeos\MW\Config\Decorator\Memory($conf, $cfg);
82 82
 		}
83 83
 
84
-		$ctx->setConfig( $conf );
84
+		$ctx->setConfig($conf);
85 85
 
86 86
 
87
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
88
-		$ctx->setDatabaseManager( $dbm );
87
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
88
+		$ctx->setDatabaseManager($dbm);
89 89
 
90
-		$logger = new \Aimeos\MW\Logger\Errorlog( \Aimeos\MW\Logger\Base::INFO );
91
-		$ctx->setLogger( $logger );
90
+		$logger = new \Aimeos\MW\Logger\Errorlog(\Aimeos\MW\Logger\Base::INFO);
91
+		$ctx->setLogger($logger);
92 92
 
93 93
 		return $ctx;
94 94
 	}
@@ -100,23 +100,23 @@  discard block
 block discarded – undo
100 100
 	 * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object
101 101
 	 * @param array $siteItems List of site items implementing \Aimeos\MShop\Locale\Site\Iface
102 102
 	 */
103
-	protected static function clear( \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems )
103
+	protected static function clear(\Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems)
104 104
 	{
105
-		$localeManager = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' );
105
+		$localeManager = \Aimeos\MShop\Factory::createManager($ctx, 'locale');
106 106
 
107
-		foreach( $siteItems as $siteItem )
107
+		foreach ($siteItems as $siteItem)
108 108
 		{
109
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
109
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false);
110 110
 
111 111
 			$lcontext = clone $ctx;
112
-			$lcontext->setLocale( $localeItem );
112
+			$lcontext->setLocale($localeItem);
113 113
 
114
-			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext );
115
-			$lcontext->setCache( $cache );
114
+			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext);
115
+			$lcontext->setCache($cache);
116 116
 
117
-			printf( "Clearing the Aimeos cache for site \"%1\$s\"\n", $siteItem->getCode() );
117
+			printf("Clearing the Aimeos cache for site \"%1\$s\"\n", $siteItem->getCode());
118 118
 
119
-			\Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->flush();
119
+			\Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->flush();
120 120
 		}
121 121
 	}
122 122
 }
123 123
\ No newline at end of file
Please login to merge, or discard this patch.