1 | <?php |
||
13 | class FS_Subscription extends FS_Entity { |
||
14 | |||
15 | #region Properties |
||
16 | |||
17 | /** |
||
18 | * @var number |
||
19 | */ |
||
20 | public $user_id; |
||
21 | /** |
||
22 | * @var number |
||
23 | */ |
||
24 | public $install_id; |
||
25 | /** |
||
26 | * @var number |
||
27 | */ |
||
28 | public $plan_id; |
||
29 | /** |
||
30 | * @var number |
||
31 | */ |
||
32 | public $license_id; |
||
33 | /** |
||
34 | * @var float |
||
35 | */ |
||
36 | public $total_gross; |
||
37 | /** |
||
38 | * @var float |
||
39 | */ |
||
40 | public $amount_per_cycle; |
||
41 | /** |
||
42 | * @var int # of months |
||
43 | */ |
||
44 | public $billing_cycle; |
||
45 | /** |
||
46 | * @var float |
||
47 | */ |
||
48 | public $outstanding_balance; |
||
49 | /** |
||
50 | * @var int |
||
51 | */ |
||
52 | public $failed_payments; |
||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | public $gateway; |
||
57 | /** |
||
58 | * @var string |
||
59 | */ |
||
60 | public $external_id; |
||
61 | /** |
||
62 | * @var string|null |
||
63 | */ |
||
64 | public $trial_ends; |
||
65 | /** |
||
66 | * @var string|null Datetime of the next payment, or null if cancelled |
||
67 | */ |
||
68 | public $next_payment; |
||
69 | /** |
||
70 | * @var string|null |
||
71 | */ |
||
72 | public $vat_id; |
||
73 | /** |
||
74 | * @var string Two characters country code |
||
75 | */ |
||
76 | public $country_code; |
||
77 | |||
78 | #endregion Properties |
||
79 | |||
80 | /** |
||
81 | * @param object|bool $subscription |
||
82 | */ |
||
83 | function __construct( $subscription = false ) { |
||
86 | |||
87 | static function get_type() { |
||
90 | |||
91 | /** |
||
92 | * Check if subscription is active. |
||
93 | * |
||
94 | * @author Vova Feldman (@svovaf) |
||
95 | * @since 1.0.9 |
||
96 | * |
||
97 | * @return bool |
||
98 | */ |
||
99 | function is_active() { |
||
103 | |||
104 | /** |
||
105 | * Subscription considered to be new without any payments |
||
106 | * if the next payment should be made within less than 24 hours |
||
107 | * from the subscription creation. |
||
108 | * |
||
109 | * @author Vova Feldman (@svovaf) |
||
110 | * @since 1.0.9 |
||
111 | * |
||
112 | * @return bool |
||
113 | */ |
||
114 | function is_first_payment_pending() { |
||
117 | |||
118 | /** |
||
119 | * @author Vova Feldman (@svovaf) |
||
120 | * @since 1.1.7 |
||
121 | */ |
||
122 | function has_trial() { |
||
125 | } |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.