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

LanguageScriptSerializer   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 52
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getAttributes() 0 10 1
A getFields() 0 3 1
A getId() 0 3 1
A getSortFields() 0 3 1
A getType() 0 3 1
A hydrate() 0 4 1
1
<?php
2
namespace keeko\core\model\serializer;
3
4
use keeko\framework\model\AbstractSerializer;
5
6
/**
7
 */
8
class LanguageScriptSerializer extends AbstractSerializer {
9
10
	/**
11
	 * @param mixed $model
12
	 * @param array $fields
13
	 */
14
	public function getAttributes($model, array $fields = null) {
15
		return [
16
			'id' => $model->Id(),
17
			'alpha_4' => $model->Alpha4(),
18
			'numeric' => $model->Numeric(),
19
			'name' => $model->Name(),
20
			'alias' => $model->Alias(),
21
			'direction' => $model->Direction(),
22
		];
23
	}
24
25
	/**
26
	 */
27
	public function getFields() {
28
		return ['id', 'alpha_4', 'numeric', 'name', 'alias', 'direction'];
29
	}
30
31
	/**
32
	 * @param mixed $model
33
	 */
34
	public function getId($model) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
35
		return $model->getId();
36
	}
37
38
	/**
39
	 */
40
	public function getSortFields() {
41
		return ['id', 'alpha_4', 'numeric', 'name', 'alias', 'direction'];
42
	}
43
44
	/**
45
	 * @param mixed $model
46
	 */
47
	public function getType($model) {
48
		return 'core/language-script';
49
	}
50
51
	/**
52
	 * @param mixed $model
53
	 * @param mixed $data
54
	 */
55
	public function hydrate($model, $data) {
56
		// this model is read-only!
57
		return $model;
58
	}
59
}
60