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

CurrencySerializer   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
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 56
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getAttributes() 0 14 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 CurrencySerializer 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
			'numeric' => $model->Numeric(),
18
			'alpha_3' => $model->Alpha3(),
19
			'name' => $model->Name(),
20
			'symbol_left' => $model->SymbolLeft(),
21
			'symbol_right' => $model->SymbolRight(),
22
			'decimal_digits' => $model->DecimalDigits(),
23
			'sub_divisor' => $model->SubDivisor(),
24
			'sub_symbol_left' => $model->SubSymbolLeft(),
25
			'sub_symbol_right' => $model->SubSymbolRight(),
26
		];
27
	}
28
29
	/**
30
	 */
31
	public function getFields() {
32
		return ['id', 'numeric', 'alpha_3', 'name', 'symbol_left', 'symbol_right', 'decimal_digits', 'sub_divisor', 'sub_symbol_left', 'sub_symbol_right'];
33
	}
34
35
	/**
36
	 * @param mixed $model
37
	 */
38
	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...
39
		return $model->getId();
40
	}
41
42
	/**
43
	 */
44
	public function getSortFields() {
45
		return ['id', 'numeric', 'alpha_3', 'name', 'symbol_left', 'symbol_right', 'decimal_digits', 'sub_divisor', 'sub_symbol_left', 'sub_symbol_right'];
46
	}
47
48
	/**
49
	 * @param mixed $model
50
	 */
51
	public function getType($model) {
52
		return 'core/currency';
53
	}
54
55
	/**
56
	 * @param mixed $model
57
	 * @param mixed $data
58
	 */
59
	public function hydrate($model, $data) {
60
		// this model is read-only!
61
		return $model;
62
	}
63
}
64