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.
Completed
Push — master ( 737b79...d4ff54 )
by Brad
02:47
created

FS_Payment::is_migrated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
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) 2016, Freemius, Inc.
5
     * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6
     * @since       1.0.0
7
     */
8
9
    if ( ! defined( 'ABSPATH' ) ) {
10
        exit;
11
    }
12
13
    class FS_Payment extends FS_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 number
19
         */
20
        public $plugin_id;
21
        /**
22
         * @var number
23
         */
24
        public $user_id;
25
        /**
26
         * @var number
27
         */
28
        public $install_id;
29
        /**
30
         * @var number
31
         */
32
        public $subscription_id;
33
        /**
34
         * @var number
35
         */
36
        public $plan_id;
37
        /**
38
         * @var number
39
         */
40
        public $license_id;
41
        /**
42
         * @var float
43
         */
44
        public $gross;
45
        /**
46
         * @var number
47
         */
48
        public $bound_payment_id;
49
        /**
50
         * @var string
51
         */
52
        public $external_id;
53
        /**
54
         * @var string
55
         */
56
        public $gateway;
57
        /**
58
         * @var string ISO 3166-1 alpha-2 - two-letter country code.
59
         *
60
         * @link http://www.wikiwand.com/en/ISO_3166-1_alpha-2
61
         */
62
        public $country_code;
63
        /**
64
         * @var string
65
         */
66
        public $vat_id;
67
        /**
68
         * @var float Actual Tax / VAT in $$$
69
         */
70
        public $vat;
71
        /**
72
         * @var int Payment source.
73
         */
74
        public $source = 0;
75
76
        #endregion Properties
77
78
        /**
79
         * @param object|bool $payment
80
         */
81
        function __construct( $payment = false ) {
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...
82
            parent::__construct( $payment );
83
        }
84
85
        static function get_type() {
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...
86
            return 'payment';
87
        }
88
89
        /**
90
         * @author Vova Feldman (@svovaf)
91
         * @since  1.0.0
92
         *
93
         * @return bool
94
         */
95
        function is_refund() {
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
            return ( parent::is_valid_id( $this->bound_payment_id ) && 0 > $this->gross );
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (is_valid_id() instead of is_refund()). Are you sure this is correct? If so, you might want to change this to $this->is_valid_id().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
97
        }
98
99
        /**
100
         * Checks if the payment was migrated from another platform.
101
         *
102
         * @author Vova Feldman (@svovaf)
103
         * @since  2.0.2
104
         *
105
         * @return bool
106
         */
107
        function is_migrated() {
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->source );
109
        }
110
    }