BlackFriday.php
736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace AC\Promo;
use AC\Promo;
use AC\Type\DateRange;
use AC\Type\Url;
use AC\Type\Url\CouponCode;
class BlackFriday extends Promo
{
/**
* @var string
*/
private $coupon_code;
public function __construct(DateRange $date_range, $coupon_code = null)
{
parent::__construct(
'black-friday',
sprintf(__('%s Off from Black Friday to Cyber Monday', 'codepress-admin-columns'), '25%'),
25,
$date_range
);
$this->coupon_code = $coupon_code;
}
public function get_url(): Url
{
return $this->coupon_code
? new CouponCode(parent::get_url(), $this->coupon_code)
: parent::get_url();
}
}