Completed
Push — master ( d6a6e9...1d4c8e )
by Thomas
10:31
created

GroupUserReadAction   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configureParams() 0 3 1
A run() 0 11 2
1
<?php
2
namespace keeko\core\action;
3
4
use keeko\framework\foundation\AbstractAction;
5
use Symfony\Component\OptionsResolver\OptionsResolver;
6
use Symfony\Component\HttpFoundation\Request;
7
use Symfony\Component\HttpFoundation\Response;
8
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
9
use keeko\core\model\GroupQuery;
10
11
/**
12
 */
13
class GroupUserReadAction extends AbstractAction {
14
15
	/**
16
	 * @param OptionsResolver $resolver
17
	 */
18
	public function configureParams(OptionsResolver $resolver) {
19
		$resolver->setRequired(['id']);
20
	}
21
22
	/**
23
	 * Automatically generated run method
24
	 * 
25
	 * @param Request $request
26
	 * @return Response
27
	 */
28
	public function run(Request $request) {
29
		$id = $this->getParam('id');
30
		$group = GroupQuery::create()->findOneById($id);
31
32
		if ($group === null) {
33
			throw new ResourceNotFoundException('Group with id ' . $id . ' does not exist');
34
		}
35
36
		// run response
37
		return $this->response->run($request, $group);
38
	}
39
}
40