GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

FS_AffiliateTerms::has_renewals_commission()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 13 and the first side effect is on line 10.

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.

Loading history...
2
	/**
3
	 * @package     Freemius
4
	 * @copyright   Copyright (c) 2015, Freemius, Inc.
5
	 * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6
	 * @since       1.2.3
7
	 */
8
9
	if ( ! defined( 'ABSPATH' ) ) {
10
		exit;
11
	}
12
13
	class FS_AffiliateTerms extends FS_Scope_Entity {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
14
15
        #region Properties
16
17
        /**
18
         * @var bool
19
         */
20
        public $is_active;
21
        /**
22
         * @var string Enum: `affiliation` or `rewards`. Defaults to `affiliation`.
23
         */
24
        public $type;
25
        /**
26
         * @var string Enum: `payout` or `credit`. Defaults to `payout`.
27
         */
28
        public $reward_type;
29
        /**
30
         * If `first`, the referral will be attributed to the first visited source containing the affiliation link that
31
         * was clicked.
32
         *
33
         * @var string Enum: `first` or `last`. Defaults to `first`.
34
         */
35
        public $referral_attribution;
36
        /**
37
         * @var int Defaults to `30`, `0` for session cookie, and `null` for endless cookie (until cookies are cleaned).
38
         */
39
        public $cookie_days;
40
        /**
41
         * @var int
42
         */
43
        public $commission;
44
        /**
45
         * @var string Enum: `percentage` or `dollar`. Defaults to `percentage`.
46
         */
47
        public $commission_type;
48
        /**
49
         * @var null|int Defaults to `0` (affiliate only on first payment). `null` for commission for all renewals. If
50
         *          greater than `0`, affiliate will get paid for all renewals for `commission_renewals_days` days after
51
         *          the initial upgrade/purchase.
52
         */
53
        public $commission_renewals_days;
54
        /**
55
         * @var int Only cents and no percentage. In US cents, e.g.: 100 = $1.00. Defaults to `null`.
56
         */
57
        public $install_commission;
58
        /**
59
         * @var string Required default target link, e.g.: pricing page.
60
         */
61
        public $default_url;
62
		/**
63
		 * @var string One of the following: 'all', 'new_customer', 'new_user'.
64
		 *             If 'all' - reward for any user type.
65
		 *             If 'new_customer' - reward only for new customers.
66
		 *             If 'new_user' - reward only for new users.
67
		 */
68
        public $reward_customer_type;
69
        /**
70
         * @var int Defaults to `0` (affiliate only on directly affiliated links). `null` if an affiliate will get
71
         *          paid for all customers' lifetime payments. If greater than `0`, an affiliate will get paid for all
72
         *          customer payments for `future_payments_days` days after the initial payment.
73
         */
74
        public $future_payments_days;
75
        /**
76
         * @var bool If `true`, allow referrals from social sites.
77
         */
78
        public $is_social_allowed;
79
        /**
80
         * @var bool If `true`, allow conversions without HTTP referrer header at all.
81
         */
82
        public $is_app_allowed;
83
        /**
84
         * @var bool If `true`, allow referrals from any site.
85
         */
86
        public $is_any_site_allowed;
87
88
        #endregion Properties
89
90
        /**
91
         * @author Leo Fajardo (@leorw)
92
         *
93
         * @return string
94
         */
95
        function get_formatted_commission()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
96
        {
97
            return ( 'dollar' === $this->commission_type ) ?
98
                ( '$' . $this->commission ) :
99
                ( $this->commission . '%' );
100
        }
101
102
        /**
103
         * @author Leo Fajardo (@leorw)
104
         *
105
         * @return bool
106
         */
107
        function has_lifetime_commission() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
108
            return ( 0 !== $this->future_payments_days );
109
        }
110
111
        /**
112
         * @author Leo Fajardo (@leorw)
113
         *
114
         * @return bool
115
         */
116
        function is_session_cookie() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
117
            return ( 0 == $this->cookie_days );
118
        }
119
120
        /**
121
         * @author Leo Fajardo (@leorw)
122
         *
123
         * @return bool
124
         */
125
        function has_renewals_commission() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
126
            return ( is_null( $this->commission_renewals_days ) || $this->commission_renewals_days > 0 );
127
        }
128
    }