Code Duplication    Length = 12-13 lines in 5 locations

src/generator/response/CreateJsonResponseGenerator.php 1 location

@@ 9-20 (lines=12) @@
6
use keeko\tools\generator\AbstractJsonResponseGenerator;
7
use keeko\tools\utils\NameUtils;
8
9
class CreateJsonResponseGenerator extends AbstractJsonResponseGenerator {
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('create-run.twig', [
17
			'model' => $modelVariableName
18
		])));
19
	}
20
}

src/generator/response/DeleteJsonResponseGenerator.php 1 location

@@ 9-20 (lines=12) @@
6
use keeko\tools\generator\AbstractJsonResponseGenerator;
7
use keeko\tools\utils\NameUtils;
8
9
class DeleteJsonResponseGenerator extends AbstractJsonResponseGenerator {
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('dump-model.twig', [
17
			'model' => $modelVariableName
18
		])));
19
	}
20
}

src/generator/response/ListJsonResponseGenerator.php 1 location

@@ 9-21 (lines=13) @@
6
use keeko\tools\generator\AbstractJsonResponseGenerator;
7
use keeko\tools\utils\NameUtils;
8
9
class ListJsonResponseGenerator extends AbstractJsonResponseGenerator {
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
}

src/generator/response/ReadJsonResponseGenerator.php 1 location

@@ 9-20 (lines=12) @@
6
use keeko\tools\generator\AbstractJsonResponseGenerator;
7
use keeko\tools\utils\NameUtils;
8
9
class ReadJsonResponseGenerator extends AbstractJsonResponseGenerator {
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('dump-model.twig', [
17
			'model' => $modelVariableName
18
		])));
19
	}
20
}

src/generator/response/UpdateJsonResponseGenerator.php 1 location

@@ 9-20 (lines=12) @@
6
use keeko\tools\generator\AbstractJsonResponseGenerator;
7
use keeko\tools\utils\NameUtils;
8
9
class UpdateJsonResponseGenerator extends AbstractJsonResponseGenerator {
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('dump-model.twig', [
17
			'model' => $modelVariableName
18
		])));
19
	}
20
}