Completed
Push — master ( 8714ce...91124c )
by Thomas
10:30 queued 06:04
created

LocalizationLocalizationJsonResponder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 0
cbo 4
dl 0
loc 40
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A notFound() 0 3 1
A notUpdated() 0 3 1
A read() 0 6 1
A getPayloadMethods() 0 8 1
1
<?php
2
namespace keeko\core\responder;
3
4
use Symfony\Component\HttpFoundation\Request;
5
use Symfony\Component\HttpFoundation\JsonResponse;
6
use keeko\framework\domain\payload\PayloadInterface;
7
use keeko\framework\foundation\AbstractPayloadResponder;
8
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
9
use keeko\core\model\Localization;
10
11
/**
12
 * Automatically generated JsonResponder for Reads the relationship of localization to localization
13
 * 
14
 * @author gossi
15
 */
16
class LocalizationLocalizationJsonResponder extends AbstractPayloadResponder {
17
18
	/**
19
	 * @param Request $request
20
	 * @param PayloadInterface $payload
21
	 */
22
	public function notFound(Request $request, PayloadInterface $payload) {
1 ignored issue
show
Unused Code introduced by
The parameter $request 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...
23
		throw new ResourceNotFoundException($payload->getMessage());
0 ignored issues
show
Bug introduced by
The method getMessage() does not seem to exist on object<keeko\framework\d...yload\PayloadInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
24
	}
25
26
	/**
27
	 * @param Request $request
28
	 * @param PayloadInterface $payload
29
	 */
30
	public function notUpdated(Request $request, PayloadInterface $payload) {
2 ignored issues
show
Unused Code introduced by
The parameter $request 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 $payload 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...
31
		return new JsonResponse(null, 204);
32
	}
33
34
	/**
35
	 * @param Request $request
36
	 * @param PayloadInterface $payload
37
	 */
38
	public function read(Request $request, PayloadInterface $payload) {
1 ignored issue
show
Unused Code introduced by
The parameter $request 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...
39
		$serializer = Localization::getSerializer();
40
		$relationship = $serializer->localization($payload->getModel());
0 ignored issues
show
Bug introduced by
The method getModel() does not seem to exist on object<keeko\framework\d...yload\PayloadInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
41
42
		return new JsonResponse($relationship->toArray());
43
	}
44
45
	/**
46
	 */
47
	protected function getPayloadMethods() {
48
		return [
49
			'keeko\framework\domain\payload\NotFound' => 'notFound',
50
			'keeko\framework\domain\payload\NotValid' => 'notValid',
51
			'keeko\framework\domain\payload\Updated' => 'updated',
52
			'keeko\framework\domain\payload\NotUpdated' => 'notUpdated'
53
		];
54
	}
55
}
56