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

ApiJsonResponderGenerator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 18
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setSerializer() 0 3 1
A addMethods() 0 9 1
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
}