The trait Idable provides a method equalsId that in turn relies on the
method getId(). If this method does not exist on a class mixing in this
trait, the method will fail.
Adding the getId() as an abstract method to the trait will make sure it
is available.
Loading history...
17
}
18
19
/**
20
* Get the description or title of the Buyable item.
21
*
22
* @return string
23
* @throws \Exception
24
*/
25
public function getBuyableDescription()
26
{
27
throw new Exception('Buyable description has not been set.');
28
}
29
30
/**
31
* Get the price of the Buyable item.
32
*
33
* @return float|null
34
* @throws \Exception
35
*/
36
public function getBuyablePrice()
37
{
38
throw new Exception('Buyable price has not been set.');
39
}
40
41
/**
42
* Any extra fees not based on product quantity.
43
*
44
* @return float|int
45
*/
46
public function getExtraFees()
47
{
48
return 0;
49
}
50
51
/**
52
* An array of options (color, size, etc.) for this buyable item.
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.