Completed
Push — master ( f0b491...11ee78 )
by Thomas
09:37
created

InstallerKernel::process()   B

Complexity

Conditions 6
Paths 76

Size

Total Lines 31
Code Lines 22

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 31
rs 8.439
cc 6
eloc 22
nc 76
nop 1
1
<?php
2
namespace keeko\core\kernel;
3
4
use keeko\core\installer\InstallerApplication;
5
use keeko\core\model\Application;
6
use Symfony\Component\HttpFoundation\Request;
7
8
class InstallerKernel extends AbstractKernel {
9
10
	public function process(array $options = []) {
11
		try {
12
			$steps = isset($options['steps']) ? $options['steps'] : ['setup'];
13
			
14
			$uri = '';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
15
			$locale = InstallerApplication::DEFAULT_LOCALE;
16
			if (in_array('setup', $steps)) {
17
				$uri = $options['uri'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
18
				$locale = isset($options['locale']) ? $options['locale'] : $locale;
19
			} else if (KEEKO_DATABASE_LOADED) {
20
				$prefs = $this->service->getPreferenceLoader()->getSystemPreferences();
21
				$uri = $prefs->getRootUrl();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
22
			}
23
			
24
			$request = Request::create($uri);
25
			$request->setDefaultLocale(InstallerApplication::DEFAULT_LOCALE);
26
			$request->setLocale($locale);
27
28
			$model = new Application();
29
			$model->setName('keeko/core/installer');
30
			
31
			$app = new InstallerApplication($model, $this->service, $options['io']);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
32
			$this->app = $app;
33
34
			$response = $this->handle($app, $request);
35
			
36
			return $response;
37
		} catch (\Exception $e) {
38
			printf('<b>[%s] %s</b><pre>%s</pre>', get_class($e), $e->getMessage(), $e->getTraceAsString());
39
		}
40
	}
41
	
42
	/**
43
	 * Returns the application
44
	 *
45
	 * @return InstallerApplication
46
	 */
47
	public function getApplication() {
48
		return $this->app;
49
	}
50
}
51