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

GroupUserJsonResponder::notUpdated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 2
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 keeko\framework\exceptions\ValidationException;
9
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
10
use keeko\core\model\Group;
11
12
/**
13
 * Automatically generated JsonResponder for Reads the relationship of group to user
14
 * 
15
 * @author gossi
16
 */
17
class GroupUserJsonResponder extends AbstractPayloadResponder {
18
19
	/**
20
	 * @param Request $request
21
	 * @param PayloadInterface $payload
22
	 */
23
	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...
24
		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...
25
	}
26
27
	/**
28
	 * @param Request $request
29
	 * @param PayloadInterface $payload
30
	 */
31
	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...
32
		return new JsonResponse(null, 204);
33
	}
34
35
	/**
36
	 * @param Request $request
37
	 * @param PayloadInterface $payload
38
	 */
39
	public function notValid(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...
40
		throw new ValidationException($payload->getViolations());
0 ignored issues
show
Bug introduced by
The method getViolations() 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
43
	/**
44
	 * @param Request $request
45
	 * @param PayloadInterface $payload
46
	 */
47
	public function updated(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...
48
		$serializer = Group::getSerializer();
49
		$relationship = $serializer->users($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...
Bug introduced by
The method users() does not seem to exist on object<keeko\framework\m...delSerializerInterface>.

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...
50
51
		return new JsonResponse($relationship->toArray());
52
	}
53
54
	/**
55
	 */
56
	protected function getPayloadMethods() {
57
		return [
58
			'keeko\framework\domain\payload\NotFound' => 'notFound',
59
			'keeko\framework\domain\payload\NotValid' => 'notValid',
60
			'keeko\framework\domain\payload\Updated' => 'updated',
61
			'keeko\framework\domain\payload\NotUpdated' => 'notUpdated'
62
		];
63
	}
64
}
65