Test Failed
Push — master ( d01059...3f7048 )
by Devin
01:30
created

Give_Forms_Report::output()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 5
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Give Reports Page/Tab
4
 *
5
 * @package     Give
6
 * @subpackage  Classes/Give_Forms_Report
7
 * @copyright   Copyright (c) 2016, WordImpress
8
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
 * @since       1.8
10
 */
11
12
if ( ! defined( 'ABSPATH' ) ) {
13
	exit; // Exit if accessed directly
14
}
15
16 View Code Duplication
if ( ! class_exists( 'Give_Forms_Report' ) ) :
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
18
	/**
19
	 * Give_Forms_Report.
20
	 *
21
	 * @sine 1.8
22
	 */
23
	class Give_Forms_Report extends Give_Settings_Page {
24
		/**
25
		 * Flag to check if enable saving option for setting page or not
26
		 *
27
		 * @since 1.8.17
28
		 * @var bool
29
		 */
30
		protected $enable_save = false;
31
32
		/**
33
		 * Constructor.
34
		 */
35
		public function __construct() {
36
			$this->id    = 'forms';
37
			$this->label = esc_html__( 'Forms', 'give' );
38
39
			parent::__construct();
40
41
			add_action( 'give_admin_field_report_forms', array( $this, 'render_report_forms_field' ), 10, 2 );
42
43
			// Do not use main form for this tab.
44
			if ( give_get_current_setting_tab() === $this->id ) {
45
				add_action( 'give-reports_open_form', '__return_empty_string' );
46
				add_action( 'give-reports_close_form', '__return_empty_string' );
47
			}
48
		}
49
50
		/**
51
		 * Get settings array.
52
		 *
53
		 * @since  1.8
54
		 * @return array
55
		 */
56
		public function get_settings() {
57
58
			/**
59
			 * Filter the settings.
60
			 *
61
			 * @since  1.8
62
			 *
63
			 * @param  array $settings
64
			 */
65
			$settings = apply_filters(
66
				'give_get_settings_' . $this->id,
67
				array(
68
					array(
69
						'id'         => 'give_reports_forms',
70
						'type'       => 'title',
71
						'table_html' => false,
72
					),
73
					array(
74
						'id'   => 'forms',
75
						'name' => esc_html__( 'Forms', 'give' ),
76
						'type' => 'report_forms',
77
					),
78
					array(
79
						'id'         => 'give_reports_forms',
80
						'type'       => 'sectionend',
81
						'table_html' => false,
82
					),
83
				)
84
			);
85
86
			// Output.
87
			return $settings;
88
		}
89
90
		/**
91
		 * Render report forms field
92
		 *
93
		 * @since  1.8
94
		 * @access public
95
		 *
96
		 * @param $field
97
		 * @param $option_value
98
		 */
99
		public function render_report_forms_field( $field, $option_value ) {
0 ignored issues
show
Unused Code introduced by
The parameter $field is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $option_value is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
100
			do_action( 'give_reports_view_forms' );
101
		}
102
	}
103
104
endif;
105
106
return new Give_Forms_Report();
107