Completed
Push — master ( f1c264...f58245 )
by Thomas
04:22
created

ApiJsonResponderGenerator::addMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
namespace keeko\tools\generator\responder;
3
4
use gossi\codegen\model\PhpClass;
5
use keeko\framework\schema\ActionSchema;
6
7
class ApiJsonResponderGenerator extends AbstractJsonResponderGenerator {
8
9
	protected $serializer;
10
11
	public function setSerializer($serializer) {
12
		$this->serializer = $serializer;
13
	}
14
	
15
	protected function addMethods(PhpClass $class, ActionSchema $action) {
0 ignored issues
show
Unused Code introduced by
The parameter $action 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
		$serializer = new PhpClass($this->serializer);
17
18
		// method: run(Request $request, $data = null) : JsonResponse
19
		$class->addUseStatement($serializer->getQualifiedName());
20
		$class->setMethod($this->generateRunMethod($this->twig->render('api-run.twig', [
21
			'serializer' => $serializer->getName()
22
		])));
23
	}
24
}