Completed
Push — develop ( 5cde6a...940c70 )
by Reüel
01:34
created

Currency::set_name()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * Currency
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2018 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Money
9
 */
10
11
namespace Pronamic\WordPress\Money;
12
13
/**
14
 * Currency
15
 *
16
 * @author Remco Tolsma
17
 * @version 1.0
18
 */
19
class Currency {
20
	/**
21
	 * Alphabetic code.
22
	 *
23
	 * @var string
24
	 */
25
	private $alphabetic_code;
26
27
	/**
28
	 * Numeric code.
29
	 *
30
	 * @var string
31
	 */
32
	private $numeric_code;
33
34
	/**
35
	 * Symbol.
36
	 *
37
	 * @var string
38
	 */
39
	private $symbol;
40
41
	/**
42
	 * Name.
43
	 *
44
	 * @var string
45
	 */
46
	private $name;
47
48
	/**
49
	 * Number decimals.
50
	 *
51
	 * @var int
52
	 */
53
	private $number_decimals;
54
55
	/**
56
	 * Construct and initialize currency object.
57
	 */
58
	public function __construct() {
59
		$this->set_number_decimals( 2 );
60
	}
61
62
	/**
63
	 * Get alphabetic code.
64
	 *
65
	 * @return string
66
	 */
67
	public function get_alphabetic_code() {
68
		return $this->alphabetic_code;
69
	}
70
71
	/**
72
	 * Set alphabetic code.
73
	 *
74
	 * @param string $alphabetic_code Alphabetic code.
75
	 */
76
	public function set_alphabetic_code( $alphabetic_code ) {
77
		$this->alphabetic_code = $alphabetic_code;
78
	}
79
80
	/**
81
	 * Get numeric code.
82
	 *
83
	 * @return string
84
	 */
85
	public function get_numeric_code() {
86
		return $this->numeric_code;
87
	}
88
89
	/**
90
	 * Set numeric code.
91
	 *
92
	 * @param string $numeric_code Numeric code.
93
	 */
94
	public function set_numeric_code( $numeric_code ) {
95
		$this->numeric_code = $numeric_code;
96
	}
97
98
	/**
99
	 * Get symbol.
100
	 *
101
	 * @return string
102
	 */
103
	public function get_symbol() {
104
		return $this->symbol;
105
	}
106
107
	/**
108
	 * Set symbol.
109
	 *
110
	 * @param string $symbol Symbol.
111
	 */
112
	public function set_symbol( $symbol ) {
113
		$this->symbol = $symbol;
114
	}
115
116
	/**
117
	 * Get number decimals.
118
	 *
119
	 * @return int
120
	 */
121
	public function get_number_decimals() {
122
		return $this->number_decimals;
123
	}
124
125
	/**
126
	 * Set number decimals.
127
	 *
128
	 * @param int $number_decimals Number of decimals.
129
	 */
130
	public function set_number_decimals( $number_decimals ) {
131
		$this->number_decimals = intval( $number_decimals );
132
	}
133
134
	/**
135
	 * Get instance.
136
	 *
137
	 * @param string $alphabetic_code Alphabetic code.
138
	 *
139
	 * @return Currency
140
	 */
141
	public static function get_instance( $alphabetic_code ) {
142
		return Currencies::get_currency( $alphabetic_code );
143
	}
144
145
	/**
146
	 * Get name.
147
	 *
148
	 * @return string
149
	 */
150
	public function get_name() {
151
		return $this->name;
152
	}
153
154
	/**
155
	 * Set name.
156
	 *
157
	 * @param string $name Currency name.
158
	 */
159
	public function set_name( $name ) {
160
		$this->name = $name;
161
	}
162
}
163