Completed
Push — master ( 415b34...7ef068 )
by Thomas
13:10 queued 06:22
created

LocalizationUpdateAction::configureParams()   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 1
1
<?php
2
namespace keeko\core\action;
3
4
use keeko\framework\foundation\AbstractAction;
5
use Symfony\Component\HttpFoundation\Request;
6
use Symfony\Component\HttpFoundation\Response;
7
use Symfony\Component\OptionsResolver\OptionsResolver;
8
use phootwork\json\Json;
9
use keeko\core\domain\LocalizationDomain;
10
11
/**
12
 * Action Class for localization-update
13
 * 
14
 * This code is automatically created. Modifications will probably be overwritten.
15
 */
16
class LocalizationUpdateAction extends AbstractAction {
17
18
	/**
19
	 * @param OptionsResolver $resolver
20
	 */
21
	public function configureParams(OptionsResolver $resolver) {
22
		$resolver->setRequired(['id']);
23
	}
24
25
	/**
26
	 * Automatically generated run method
27
	 * 
28
	 * @param Request $request
29
	 * @return Response
30
	 */
31
	public function run(Request $request) {
32
		$id = $this->getParam('id');
33
		$data = Json::decode($request->getContent());
1 ignored issue
show
Bug introduced by
It seems like $request->getContent() targeting Symfony\Component\HttpFo...n\Request::getContent() can also be of type resource; however, phootwork\json\Json::decode() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
34
		$domain = new LocalizationDomain($this->getServiceContainer());
35
		$payload = $domain->update($id, $data);
36
		return $this->response->run($request, $payload);
0 ignored issues
show
Bug introduced by
The property response does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
37
	}
38
}
39