Completed
Pull Request — staging (#840)
by
unknown
15:23
created
src/View/BaseView.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @var array
62 62
 	 */
63
-	protected $_context_ = [];
63
+	protected $_context_ = [ ];
64 64
 
65 65
 	/**
66 66
 	 * Instantiate a View object.
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @return string Rendered HTML.
86 86
 	 * @throws FailedToLoadView If the View URI could not be loaded.
87 87
 	 */
88
-	public function render( array $context = [] ) {
88
+	public function render( array $context = [ ] ) {
89 89
 
90 90
 		// Add context to the current instance to make it available within the
91 91
 		// rendered view.
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	public function render_partial( $uri, array $context = null ) {
141 141
 		$view = new static( $uri );
142 142
 
143
-		return $view->render( $context ?: $this->_context_ );
143
+		return $view->render( $context ? : $this->_context_ );
144 144
 	}
145 145
 
146 146
 	/**
Please login to merge, or discard this patch.
src/View/PostEscapedView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 	 * @return string Rendered HTML.
56 56
 	 * @throws FailedToLoadView If the View URI could not be loaded.
57 57
 	 */
58
-	public function render( array $context = [] ) {
58
+	public function render( array $context = [ ] ) {
59 59
 		return wp_kses_post( $this->view->render( $context ) );
60 60
 	}
61 61
 
Please login to merge, or discard this patch.
src/View/View.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 * @return string Rendered HTML.
34 34
 	 * @throws FailedToLoadView If the View URI could not be loaded.
35 35
 	 */
36
-	public function render( array $context = [] );
36
+	public function render( array $context = [ ] );
37 37
 
38 38
 	/**
39 39
 	 * Render a partial view.
Please login to merge, or discard this patch.
src/Shortcode/BaseShortcode.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	public function register() {
41 41
 		$this->register_assets();
42 42
 
43
-		add_action( 'init', function () {
43
+		add_action( 'init', function() {
44 44
 			add_shortcode( $this->get_tag(), [ $this, 'process_shortcode' ] );
45 45
 		} );
46 46
 	}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @return string Rendered HTML.
72 72
 	 */
73
-	public function render( array $context = [] ) {
73
+	public function render( array $context = [ ] ) {
74 74
 		try {
75 75
 			$this->enqueue_assets();
76 76
 			$view = new PostEscapedView( new TemplatedView( $this->get_view_uri() ) );
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @return array Context to pass onto view.
111 111
 	 */
112 112
 	protected function get_context( array $atts ) {
113
-		return [];
113
+		return [ ];
114 114
 	}
115 115
 
116 116
 	/**
Please login to merge, or discard this patch.
src/Shortcode/EasyFormsShortcode.php 3 patches
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -9,10 +9,6 @@
 block discarded – undo
9 9
 
10 10
 namespace YIKES\EasyForms\Shortcode;
11 11
 
12
-use YIKES\EasyForms\Asset;
13
-use YIKES\EasyForms\AssetAware;
14
-use YIKES\EasyForms\ScriptAsset;
15
-use YIKES\EasyForms\StyleAsset;
16 12
 use YIKES\EasyForms\Exception;
17 13
 use YIKES\EasyForms\View\FormEscapedView;
18 14
 use YIKES\EasyForms\View\NoOverrideLocationView;
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 final class EasyFormsShortcode extends BaseShortcode {
33 33
 
34
-    const TAG           = 'yikes-mailchimp';
34
+	 const TAG           = 'yikes-mailchimp';
35 35
 	const VIEW_URI      = 'views/easy-forms-shortcode';
36 36
 	const SUBMITTED_URI = 'views/easy-forms-shortcode-completed';
37 37
 
@@ -52,26 +52,26 @@  discard block
 block discarded – undo
52 52
 	 * @since %VERSION%
53 53
 	 * @var string
54 54
 	 */
55
-    private $view_uri = self::VIEW_URI;
55
+	 private $view_uri = self::VIEW_URI;
56 56
     
57
-    /**
58
-	 * Register the Shortcode.
59
-	 *
60
-	 * @since %VERSION%
61
-	 */
57
+	 /**
58
+	  * Register the Shortcode.
59
+	  *
60
+	  * @since %VERSION%
61
+	  */
62 62
 	public function register() {
63 63
 		parent::register();
64 64
 		add_action( 'easy_forms_do_shortcode', function( $atts ) {
65 65
 			echo $this->process_shortcode( $atts ); // phpcs:ignore WordPress.Security.EscapeOutput
66 66
 		} );
67
-    }
67
+	 }
68 68
     
69
-    /**
70
-	 * Get the default array of attributes for the shortcode.
71
-	 *
72
-	 * @since %VERSION%
73
-	 * @return array
74
-	 */
69
+	 /**
70
+	  * Get the default array of attributes for the shortcode.
71
+	  *
72
+	  * @since %VERSION%
73
+	  * @return array
74
+	  */
75 75
 	public function get_default_atts() {
76 76
 		return [
77 77
 			'form'                       => '',
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		}
146 146
 	}
147 147
     
148
-   /**
148
+	/**
149 149
 	 * Get the View URI to use for rendering the shortcode.
150 150
 	 *
151 151
 	 * @since %VERSION%
@@ -158,15 +158,15 @@  discard block
 block discarded – undo
158 158
 		}
159 159
 
160 160
 		return $this->view_uri;
161
-    }
161
+	 }
162 162
     
163
-    /**
164
-	 * Set the view URI.
165
-	 *
166
-	 * @since %VERSION%
167
-	 *
168
-	 * @param string $uri The URI to use.
169
-	 */
163
+	 /**
164
+	  * Set the view URI.
165
+	  *
166
+	  * @since %VERSION%
167
+	  *
168
+	  * @param string $uri The URI to use.
169
+	  */
170 170
 	private function set_view_uri( $uri ) {
171 171
 		$this->view_uri = $uri;
172 172
 	}
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
 		return ! empty( $_POST );
182 182
 	}
183 183
     
184
-    /**
185
-	 * Render the current Renderable.
186
-	 *
187
-	 * @since %VERSION%
188
-	 *
189
-	 * @param array $context Context in which to render.
190
-	 *
191
-	 * @return string Rendered HTML.
192
-	 */
184
+	 /**
185
+	  * Render the current Renderable.
186
+	  *
187
+	  * @since %VERSION%
188
+	  *
189
+	  * @param array $context Context in which to render.
190
+	  *
191
+	  * @return string Rendered HTML.
192
+	  */
193 193
 	public function render( array $context = [] ) {
194 194
 		try {
195 195
 			$this->enqueue_assets();
@@ -240,15 +240,15 @@  discard block
 block discarded – undo
240 240
 		return isset( $subscriber ) ? $subscriber : null;
241 241
 	}
242 242
     
243
-    /**
244
-	 * Convert an exception to a string.
245
-	 *
246
-	 * @since %VERSION%
247
-	 *
248
-	 * @param \Exception $e The exception object.
249
-	 *
250
-	 * @return string
251
-	 */
243
+	 /**
244
+	  * Convert an exception to a string.
245
+	  *
246
+	  * @since %VERSION%
247
+	  *
248
+	  * @param \Exception $e The exception object.
249
+	  *
250
+	  * @return string
251
+	  */
252 252
 	private function exception_to_string( \Exception $e ) {
253 253
 		return sprintf(
254 254
 			/* translators: %s refers to the error message */
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 final class EasyFormsShortcode extends BaseShortcode {
33 33
 
34
-    const TAG           = 'yikes-mailchimp';
34
+    const TAG = 'yikes-mailchimp';
35 35
 	const VIEW_URI      = 'views/easy-forms-shortcode';
36 36
 	const SUBMITTED_URI = 'views/easy-forms-shortcode-completed';
37 37
 
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
 	 * @throws InvalidPostID When the post ID is not valid.
107 107
 	 */
108 108
 	protected function get_context( array $atts ) {
109
-		$optin_form = ( new OptinFormRepository() )->find( $atts['form'] );
109
+		$optin_form = ( new OptinFormRepository() )->find( $atts[ 'form' ] );
110 110
 		/** @todo Recaptcha Settings. */
111 111
 		$this->is_submitted = $this->is_submitting_form();
112 112
 		// Set up the classes we'll use for the form and the individual fields.
113
-		$form_classes = $optin_form['form_settings']['yikes-easy-mc-form-class-names'];
113
+		$form_classes = $optin_form[ 'form_settings' ][ 'yikes-easy-mc-form-class-names' ];
114 114
 
115 115
 		// Set up the form object.
116 116
 		$form = $this->get_optin_form( $optin_form->get_id(), $optin_form, $field_classes );
117 117
 		return [
118
-			'form_settings' => $optin_form['form_settings'],
118
+			'form_settings' => $optin_form[ 'form_settings' ],
119 119
 			'optin_form'    => $optin_form,
120 120
 			'form_id'       => $optin_form->get_id(),
121 121
 			'form_classes'  => $form_classes,
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @return string Rendered HTML.
192 192
 	 */
193
-	public function render( array $context = [] ) {
193
+	public function render( array $context = [ ] ) {
194 194
 		try {
195 195
 			$this->enqueue_assets();
196 196
 			$view = new FormEscapedView( new NoOverrideLocationView( $this->get_view_uri() ) );
Please login to merge, or discard this patch.
src/View/FormEscapedView.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @var array
96 96
 	 */
97
-	private $allowed_tags = [];
97
+	private $allowed_tags = [ ];
98 98
 
99 99
 	/**
100 100
 	 * Instantiate a FormEscapedView object.
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return string Rendered HTML.
142 142
 	 * @throws FailedToLoadView If the View URI could not be loaded.
143 143
 	 */
144
-	public function render( array $context = [] ) {
144
+	public function render( array $context = [ ] ) {
145 145
 		return wp_kses( $this->view->render( $context ), $this->allowed_tags );
146 146
 	}
147 147
 
Please login to merge, or discard this patch.
src/Model/OptinForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @return bool Whether the form was successfully updated.
49 49
 	 */
50 50
 	public function update_form( $form_id, $data ) {
51
-		$data['id'] = $form_id;
51
+		$data[ 'id' ] = $form_id;
52 52
 		$all_forms  = $this->get_all_forms();
53 53
 
54 54
 		if ( ! isset( $all_forms[ $form_id ] ) ) {
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		$all_ids         = $this->get_form_ids();
80 80
 		$last_id         = end( $all_ids );
81 81
 		$new_id          = false === $last_id ? 1 : $last_id + 1;
82
-		$form_data['id'] = $new_id;
82
+		$form_data[ 'id' ] = $new_id;
83 83
 
84 84
 		// Ensure our data is consistently sorted
85 85
 		ksort( $form_data );
Please login to merge, or discard this patch.