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 — feature/gallery-template-clien... ( 80cd5b...be3a46 )
by Brad
02:36
created

FS_Customizer_Support_Section::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
rs 9.4285
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 19 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.2.7
7
	 */
8
9
	if ( ! defined( 'ABSPATH' ) ) {
10
		exit;
11
	}
12
13
	/**
14
	 * Class Zerif_Customizer_Theme_Info_Main
15
	 *
16
	 * @since  1.0.0
17
	 * @access public
18
	 */
19
	class FS_Customizer_Support_Section extends WP_Customize_Section {
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...
20
21
		function __construct( $manager, $id, $args = array() ) {
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...
22
			$manager->register_section_type( 'FS_Customizer_Support_Section' );
23
24
			parent::__construct( $manager, $id, $args );
25
		}
26
27
		/**
28
		 * The type of customize section being rendered.
29
		 *
30
		 * @since  1.0.0
31
		 * @access public
32
		 * @var    string
33
		 */
34
		public $type = 'freemius-support-section';
35
36
		/**
37
		 * @var Freemius
38
		 */
39
		public $fs = null;
40
41
		/**
42
		 * Add custom parameters to pass to the JS via JSON.
43
		 *
44
		 * @since  1.0.0
45
		 */
46
		public function json() {
47
			$json = parent::json();
48
49
			$is_contact_visible = $this->fs->is_page_visible( 'contact' );
50
			$is_support_visible = $this->fs->is_page_visible( 'support' );
51
52
			$json['theme_title'] = $this->fs->get_plugin_name();
53
54
			if ( $is_contact_visible && $is_support_visible ) {
55
				$json['theme_title'] .= ' ' . $this->fs->get_text( 'support' );
56
			}
57
58
			if ( $is_contact_visible ) {
59
				$json['contact'] = array(
60
					'label' => $this->fs->get_text( 'contact-us' ),
61
					'url'   => $this->fs->contact_url(),
62
				);
63
			}
64
65
			if ( $is_support_visible ) {
66
				$json['support'] = array(
67
					'label' => $this->fs->get_text( 'support-forum' ),
68
					'url'   => $this->fs->get_support_forum_url()
69
				);
70
			}
71
72
			return $json;
73
		}
74
75
		/**
76
		 * Outputs the Underscore.js template.
77
		 *
78
		 * @since  1.0.0
79
		 */
80
		protected function render_template() {
81
			?>
82
			<li id="fs_customizer_support"
83
			    class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
84
				<h3 class="accordion-section-title">
85
					<span>{{ data.theme_title }}</span>
86
					<# if ( data.contact && data.support ) { #>
87
					<div class="button-group">
88
					<# } #>
89
						<# if ( data.contact ) { #>
90
							<a class="button" href="{{ data.contact.url }}" target="_blank">{{ data.contact.label }} </a>
91
							<# } #>
92
						<# if ( data.support ) { #>
93
							<a class="button" href="{{ data.support.url }}" target="_blank">{{ data.support.label }} </a>
94
							<# } #>
95
					<# if ( data.contact && data.support ) { #>
96
					</div>
97
					<# } #>
98
				</h3>
99
			</li>
100
			<?php
101
		}
102
	}