public function isPaymentType($type) {
return $this->payment_type === $type;
}
class PaymentType
{
const CASH = 1;
const NON_CASH = 2;
}
PaymentType::validate($value)
. /**
* @param PaymentType::* $type
*/
public function isPaymentType($type) {
return $this->payment_type === $type;
}
class PaymentType
{
private const CASH = 1;
private const NON_CASH = 2;
private int $type;
private function __construct(int $type)
{
$this->type = $type;
}
public static function cash(): self
{
return new self(self::CASH);
}
public static function nonCash(): self
{
return new self(self::NON_CASH);
}
public function isCash(): bool
{
return $this->type === self::CASH;
}
public function isNonCash(): bool
{
return $this->type === self::NON_CASH;
}
}