Completed
Pull Request — master (#2015)
by Basil
02:16
created

OfferTrait::getPrice()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace luya\web\jsonld;
4
5
/**
6
 * JsonLd Offer.
7
 *
8
 * @see http://schema.org/Offer
9
 * @author Basil Suter <[email protected]>
10
 * @since 1.0.3
11
 */
12
trait OfferTrait
13
{
14
    use ThingTrait;
15
16
    private $_availability;
17
18
    private $_price;
19
20
    /**
21
     * Price Setter
22
     *
23
     * @param PriceValue $price
24
     * @return static
25
     * @since 1.2.2
26
     */
27
    public function setPrice(PriceValue $price)
28
    {
29
        $this->_price = $price->getValue();
30
        return $this;
31
    }
32
33
    /**
34
     * Get Price
35
     *
36
     * @return mixed
37
     * @since 1.2.2
38
     */
39
    public function getPrice()
40
    {
41
        return $this->_price;
42
    }
43
44
    private $_priceCurrency;
45
46
    /**
47
     * Price Currency Setter.
48
     *
49
     * @param CurrencyValue $currencyValue
50
     * @return static
51
     * @since 1.2.2
52
     */
53
    public function setPriceCurrency(CurrencyValue $currencyValue)
54
    {
55
        $this->_priceCurrency = $currencyValue->getValue();
56
        return $this;
57
    }
58
59
    /**
60
     * Get Price Currency
61
     *
62
     * @return string
63
     * @since 1.2.2
64
     */
65
    public function getPriceCurrency()
66
    {
67
        return $this->_priceCurrency;
68
    }
69
}
70