Completed
Push — master ( c9073d...17137d )
by Thomas
17:02
created

ListJsonResponseGenerator::addMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 10
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 10
loc 10
rs 9.4286
cc 1
eloc 6
nc 1
nop 2
1
<?php
2
namespace keeko\tools\generator\response;
3
4
use gossi\codegen\model\PhpClass;
5
use keeko\core\schema\ActionSchema;
6
use keeko\tools\generator\AbstractJsonResponseGenerator;
7
use keeko\tools\utils\NameUtils;
8
9 View Code Duplication
class ListJsonResponseGenerator extends AbstractJsonResponseGenerator {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
11
	protected function addMethods(PhpClass $class, ActionSchema $action) {
12
		$modelName = $this->modelService->getModelNameByAction($action);
13
		$modelVariableName = NameUtils::toCamelCase($modelName);
14
15
		// method: run(Request $request, $data = null)
16
		$class->setMethod($this->generateRunMethod($this->twig->render('list-run.twig', [
17
			'model' => $modelVariableName,
18
			'models' => NameUtils::pluralize($modelName)
19
		])));
20
	}
21
}