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

ContinentSerializer::hydrate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
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 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
namespace keeko\core\model\serializer;
3
4
use keeko\framework\model\AbstractSerializer;
5
6
/**
7
 */
8
class ContinentSerializer 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
			'parent_id' => $model->ParentId(),
18
			'numeric' => $model->Numeric(),
19
			'name' => $model->Name(),
20
		];
21
	}
22
23
	/**
24
	 */
25
	public function getFields() {
26
		return ['id', 'parent_id', 'numeric', 'name'];
27
	}
28
29
	/**
30
	 * @param mixed $model
31
	 */
32
	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...
33
		return $model->getId();
34
	}
35
36
	/**
37
	 */
38
	public function getSortFields() {
39
		return ['id', 'parent_id', 'numeric', 'name'];
40
	}
41
42
	/**
43
	 * @param mixed $model
44
	 */
45
	public function getType($model) {
46
		return 'core/continent';
47
	}
48
49
	/**
50
	 * @param mixed $model
51
	 * @param mixed $data
52
	 */
53
	public function hydrate($model, $data) {
54
		// this model is read-only!
55
		return $model;
56
	}
57
}
58