Completed
Push — master ( a7ae23...b30b3b )
by Thomas
09:53
created

LanguageSerializerTrait::getAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 20
rs 9.4285
cc 1
eloc 18
nc 1
nop 2
1
<?php
2
namespace keeko\core\serializer\base;
3
4
/**
5
 */
6
trait LanguageSerializerTrait {
7
8
	/**
9
	 * @param mixed $model
10
	 * @param array $fields
11
	 */
12
	public function getAttributes($model, array $fields = null) {
1 ignored issue
show
Unused Code introduced by
The parameter $fields 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...
13
		return [
14
			'id' => $model->Id(),
15
			'alpha_2' => $model->Alpha2(),
16
			'alpha_3T' => $model->Alpha3T(),
17
			'alpha_3B' => $model->Alpha3B(),
18
			'alpha_3' => $model->Alpha3(),
19
			'parent_id' => $model->ParentId(),
20
			'macrolanguage_status' => $model->MacrolanguageStatus(),
21
			'name' => $model->Name(),
22
			'native_name' => $model->NativeName(),
23
			'collate' => $model->Collate(),
24
			'subtag' => $model->Subtag(),
25
			'prefix' => $model->Prefix(),
26
			'scope_id' => $model->ScopeId(),
27
			'type_id' => $model->TypeId(),
28
			'family_id' => $model->FamilyId(),
29
			'default_script_id' => $model->DefaultScriptId(),
30
		];
31
	}
32
33
	/**
34
	 */
35
	public function getFields() {
36
		return ['id', 'alpha_2', 'alpha_3T', 'alpha_3B', 'alpha_3', 'parent_id', 'macrolanguage_status', 'name', 'native_name', 'collate', 'subtag', 'prefix', 'scope_id', 'type_id', 'family_id', 'default_script_id'];
37
	}
38
39
	/**
40
	 * @param mixed $model
41
	 */
42
	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...
43
		return $model->getId();
44
	}
45
46
	/**
47
	 */
48
	public function getSortFields() {
49
		return ['id', 'alpha_2', 'alpha_3T', 'alpha_3B', 'alpha_3', 'parent_id', 'macrolanguage_status', 'name', 'native_name', 'collate', 'subtag', 'prefix', 'scope_id', 'type_id', 'family_id', 'default_script_id'];
50
	}
51
52
	/**
53
	 * @param mixed $model
54
	 */
55
	public function getType($model) {
1 ignored issue
show
Unused Code introduced by
The parameter $model 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...
56
		return 'core/language';
57
	}
58
59
	/**
60
	 * @param mixed $model
61
	 * @param mixed $data
62
	 */
63
	public function hydrate($model, $data) {
1 ignored issue
show
Unused Code introduced by
The parameter $data 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...
64
		// this model is read-only!
65
		return $model;
66
	}
67
}
68