Item::get_number()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\IDealBasic;
4
5
use Pronamic\WordPress\Money\Money;
6
7
/**
8
 * Title: iDEAL Basic item
9
 * Description:
10
 * Copyright: 2005-2021 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author  Remco Tolsma
14
 * @version 2.0.0
15
 * @since   1.0.0
16
 */
17
class Item {
18
	/**
19
	 * The number
20
	 *
21
	 * @var string
22
	 */
23
	private $number;
24
25
	/**
26
	 * The description
27
	 *
28
	 * @var string
29
	 */
30
	private $description;
31
32
	/**
33
	 * The quantity
34
	 *
35
	 * @var int
36
	 */
37
	private $quantity;
38
39
	/**
40
	 * The price
41
	 *
42
	 * @var Money
43
	 */
44
	private $price;
45
46
	/**
47
	 * Constructs and initialize a iDEAL basic item
48
	 */
49 3
	public function __construct( $number, $description, $quantity, $price ) {
50 3
		$this->number      = $number;
51 3
		$this->description = $description;
52 3
		$this->quantity    = $quantity;
53 3
		$this->price       = $price;
54 3
	}
55
56
	/**
57
	 * Get the number / identifier of this item
58
	 *
59
	 * @return string
60
	 */
61 2
	public function get_number() {
62 2
		return $this->number;
63
	}
64
65
	/**
66
	 * Get the description of this item
67
	 *
68
	 * @return string
69
	 */
70 2
	public function get_description() {
71 2
		return $this->description;
72
	}
73
74
	/**
75
	 * Get the quantity of this item
76
	 *
77
	 * @return int
78
	 */
79 2
	public function get_quantity() {
80 2
		return $this->quantity;
81
	}
82
83
	/**
84
	 * Get the price of this item
85
	 *
86
	 * @return Money
87
	 */
88 2
	public function get_price() {
89 2
		return $this->price;
90
	}
91
92
	/**
93
	 * Get the amount
94
	 *
95
	 * @return float
96
	 */
97 3
	public function get_amount() {
98 3
		return $this->price->get_value() * $this->quantity;
99
	}
100
}
101