PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 3.12.0
GiveWP – Donation Plugin and Fundraising Platform v3.12.0
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / Subscriptions / ValueObjects / SubscriptionPeriod.php
SubscriptionPeriod.php
57 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Subscriptions\ValueObjects;
4
5
6 use Give\Framework\Support\ValueObjects\Enum;
7
8 /**
9 * @since 2.19.6
10 *
11 * @method static SubscriptionPeriod DAY()
12 * @method static SubscriptionPeriod WEEK()
13 * @method static SubscriptionPeriod MONTH()
14 * @method static SubscriptionPeriod QUARTER()
15 * @method static SubscriptionPeriod YEAR()
16 * @method bool isDay
17 * @method bool isWeek
18 * @method bool isMonth
19 * @method bool isQuarter
20 * @method bool isYear
21 */
22 class SubscriptionPeriod extends Enum {
23 const DAY = 'day';
24 const WEEK = 'week';
25 const QUARTER = 'quarter';
26 const MONTH = 'month';
27 const YEAR = 'year';
28
29 /**
30 * @since 2.24.0
31 *
32 * @return array
33 */
34 public static function labels(): array
35 {
36 return [
37 self::DAY => [__( 'Daily', 'give' ), __( 'Every %d days', 'give' )],
38 self::WEEK => [__( 'Weekly', 'give' ), __( 'Every %d weeks', 'give' )],
39 self::QUARTER => [__( 'Quarterly', 'give' ), __( 'Every %d quarters', 'give' )],
40 self::MONTH => [__( 'Monthly', 'give' ), __( 'Every %d months', 'give' )],
41 self::YEAR => [__( 'Yearly', 'give' ), __( 'Every %d years', 'give' )],
42 ];
43 }
44
45 /**
46 * @since 2.24.0
47 *
48 * @param int $frequency
49 *
50 * @return string
51 */
52 public function label(int $frequency): string
53 {
54 return self::labels()[ $this->getValue() ][$frequency > 1];
55 }
56 }
57