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_Plugin   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 130
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 130
rs 10
c 0
b 0
f 0
wmc 10
lcom 2
cbo 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 18 6
A is_addon() 0 3 2
A has_affiliate_program() 0 3 1
A get_type() 0 3 1
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.0.3
7
     */
8
9
    if ( ! defined( 'ABSPATH' ) ) {
10
        exit;
11
    }
12
13
    class FS_Plugin 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
         * @since 1.0.6
16
         * @var null|number
17
         */
18
        public $parent_plugin_id;
19
        /**
20
         * @var string
21
         */
22
        public $title;
23
        /**
24
         * @var string
25
         */
26
        public $slug;
27
        /**
28
         * @author Leo Fajardo (@leorw)
29
         * @since 2.2.1
30
         *
31
         * @var string
32
         */
33
        public $premium_slug;
34
        /**
35
         * @since 1.2.2
36
         *
37
         * @var string 'plugin' or 'theme'
38
         */
39
        public $type;
40
        /**
41
         * @author Leo Fajardo (@leorw)
42
         *
43
         * @since  1.2.3
44
         *
45
         * @var string|false false if the module doesn't have an affiliate program or one of the following: 'selected', 'customers', or 'all'.
46
         */
47
        public $affiliate_moderation;
48
        /**
49
         * @var bool Set to true if the free version of the module is hosted on WordPress.org. Defaults to true.
50
         */
51
        public $is_wp_org_compliant = true;
52
53
        #region Install Specific Properties
54
55
        /**
56
         * @var string
57
         */
58
        public $file;
59
        /**
60
         * @var string
61
         */
62
        public $version;
63
        /**
64
         * @var bool
65
         */
66
        public $auto_update;
67
        /**
68
         * @var FS_Plugin_Info
69
         */
70
        public $info;
71
        /**
72
         * @since 1.0.9
73
         *
74
         * @var bool
75
         */
76
        public $is_premium;
77
        /**
78
         * @author Leo Fajardo (@leorw)
79
         * @since 2.2.1
80
         *
81
         * @var string
82
         */
83
        public $premium_suffix;
84
        /**
85
         * @since 1.0.9
86
         *
87
         * @var bool
88
         */
89
        public $is_live;
90
91
        const AFFILIATE_MODERATION_CUSTOMERS = 'customers';
92
93
        #endregion Install Specific Properties
94
95
        /**
96
         * @param stdClass|bool $plugin
97
         */
98
        function __construct( $plugin = 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...
99
            parent::__construct( $plugin );
100
101
            $this->is_premium = false;
102
            $this->is_live    = true;
103
104
            if ( empty( $this->premium_slug ) && ! empty( $plugin->slug ) ) {
105
                $this->premium_slug = "{$this->slug}-premium";
106
            }
107
108
            if ( empty( $this->premium_suffix ) ) {
109
                $this->premium_suffix = '(Premium)';
110
            }
111
112
            if ( isset( $plugin->info ) && is_object( $plugin->info ) ) {
113
                $this->info = new FS_Plugin_Info( $plugin->info );
114
            }
115
        }
116
117
        /**
118
         * Check if plugin is an add-on (has parent).
119
         *
120
         * @author Vova Feldman (@svovaf)
121
         * @since  1.0.6
122
         *
123
         * @return bool
124
         */
125
        function is_addon() {
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 isset( $this->parent_plugin_id ) && is_numeric( $this->parent_plugin_id );
127
        }
128
129
        /**
130
         * @author Leo Fajardo (@leorw)
131
         * @since  1.2.3
132
         *
133
         * @return bool
134
         */
135
        function has_affiliate_program() {
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...
136
            return ( ! empty( $this->affiliate_moderation ) );
137
        }
138
139
        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...
140
            return 'plugin';
141
        }
142
    }