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

AppPackageGenerator::addMethods()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 6
nc 2
nop 1
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
}