It is recommend to declare an explicit visibility for __toString.
Generally, we recommend to declare visibility for all methods in your source code.
This has the advantage of clearly communication to other developers, and also
yourself, how this method should be consumed.
If you are not sure which visibility to choose, it is a good idea to start with
the most restrictive visibility, and then raise visibility as needed, i.e.
start with private, and only raise it to protected if a sub-class needs
to have access, or public if an external class needs access.
Loading history...
49
{
50
return (string) $this->getPrice();
51
}
52
53
/**
54
* {@inheritdoc}
55
*/
56
public function getId()
57
{
58
return $this->id;
59
}
60
61
/**
62
* {@inheritdoc}
63
*/
64
public function getChannelCode()
65
{
66
return $this->channelCode;
67
}
68
69
/**
70
* {@inheritdoc}
71
*/
72
public function setChannelCode($channelCode)
73
{
74
$this->channelCode = $channelCode;
75
}
76
77
/**
78
* {@inheritdoc}
79
*/
80
public function getProductVariant()
81
{
82
return $this->productVariant;
83
}
84
85
/**
86
* {@inheritdoc}
87
*/
88
public function setProductVariant(ProductVariantInterface $productVariant = null)
Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.
If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with
private, and only raise it toprotectedif a sub-class needs to have access, orpublicif an external class needs access.