Completed
Push — master ( 84255c...a7d7e4 )
by Thomas
14:38
created

AppInstaller::install()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 6
Bugs 0 Features 0
Metric Value
c 6
b 0
f 0
dl 0
loc 20
rs 9.4286
ccs 0
cts 12
cp 0
cc 3
eloc 12
nc 3
nop 2
crap 12
1
<?php
2
namespace keeko\core\installer;
3
4
use Composer\IO\IOInterface;
5
use keeko\core\model\Application;
6
use keeko\core\model\ApplicationQuery;
7
8
class AppInstaller extends AbstractPackageInstaller {
9
10
	public function install(IOInterface $io, $packageName) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
11
		$model = ApplicationQuery::create()->findOneByName($packageName);
12
		
13
		if ($model === null) {
14
			$io->write('[Keeko] Install Application: ' . $packageName);
15
			
16
			$package = $this->service->getPackageManager()->getPackage($packageName);
17
			$keeko = $package->getKeeko();
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...
18
			
19
			if ($keeko->isApp()) {
20
				$pkg = $keeko->getApp();
21
				
22
				$model = new Application();
23
				$model->setClassName($pkg->getClass());
24
				$this->updatePackage($model, $pkg);
25
			}
26
		}
27
		
28
		return $model;
29
	}
30
31
	public function update(IOInterface $io, $packageName, $from, $to) {
32
		// nothing to do here
33
	}
34
35
	public function uninstall(IOInterface $io, $packageName) {
36
		// nothing to do here
37
	}
38
}