Completed
Push — master ( da62ab...2e0a22 )
by Thomas
09:51
created

ToManyRelationshipReadActionGenerator::generate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 20
rs 9.4285
cc 1
eloc 12
nc 1
nop 4
1
<?php
2
namespace keeko\tools\generator\action;
3
4
use gossi\codegen\model\PhpClass;
5
use keeko\tools\generator\AbstractActionGenerator;
6
use Propel\Generator\Model\Table;
7
8
class ToManyRelationshipReadActionGenerator extends AbstractActionGenerator {
9
10
	/**
11
	 * Add default blank methods
12
	 * 
13
	 * @param PhpClass $class
14
	 */
15
	public function generate(PhpClass $class, Table $model, Table $foreign, Table $middle) {
1 ignored issue
show
Unused Code introduced by
The parameter $foreign is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $middle is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
16
		// add use statements
17
		$this->ensureBasicSetup($class);
18
		
19
		// method: configureParams(OptionsResolver $resolver)
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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...
20
		$this->addConfigureParamsMethod($class, $this->twig->render('relationship-configureParams.twig'));
21
22
		// method: run(Request $request) : Response
0 ignored issues
show
Unused Code Comprehensibility introduced by
39% 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...
23
		$class->addUseStatement('Symfony\\Component\\HttpFoundation\\Request');
24
		$class->addUseStatement('Symfony\\Component\\HttpFoundation\\Response');
25
		$class->addUseStatement('Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException');
26
		$class->addUseStatement('Tobscure\\JsonApi\\Exception\\InvalidParameterException');
27
		$class->addUseStatement($model->getNamespace() . '\\' . $model->getPhpName() . 'Query');
28
		$class->setMethod($this->generateRunMethod($this->twig->render('to-many-read-run.twig', [
29
			'model' => $model->getCamelCaseName(),
30
			'class' => $model->getPhpName()
31
		])));
32
33
		return $class;
34
	}
35
}