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 = ''; |
|
|
|
|
15
|
|
|
$locale = InstallerApplication::DEFAULT_LOCALE; |
16
|
|
|
if (in_array('setup', $steps)) { |
17
|
|
|
$uri = $options['uri']; |
|
|
|
|
18
|
|
|
$locale = isset($options['locale']) ? $options['locale'] : $locale; |
19
|
|
|
} else if (KEEKO_DATABASE_LOADED) { |
20
|
|
|
$prefs = $this->service->getPreferenceLoader()->getSystemPreferences(); |
21
|
|
|
$uri = $prefs->getRootUrl(); |
|
|
|
|
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']); |
|
|
|
|
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
|
|
|
|
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
will produce issues in the first and second line, while this second example
will produce no issues.