Completed
Push — master ( af5658...fe61ae )
by Thomas
06:08
created

AppPackageGenerator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 18
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ensureBasicSetup() 0 4 1
A addMethods() 0 10 2
1
<?php
2
namespace keeko\tools\generator\package;
3
4
use keeko\tools\generator\package\AbstractPackageGenerator;
5
use gossi\codegen\model\PhpClass;
6
use gossi\codegen\model\PhpMethod;
7
use gossi\codegen\model\PhpParameter;
8
9
class AppPackageGenerator extends AbstractPackageGenerator {
10
11
	protected function ensureBasicSetup(PhpClass $class) {
12
		$class->setParentClassName('AbstractApplication');
13
		$class->addUseStatement('keeko\\framework\\foundation\\AbstractApplication');
14
	}
15
	
16
	protected function addMethods(PhpClass $class) {
17
		// method: run(Request $request, $path)
0 ignored issues
show
Unused Code Comprehensibility introduced by
42% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
18
		if (!$class->hasMethod('run')) {
19
			$class->setMethod(PhpMethod::create('run')
20
				->addParameter(PhpParameter::create('request')->setType('Request'))
21
				->addParameter(PhpParameter::create('path')->setType('string'))
22
			);
23
			$class->addUseStatement('Symfony\\Component\\HttpFoundation\\Request');
24
		}
25
	}
26
}