Completed
Branch FET/extra-logging-when-trashin... (2b1ce3)
by
unknown
03:20 queued 22s
created
form_sections/strategies/validation/EE_Int_Validation_Strategy.strategy.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -9,41 +9,41 @@
 block discarded – undo
9 9
 class EE_Int_Validation_Strategy extends EE_Validation_Strategy_Base
10 10
 {
11 11
 
12
-    /**
13
-     * @param null $validation_error_message
14
-     */
15
-    public function __construct($validation_error_message = null)
16
-    {
17
-        if (! $validation_error_message) {
18
-            $validation_error_message = __("Only digits are allowed.", "event_espresso");
19
-        }
20
-        parent::__construct($validation_error_message);
21
-    }
12
+	/**
13
+	 * @param null $validation_error_message
14
+	 */
15
+	public function __construct($validation_error_message = null)
16
+	{
17
+		if (! $validation_error_message) {
18
+			$validation_error_message = __("Only digits are allowed.", "event_espresso");
19
+		}
20
+		parent::__construct($validation_error_message);
21
+	}
22 22
 
23 23
 
24 24
 
25
-    /**
26
-     * @param $normalized_value
27
-     */
28
-    public function validate($normalized_value)
29
-    {
30
-        // this should have already been detected by the normalization strategy
31
-    }
25
+	/**
26
+	 * @param $normalized_value
27
+	 */
28
+	public function validate($normalized_value)
29
+	{
30
+		// this should have already been detected by the normalization strategy
31
+	}
32 32
 
33 33
 
34 34
 
35
-    /**
36
-     * @return array
37
-     */
38
-    public function get_jquery_validation_rule_array()
39
-    {
40
-        return array(
41
-            'number'=>true,
42
-            'step' => 1,
43
-            'messages' => array(
44
-                'number' => $this->get_validation_error_message(),
45
-                'step' => $this->get_validation_error_message()
46
-            )
47
-        );
48
-    }
35
+	/**
36
+	 * @return array
37
+	 */
38
+	public function get_jquery_validation_rule_array()
39
+	{
40
+		return array(
41
+			'number'=>true,
42
+			'step' => 1,
43
+			'messages' => array(
44
+				'number' => $this->get_validation_error_message(),
45
+				'step' => $this->get_validation_error_message()
46
+			)
47
+		);
48
+	}
49 49
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
      */
15 15
     public function __construct($validation_error_message = null)
16 16
     {
17
-        if (! $validation_error_message) {
17
+        if ( ! $validation_error_message) {
18 18
             $validation_error_message = __("Only digits are allowed.", "event_espresso");
19 19
         }
20 20
         parent::__construct($validation_error_message);
Please login to merge, or discard this patch.
validation/EE_Conditionally_Required_Validation_Strategy.strategy.php 2 patches
Indentation   +241 added lines, -241 removed lines patch added patch discarded remove patch
@@ -11,245 +11,245 @@
 block discarded – undo
11 11
 class EE_Conditionally_Required_Validation_Strategy extends EE_Validation_Strategy_Base
12 12
 {
13 13
 
14
-    /**
15
-     * Array describing conditions necessary to make the input required.
16
-     * This is used to derive a jquery dependency expression (see http://jqueryvalidation.org/required-method)
17
-     * or jquery callback; and server-side logic to determine if the field is necessary.
18
-     * @var array
19
-     */
20
-    protected $requirement_conditions;
21
-
22
-
23
-
24
-    /**
25
-     * @param string $validation_error_message
26
-     * @param array $requirement_conditions
27
-     */
28
-    public function __construct($validation_error_message = null, $requirement_conditions = array())
29
-    {
30
-        if (! $validation_error_message) {
31
-            $validation_error_message = __("This field is required.", "event_espresso");
32
-        }
33
-        $this->set_requirement_conditions($requirement_conditions);
34
-        parent::__construct($validation_error_message);
35
-    }
36
-
37
-
38
-
39
-    /**
40
-     * just checks the field isn't blank, provided the requirement conditions
41
-     * indicate this input is still required
42
-     *
43
-     * @param $normalized_value
44
-     * @return bool
45
-     * @throws \EE_Error
46
-     * @throws \EE_Validation_Error
47
-     */
48
-    public function validate($normalized_value)
49
-    {
50
-        if ((
51
-                $normalized_value === ''
52
-                || $normalized_value === null
53
-                || $normalized_value === array()
54
-            )
55
-            && $this->_input_is_required_server_side()
56
-        ) {
57
-            throw new EE_Validation_Error($this->get_validation_error_message(), 'required');
58
-        } else {
59
-            return true;
60
-        }
61
-    }
62
-
63
-
64
-
65
-    /**
66
-     * @return array
67
-     * @throws \EE_Error
68
-     */
69
-    public function get_jquery_validation_rule_array()
70
-    {
71
-        return array(
72
-            'required'=> $this->_get_jquery_requirement_value(),
73
-            'messages' => array(
74
-                'required' => $this->get_validation_error_message()
75
-            )
76
-        );
77
-    }
78
-
79
-    /**
80
-     * Sets the "required conditions". This should be an array, its top-level key
81
-     * is the name of a field, its value is an array. This 2nd level array has two items:
82
-     * the first is the operator (for now only '=' is accepted), and teh 2nd argument is the
83
-     * the value the field should be in order to make the field required.
84
-     * Eg array( 'payment_type' => array( '=', 'credit_card' ).
85
-     *
86
-     * @param array $requirement_conditions
87
-     */
88
-    public function set_requirement_conditions($requirement_conditions)
89
-    {
90
-        $this->requirement_conditions = (array) $requirement_conditions;
91
-    }
92
-
93
-    /**
94
-     * Gets the array that describes when the related input should be required.
95
-     * see set_requirement_conditions for a description of how it should be formatted
96
-     * @return array
97
-     */
98
-    public function get_requirement_conditions()
99
-    {
100
-        return $this->requirement_conditions;
101
-    }
102
-
103
-
104
-
105
-    /**
106
-     * gets jQuery dependency expression used for client-side validation
107
-     * Its possible this could also return a javascript callback used for determining
108
-     * if the input is required or not. That is not yet implemented, however.
109
-     *
110
-     * @return string see http://jqueryvalidation.org/required-method for format
111
-     * @throws \EE_Error
112
-     */
113
-    protected function _get_jquery_requirement_value()
114
-    {
115
-        $requirement_value = '';
116
-        $conditions = $this->get_requirement_conditions();
117
-        if (! is_array($conditions)) {
118
-            EE_Error::throw_exception_if_debugging(
119
-                sprintf(
120
-                    __('Input requirement conditions must be an array. You provided %1$s', 'event_espresso'),
121
-                    $this->_input->name()
122
-                ),
123
-                __FILE__,
124
-                __FUNCTION__,
125
-                __LINE__
126
-            );
127
-            return true;
128
-        }
129
-        if (count($conditions) > 1) {
130
-            EE_Error::throw_exception_if_debugging(
131
-                sprintf(
132
-                    __('Required Validation Strategy does not yet support multiple conditions. You should add it! The related input is %1$s', 'event_espresso'),
133
-                    $this->_input->name()
134
-                ),
135
-                __FILE__,
136
-                __FUNCTION__,
137
-                __LINE__
138
-            );
139
-        }
140
-        foreach ($conditions as $input_path => $op_and_value) {
141
-            $input = $this->_input->find_section_from_path($input_path);
142
-            if (! $input instanceof EE_Form_Input_Base) {
143
-                EE_Error::throw_exception_if_debugging(
144
-                    sprintf(
145
-                        __('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input', 'event_espresso'),
146
-                        $this->_input->name(),
147
-                        $input_path
148
-                    ),
149
-                    __FILE__,
150
-                    __FUNCTION__,
151
-                    __LINE__
152
-                );
153
-                return false;
154
-            }
155
-            list( $op, $value ) = $this->_validate_op_and_value($op_and_value);
156
-            // ok now the jquery dependency expression depends on the input's display strategy.
157
-            if (! $input->get_display_strategy() instanceof EE_Select_Display_Strategy) {
158
-                EE_Error::throw_exception_if_debugging(
159
-                    sprintf(
160
-                        __('Required Validation Strategy can only depend on another input which uses the EE_Select_Display_Strategy, but you specified a field "%1$s" that uses display strategy "%2$s". If you need others, please add support for it! The related input is %3$s', 'event_espresso'),
161
-                        $input->name(),
162
-                        get_class($input->get_display_strategy()),
163
-                        $this->_input->name()
164
-                    ),
165
-                    __FILE__,
166
-                    __FUNCTION__,
167
-                    __LINE__
168
-                );
169
-            }
170
-            $requirement_value = $input->html_id(true) . ' option[value="' . $value . '"]:selected';
171
-        }
172
-        return $requirement_value;
173
-    }
174
-
175
-
176
-
177
-    /**
178
-     * Returns whether or not this input is required based on the _requirement_conditions
179
-     * (not whether or not the input passes validation. That's for the validate method
180
-     * to decide)
181
-     *
182
-     * @return boolean
183
-     * @throws \EE_Error
184
-     */
185
-    protected function _input_is_required_server_side()
186
-    {
187
-        $meets_all_requirements = true;
188
-        $conditions = $this->get_requirement_conditions();
189
-        foreach ($conditions as $input_path => $op_and_value) {
190
-            $input = $this->_input->find_section_from_path($input_path);
191
-            if (! $input instanceof EE_Form_Input_Base) {
192
-                EE_Error::throw_exception_if_debugging(
193
-                    sprintf(
194
-                        __('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input', 'event_espresso'),
195
-                        $this->_input->name(),
196
-                        $input_path
197
-                    ),
198
-                    __FILE__,
199
-                    __FUNCTION__,
200
-                    __LINE__
201
-                );
202
-                return false;
203
-            }
204
-            list( $op, $value ) = $this->_validate_op_and_value($op_and_value);
205
-            switch ($op) {
206
-                case '=':
207
-                default:
208
-                    $meets_all_requirements = $input->normalized_value() === $value;
209
-            }
210
-            if (! $meets_all_requirements) {
211
-                break;
212
-            }
213
-        }
214
-        return $meets_all_requirements;
215
-    }
216
-
217
-
218
-
219
-    /**
220
-     * Verifies this is an array with keys 0 and 1, where key 0 is a usable
221
-     * operator (initially just '=') and key 1 is something that can be cast to a string
222
-     *
223
-     * @param array $op_and_value
224
-     * @return array
225
-     * @throws \EE_Error
226
-     */
227
-    protected function _validate_op_and_value($op_and_value)
228
-    {
229
-        if (! isset($op_and_value[0], $op_and_value[1])) {
230
-                EE_Error::throw_exception_if_debugging(
231
-                    sprintf(
232
-                        __('Required Validation Strategy conditions array\'s value must be an array with two elements: an operator, and a value. It didn\'t. The related input is %1$s', 'event_espresso'),
233
-                        $this->_input->name()
234
-                    ),
235
-                    __FILE__,
236
-                    __FUNCTION__,
237
-                    __LINE__
238
-                );
239
-        }
240
-            $operator = $op_and_value[0];
241
-            $value = (string) $op_and_value[1];
242
-        if ($operator !== '=') {
243
-            EE_Error::throw_exception_if_debugging(
244
-                sprintf(
245
-                    __('Required Validation Strategy conditions can currently only use the equals operator. If you need others, please add support for it! The related input is %1$s', 'event_espresso'),
246
-                    $this->_input->name()
247
-                ),
248
-                __FILE__,
249
-                __FUNCTION__,
250
-                __LINE__
251
-            );
252
-        }
253
-            return array( $operator, $value );
254
-    }
14
+	/**
15
+	 * Array describing conditions necessary to make the input required.
16
+	 * This is used to derive a jquery dependency expression (see http://jqueryvalidation.org/required-method)
17
+	 * or jquery callback; and server-side logic to determine if the field is necessary.
18
+	 * @var array
19
+	 */
20
+	protected $requirement_conditions;
21
+
22
+
23
+
24
+	/**
25
+	 * @param string $validation_error_message
26
+	 * @param array $requirement_conditions
27
+	 */
28
+	public function __construct($validation_error_message = null, $requirement_conditions = array())
29
+	{
30
+		if (! $validation_error_message) {
31
+			$validation_error_message = __("This field is required.", "event_espresso");
32
+		}
33
+		$this->set_requirement_conditions($requirement_conditions);
34
+		parent::__construct($validation_error_message);
35
+	}
36
+
37
+
38
+
39
+	/**
40
+	 * just checks the field isn't blank, provided the requirement conditions
41
+	 * indicate this input is still required
42
+	 *
43
+	 * @param $normalized_value
44
+	 * @return bool
45
+	 * @throws \EE_Error
46
+	 * @throws \EE_Validation_Error
47
+	 */
48
+	public function validate($normalized_value)
49
+	{
50
+		if ((
51
+				$normalized_value === ''
52
+				|| $normalized_value === null
53
+				|| $normalized_value === array()
54
+			)
55
+			&& $this->_input_is_required_server_side()
56
+		) {
57
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'required');
58
+		} else {
59
+			return true;
60
+		}
61
+	}
62
+
63
+
64
+
65
+	/**
66
+	 * @return array
67
+	 * @throws \EE_Error
68
+	 */
69
+	public function get_jquery_validation_rule_array()
70
+	{
71
+		return array(
72
+			'required'=> $this->_get_jquery_requirement_value(),
73
+			'messages' => array(
74
+				'required' => $this->get_validation_error_message()
75
+			)
76
+		);
77
+	}
78
+
79
+	/**
80
+	 * Sets the "required conditions". This should be an array, its top-level key
81
+	 * is the name of a field, its value is an array. This 2nd level array has two items:
82
+	 * the first is the operator (for now only '=' is accepted), and teh 2nd argument is the
83
+	 * the value the field should be in order to make the field required.
84
+	 * Eg array( 'payment_type' => array( '=', 'credit_card' ).
85
+	 *
86
+	 * @param array $requirement_conditions
87
+	 */
88
+	public function set_requirement_conditions($requirement_conditions)
89
+	{
90
+		$this->requirement_conditions = (array) $requirement_conditions;
91
+	}
92
+
93
+	/**
94
+	 * Gets the array that describes when the related input should be required.
95
+	 * see set_requirement_conditions for a description of how it should be formatted
96
+	 * @return array
97
+	 */
98
+	public function get_requirement_conditions()
99
+	{
100
+		return $this->requirement_conditions;
101
+	}
102
+
103
+
104
+
105
+	/**
106
+	 * gets jQuery dependency expression used for client-side validation
107
+	 * Its possible this could also return a javascript callback used for determining
108
+	 * if the input is required or not. That is not yet implemented, however.
109
+	 *
110
+	 * @return string see http://jqueryvalidation.org/required-method for format
111
+	 * @throws \EE_Error
112
+	 */
113
+	protected function _get_jquery_requirement_value()
114
+	{
115
+		$requirement_value = '';
116
+		$conditions = $this->get_requirement_conditions();
117
+		if (! is_array($conditions)) {
118
+			EE_Error::throw_exception_if_debugging(
119
+				sprintf(
120
+					__('Input requirement conditions must be an array. You provided %1$s', 'event_espresso'),
121
+					$this->_input->name()
122
+				),
123
+				__FILE__,
124
+				__FUNCTION__,
125
+				__LINE__
126
+			);
127
+			return true;
128
+		}
129
+		if (count($conditions) > 1) {
130
+			EE_Error::throw_exception_if_debugging(
131
+				sprintf(
132
+					__('Required Validation Strategy does not yet support multiple conditions. You should add it! The related input is %1$s', 'event_espresso'),
133
+					$this->_input->name()
134
+				),
135
+				__FILE__,
136
+				__FUNCTION__,
137
+				__LINE__
138
+			);
139
+		}
140
+		foreach ($conditions as $input_path => $op_and_value) {
141
+			$input = $this->_input->find_section_from_path($input_path);
142
+			if (! $input instanceof EE_Form_Input_Base) {
143
+				EE_Error::throw_exception_if_debugging(
144
+					sprintf(
145
+						__('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input', 'event_espresso'),
146
+						$this->_input->name(),
147
+						$input_path
148
+					),
149
+					__FILE__,
150
+					__FUNCTION__,
151
+					__LINE__
152
+				);
153
+				return false;
154
+			}
155
+			list( $op, $value ) = $this->_validate_op_and_value($op_and_value);
156
+			// ok now the jquery dependency expression depends on the input's display strategy.
157
+			if (! $input->get_display_strategy() instanceof EE_Select_Display_Strategy) {
158
+				EE_Error::throw_exception_if_debugging(
159
+					sprintf(
160
+						__('Required Validation Strategy can only depend on another input which uses the EE_Select_Display_Strategy, but you specified a field "%1$s" that uses display strategy "%2$s". If you need others, please add support for it! The related input is %3$s', 'event_espresso'),
161
+						$input->name(),
162
+						get_class($input->get_display_strategy()),
163
+						$this->_input->name()
164
+					),
165
+					__FILE__,
166
+					__FUNCTION__,
167
+					__LINE__
168
+				);
169
+			}
170
+			$requirement_value = $input->html_id(true) . ' option[value="' . $value . '"]:selected';
171
+		}
172
+		return $requirement_value;
173
+	}
174
+
175
+
176
+
177
+	/**
178
+	 * Returns whether or not this input is required based on the _requirement_conditions
179
+	 * (not whether or not the input passes validation. That's for the validate method
180
+	 * to decide)
181
+	 *
182
+	 * @return boolean
183
+	 * @throws \EE_Error
184
+	 */
185
+	protected function _input_is_required_server_side()
186
+	{
187
+		$meets_all_requirements = true;
188
+		$conditions = $this->get_requirement_conditions();
189
+		foreach ($conditions as $input_path => $op_and_value) {
190
+			$input = $this->_input->find_section_from_path($input_path);
191
+			if (! $input instanceof EE_Form_Input_Base) {
192
+				EE_Error::throw_exception_if_debugging(
193
+					sprintf(
194
+						__('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input', 'event_espresso'),
195
+						$this->_input->name(),
196
+						$input_path
197
+					),
198
+					__FILE__,
199
+					__FUNCTION__,
200
+					__LINE__
201
+				);
202
+				return false;
203
+			}
204
+			list( $op, $value ) = $this->_validate_op_and_value($op_and_value);
205
+			switch ($op) {
206
+				case '=':
207
+				default:
208
+					$meets_all_requirements = $input->normalized_value() === $value;
209
+			}
210
+			if (! $meets_all_requirements) {
211
+				break;
212
+			}
213
+		}
214
+		return $meets_all_requirements;
215
+	}
216
+
217
+
218
+
219
+	/**
220
+	 * Verifies this is an array with keys 0 and 1, where key 0 is a usable
221
+	 * operator (initially just '=') and key 1 is something that can be cast to a string
222
+	 *
223
+	 * @param array $op_and_value
224
+	 * @return array
225
+	 * @throws \EE_Error
226
+	 */
227
+	protected function _validate_op_and_value($op_and_value)
228
+	{
229
+		if (! isset($op_and_value[0], $op_and_value[1])) {
230
+				EE_Error::throw_exception_if_debugging(
231
+					sprintf(
232
+						__('Required Validation Strategy conditions array\'s value must be an array with two elements: an operator, and a value. It didn\'t. The related input is %1$s', 'event_espresso'),
233
+						$this->_input->name()
234
+					),
235
+					__FILE__,
236
+					__FUNCTION__,
237
+					__LINE__
238
+				);
239
+		}
240
+			$operator = $op_and_value[0];
241
+			$value = (string) $op_and_value[1];
242
+		if ($operator !== '=') {
243
+			EE_Error::throw_exception_if_debugging(
244
+				sprintf(
245
+					__('Required Validation Strategy conditions can currently only use the equals operator. If you need others, please add support for it! The related input is %1$s', 'event_espresso'),
246
+					$this->_input->name()
247
+				),
248
+				__FILE__,
249
+				__FUNCTION__,
250
+				__LINE__
251
+			);
252
+		}
253
+			return array( $operator, $value );
254
+	}
255 255
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function __construct($validation_error_message = null, $requirement_conditions = array())
29 29
     {
30
-        if (! $validation_error_message) {
30
+        if ( ! $validation_error_message) {
31 31
             $validation_error_message = __("This field is required.", "event_espresso");
32 32
         }
33 33
         $this->set_requirement_conditions($requirement_conditions);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $requirement_value = '';
116 116
         $conditions = $this->get_requirement_conditions();
117
-        if (! is_array($conditions)) {
117
+        if ( ! is_array($conditions)) {
118 118
             EE_Error::throw_exception_if_debugging(
119 119
                 sprintf(
120 120
                     __('Input requirement conditions must be an array. You provided %1$s', 'event_espresso'),
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         }
140 140
         foreach ($conditions as $input_path => $op_and_value) {
141 141
             $input = $this->_input->find_section_from_path($input_path);
142
-            if (! $input instanceof EE_Form_Input_Base) {
142
+            if ( ! $input instanceof EE_Form_Input_Base) {
143 143
                 EE_Error::throw_exception_if_debugging(
144 144
                     sprintf(
145 145
                         __('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input', 'event_espresso'),
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
                 );
153 153
                 return false;
154 154
             }
155
-            list( $op, $value ) = $this->_validate_op_and_value($op_and_value);
155
+            list($op, $value) = $this->_validate_op_and_value($op_and_value);
156 156
             // ok now the jquery dependency expression depends on the input's display strategy.
157
-            if (! $input->get_display_strategy() instanceof EE_Select_Display_Strategy) {
157
+            if ( ! $input->get_display_strategy() instanceof EE_Select_Display_Strategy) {
158 158
                 EE_Error::throw_exception_if_debugging(
159 159
                     sprintf(
160 160
                         __('Required Validation Strategy can only depend on another input which uses the EE_Select_Display_Strategy, but you specified a field "%1$s" that uses display strategy "%2$s". If you need others, please add support for it! The related input is %3$s', 'event_espresso'),
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
                     __LINE__
168 168
                 );
169 169
             }
170
-            $requirement_value = $input->html_id(true) . ' option[value="' . $value . '"]:selected';
170
+            $requirement_value = $input->html_id(true).' option[value="'.$value.'"]:selected';
171 171
         }
172 172
         return $requirement_value;
173 173
     }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         $conditions = $this->get_requirement_conditions();
189 189
         foreach ($conditions as $input_path => $op_and_value) {
190 190
             $input = $this->_input->find_section_from_path($input_path);
191
-            if (! $input instanceof EE_Form_Input_Base) {
191
+            if ( ! $input instanceof EE_Form_Input_Base) {
192 192
                 EE_Error::throw_exception_if_debugging(
193 193
                     sprintf(
194 194
                         __('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input', 'event_espresso'),
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
                 );
202 202
                 return false;
203 203
             }
204
-            list( $op, $value ) = $this->_validate_op_and_value($op_and_value);
204
+            list($op, $value) = $this->_validate_op_and_value($op_and_value);
205 205
             switch ($op) {
206 206
                 case '=':
207 207
                 default:
208 208
                     $meets_all_requirements = $input->normalized_value() === $value;
209 209
             }
210
-            if (! $meets_all_requirements) {
210
+            if ( ! $meets_all_requirements) {
211 211
                 break;
212 212
             }
213 213
         }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      */
227 227
     protected function _validate_op_and_value($op_and_value)
228 228
     {
229
-        if (! isset($op_and_value[0], $op_and_value[1])) {
229
+        if ( ! isset($op_and_value[0], $op_and_value[1])) {
230 230
                 EE_Error::throw_exception_if_debugging(
231 231
                     sprintf(
232 232
                         __('Required Validation Strategy conditions array\'s value must be an array with two elements: an operator, and a value. It didn\'t. The related input is %1$s', 'event_espresso'),
@@ -250,6 +250,6 @@  discard block
 block discarded – undo
250 250
                 __LINE__
251 251
             );
252 252
         }
253
-            return array( $operator, $value );
253
+            return array($operator, $value);
254 254
     }
255 255
 }
Please login to merge, or discard this patch.
strategies/validation/EE_Required_Validation_Strategy.strategy.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -13,53 +13,53 @@
 block discarded – undo
13 13
 
14 14
 
15 15
 
16
-    /**
17
-     * @param string $validation_error_message
18
-     */
19
-    public function __construct($validation_error_message = null)
20
-    {
21
-        if (! $validation_error_message) {
22
-            $validation_error_message = __("This field is required.", "event_espresso");
23
-        }
24
-        parent::__construct($validation_error_message);
25
-    }
16
+	/**
17
+	 * @param string $validation_error_message
18
+	 */
19
+	public function __construct($validation_error_message = null)
20
+	{
21
+		if (! $validation_error_message) {
22
+			$validation_error_message = __("This field is required.", "event_espresso");
23
+		}
24
+		parent::__construct($validation_error_message);
25
+	}
26 26
 
27 27
 
28 28
 
29
-    /**
30
-     * just checks the field isn't blank, provided the requirement conditions
31
-     * indicate this input is still required
32
-     *
33
-     * @param $normalized_value
34
-     * @return bool
35
-     * @throws \EE_Error
36
-     * @throws \EE_Validation_Error
37
-     */
38
-    public function validate($normalized_value)
39
-    {
40
-        if ($normalized_value === ''
41
-            || $normalized_value === null
42
-            || $normalized_value === array()
43
-        ) {
44
-            throw new EE_Validation_Error($this->get_validation_error_message(), 'required');
45
-        } else {
46
-            return true;
47
-        }
48
-    }
29
+	/**
30
+	 * just checks the field isn't blank, provided the requirement conditions
31
+	 * indicate this input is still required
32
+	 *
33
+	 * @param $normalized_value
34
+	 * @return bool
35
+	 * @throws \EE_Error
36
+	 * @throws \EE_Validation_Error
37
+	 */
38
+	public function validate($normalized_value)
39
+	{
40
+		if ($normalized_value === ''
41
+			|| $normalized_value === null
42
+			|| $normalized_value === array()
43
+		) {
44
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'required');
45
+		} else {
46
+			return true;
47
+		}
48
+	}
49 49
 
50 50
 
51 51
 
52
-    /**
53
-     * @return array
54
-     * @throws \EE_Error
55
-     */
56
-    public function get_jquery_validation_rule_array()
57
-    {
58
-        return array(
59
-            'required'=> true,
60
-            'messages' => array(
61
-                'required' => $this->get_validation_error_message()
62
-            )
63
-        );
64
-    }
52
+	/**
53
+	 * @return array
54
+	 * @throws \EE_Error
55
+	 */
56
+	public function get_jquery_validation_rule_array()
57
+	{
58
+		return array(
59
+			'required'=> true,
60
+			'messages' => array(
61
+				'required' => $this->get_validation_error_message()
62
+			)
63
+		);
64
+	}
65 65
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
      */
19 19
     public function __construct($validation_error_message = null)
20 20
     {
21
-        if (! $validation_error_message) {
21
+        if ( ! $validation_error_message) {
22 22
             $validation_error_message = __("This field is required.", "event_espresso");
23 23
         }
24 24
         parent::__construct($validation_error_message);
Please login to merge, or discard this patch.
strategies/validation/EE_Min_Length_Validation_Strategy.strategy.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -11,32 +11,32 @@
 block discarded – undo
11 11
 class EE_Min_Length_Validation_Strategy extends EE_Validation_Strategy_Base
12 12
 {
13 13
 
14
-    protected $_min_length;
14
+	protected $_min_length;
15 15
 
16
-    public function __construct($validation_error_message = null, $min_length = 0)
17
-    {
18
-        $this->_min_length = $min_length;
19
-        parent::__construct($validation_error_message);
20
-    }
16
+	public function __construct($validation_error_message = null, $min_length = 0)
17
+	{
18
+		$this->_min_length = $min_length;
19
+		parent::__construct($validation_error_message);
20
+	}
21 21
 
22
-    /**
23
-     * @param $normalized_value
24
-     */
25
-    public function validate($normalized_value)
26
-    {
27
-        if ($this->_min_length > 0 &&
28
-                $normalized_value &&
29
-                is_string($normalized_value) &&
30
-                strlen($normalized_value) < $this->_min_length) {
31
-            throw new EE_Validation_Error($this->get_validation_error_message(), 'minlength');
32
-        }
33
-    }
22
+	/**
23
+	 * @param $normalized_value
24
+	 */
25
+	public function validate($normalized_value)
26
+	{
27
+		if ($this->_min_length > 0 &&
28
+				$normalized_value &&
29
+				is_string($normalized_value) &&
30
+				strlen($normalized_value) < $this->_min_length) {
31
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'minlength');
32
+		}
33
+	}
34 34
 
35
-    /**
36
-     * @return array
37
-     */
38
-    public function get_jquery_validation_rule_array()
39
-    {
40
-        return array( 'minlength'=> $this->_min_length, 'messages' => array( 'minlength' => $this->get_validation_error_message() ) );
41
-    }
35
+	/**
36
+	 * @return array
37
+	 */
38
+	public function get_jquery_validation_rule_array()
39
+	{
40
+		return array( 'minlength'=> $this->_min_length, 'messages' => array( 'minlength' => $this->get_validation_error_message() ) );
41
+	}
42 42
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,6 +37,6 @@
 block discarded – undo
37 37
      */
38 38
     public function get_jquery_validation_rule_array()
39 39
     {
40
-        return array( 'minlength'=> $this->_min_length, 'messages' => array( 'minlength' => $this->get_validation_error_message() ) );
40
+        return array('minlength'=> $this->_min_length, 'messages' => array('minlength' => $this->get_validation_error_message()));
41 41
     }
42 42
 }
Please login to merge, or discard this patch.
strategies/validation/EE_Simple_HTML_Validation_Strategy.strategy.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -13,57 +13,57 @@
 block discarded – undo
13 13
 class EE_Simple_HTML_Validation_Strategy extends EE_Validation_Strategy_Base
14 14
 {
15 15
 
16
-    /**
17
-     * @param null $validation_error_message
18
-     */
19
-    public function __construct($validation_error_message = null)
20
-    {
21
-        if (! $validation_error_message) {
22
-            $allowedtags = $this->_get_allowed_tags();
23
-            $validation_error_message = sprintf(__("Only simple HTML tags are allowed. Eg, %s", "event_espresso"), implode(",", array_keys($allowedtags)));
24
-        }
25
-        parent::__construct($validation_error_message);
26
-    }
16
+	/**
17
+	 * @param null $validation_error_message
18
+	 */
19
+	public function __construct($validation_error_message = null)
20
+	{
21
+		if (! $validation_error_message) {
22
+			$allowedtags = $this->_get_allowed_tags();
23
+			$validation_error_message = sprintf(__("Only simple HTML tags are allowed. Eg, %s", "event_espresso"), implode(",", array_keys($allowedtags)));
24
+		}
25
+		parent::__construct($validation_error_message);
26
+	}
27 27
 
28 28
 
29 29
 
30
-    /**
31
-     * get tags allowed
32
-     */
33
-    protected function _get_allowed_tags()
34
-    {
35
-        return EEH_HTML::get_simple_tags();
36
-    }
30
+	/**
31
+	 * get tags allowed
32
+	 */
33
+	protected function _get_allowed_tags()
34
+	{
35
+		return EEH_HTML::get_simple_tags();
36
+	}
37 37
 
38 38
 
39 39
 
40
-    /**
41
-     * add_more_tags
42
-     *
43
-     * generates and returns a string that lists the top-level HTML tags that are allowable for this input
44
-     *
45
-     * @return string
46
-     */
47
-    public function get_list_of_allowed_tags()
48
-    {
49
-        $allowed_tags = $this->_get_allowed_tags();
50
-        ksort($allowed_tags);
51
-        return implode(', ', array_keys($allowed_tags));
52
-    }
40
+	/**
41
+	 * add_more_tags
42
+	 *
43
+	 * generates and returns a string that lists the top-level HTML tags that are allowable for this input
44
+	 *
45
+	 * @return string
46
+	 */
47
+	public function get_list_of_allowed_tags()
48
+	{
49
+		$allowed_tags = $this->_get_allowed_tags();
50
+		ksort($allowed_tags);
51
+		return implode(', ', array_keys($allowed_tags));
52
+	}
53 53
 
54 54
 
55 55
 
56
-    /**
57
-     * @param $normalized_value
58
-     * @throws \EE_Validation_Error
59
-     */
60
-    public function validate($normalized_value)
61
-    {
62
-        $allowedtags = $this->_get_allowed_tags();
63
-        parent::validate($normalized_value);
64
-        $normalized_value_sans_tags =  wp_kses("$normalized_value", $allowedtags);
65
-        if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) {
66
-            throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags');
67
-        }
68
-    }
56
+	/**
57
+	 * @param $normalized_value
58
+	 * @throws \EE_Validation_Error
59
+	 */
60
+	public function validate($normalized_value)
61
+	{
62
+		$allowedtags = $this->_get_allowed_tags();
63
+		parent::validate($normalized_value);
64
+		$normalized_value_sans_tags =  wp_kses("$normalized_value", $allowedtags);
65
+		if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) {
66
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags');
67
+		}
68
+	}
69 69
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
      */
19 19
     public function __construct($validation_error_message = null)
20 20
     {
21
-        if (! $validation_error_message) {
21
+        if ( ! $validation_error_message) {
22 22
             $allowedtags = $this->_get_allowed_tags();
23 23
             $validation_error_message = sprintf(__("Only simple HTML tags are allowed. Eg, %s", "event_espresso"), implode(",", array_keys($allowedtags)));
24 24
         }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
         $allowedtags = $this->_get_allowed_tags();
63 63
         parent::validate($normalized_value);
64
-        $normalized_value_sans_tags =  wp_kses("$normalized_value", $allowedtags);
64
+        $normalized_value_sans_tags = wp_kses("$normalized_value", $allowedtags);
65 65
         if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) {
66 66
             throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags');
67 67
         }
Please login to merge, or discard this patch.
strategies/validation/EE_Float_Validation_Strategy.strategy.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -11,36 +11,36 @@
 block discarded – undo
11 11
 class EE_Float_Validation_Strategy extends EE_Validation_Strategy_Base
12 12
 {
13 13
 
14
-    /**
15
-     * @param null $validation_error_message
16
-     */
17
-    public function __construct($validation_error_message = null)
18
-    {
19
-        if (! $validation_error_message) {
20
-            $validation_error_message = sprintf(__("Only numeric characters, commas, periods, and spaces, please!", "event_espresso"));
21
-        }
22
-        parent::__construct($validation_error_message);
23
-    }
14
+	/**
15
+	 * @param null $validation_error_message
16
+	 */
17
+	public function __construct($validation_error_message = null)
18
+	{
19
+		if (! $validation_error_message) {
20
+			$validation_error_message = sprintf(__("Only numeric characters, commas, periods, and spaces, please!", "event_espresso"));
21
+		}
22
+		parent::__construct($validation_error_message);
23
+	}
24 24
 
25 25
 
26 26
 
27
-    /**
28
-     *
29
-     * @param $normalized_value
30
-     * @return bool
31
-     */
32
-    public function validate($normalized_value)
33
-    {
34
-        // errors should have been detected by the normalization strategy
35
-    }
27
+	/**
28
+	 *
29
+	 * @param $normalized_value
30
+	 * @return bool
31
+	 */
32
+	public function validate($normalized_value)
33
+	{
34
+		// errors should have been detected by the normalization strategy
35
+	}
36 36
 
37 37
 
38 38
 
39
-    /**
40
-     * @return array
41
-     */
42
-    public function get_jquery_validation_rule_array()
43
-    {
44
-        return array('number'=>true, 'messages' => array( 'number' => $this->get_validation_error_message() ) );
45
-    }
39
+	/**
40
+	 * @return array
41
+	 */
42
+	public function get_jquery_validation_rule_array()
43
+	{
44
+		return array('number'=>true, 'messages' => array( 'number' => $this->get_validation_error_message() ) );
45
+	}
46 46
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function __construct($validation_error_message = null)
18 18
     {
19
-        if (! $validation_error_message) {
19
+        if ( ! $validation_error_message) {
20 20
             $validation_error_message = sprintf(__("Only numeric characters, commas, periods, and spaces, please!", "event_espresso"));
21 21
         }
22 22
         parent::__construct($validation_error_message);
@@ -41,6 +41,6 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function get_jquery_validation_rule_array()
43 43
     {
44
-        return array('number'=>true, 'messages' => array( 'number' => $this->get_validation_error_message() ) );
44
+        return array('number'=>true, 'messages' => array('number' => $this->get_validation_error_message()));
45 45
     }
46 46
 }
Please login to merge, or discard this patch.
strategies/validation/EE_Plaintext_Validation_Strategy.strategy.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -13,27 +13,27 @@
 block discarded – undo
13 13
 class EE_Plaintext_Validation_Strategy extends EE_Validation_Strategy_Base
14 14
 {
15 15
 
16
-    /**
17
-     * @param null $validation_error_message
18
-     */
19
-    public function __construct($validation_error_message = null)
20
-    {
21
-        if (! $validation_error_message) {
22
-            $validation_error_message = __("HTML tags are not permitted in this field", "event_espresso");
23
-        }
24
-        parent::__construct($validation_error_message);
25
-    }
16
+	/**
17
+	 * @param null $validation_error_message
18
+	 */
19
+	public function __construct($validation_error_message = null)
20
+	{
21
+		if (! $validation_error_message) {
22
+			$validation_error_message = __("HTML tags are not permitted in this field", "event_espresso");
23
+		}
24
+		parent::__construct($validation_error_message);
25
+	}
26 26
 
27
-    /**
28
-     * @param $normalized_value
29
-     * @throws \EE_Validation_Error
30
-     */
31
-    public function validate($normalized_value)
32
-    {
33
-        $no_tags = wp_strip_all_tags($normalized_value);
34
-        if (strlen($no_tags) < strlen(trim($normalized_value))) {
35
-            throw new EE_Validation_Error($this->get_validation_error_message(), 'no_html_tags');
36
-        }
37
-        parent::validate($normalized_value);
38
-    }
27
+	/**
28
+	 * @param $normalized_value
29
+	 * @throws \EE_Validation_Error
30
+	 */
31
+	public function validate($normalized_value)
32
+	{
33
+		$no_tags = wp_strip_all_tags($normalized_value);
34
+		if (strlen($no_tags) < strlen(trim($normalized_value))) {
35
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'no_html_tags');
36
+		}
37
+		parent::validate($normalized_value);
38
+	}
39 39
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
      */
19 19
     public function __construct($validation_error_message = null)
20 20
     {
21
-        if (! $validation_error_message) {
21
+        if ( ! $validation_error_message) {
22 22
             $validation_error_message = __("HTML tags are not permitted in this field", "event_espresso");
23 23
         }
24 24
         parent::__construct($validation_error_message);
Please login to merge, or discard this patch.
validation/EE_Model_Matching_Query_Validation_Strategy.strategy.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function __construct($validation_error_message = null, $model_name = '', $query_params = array(), $input_field_name = '')
34 34
     {
35
-        if (! EE_Registry::instance()->is_model_name($model_name)) {
35
+        if ( ! EE_Registry::instance()->is_model_name($model_name)) {
36 36
             throw new EE_Error(sprintf(__('You must provide a valid model object ', 'event_espresso'), $model_name));
37 37
         }
38 38
         $this->_model = EE_Registry::instance()->load_model($model_name);
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
             return true;
59 59
         }
60 60
         $combined_query_params = $this->get_query_params();
61
-        $combined_query_params[0][ $this->treat_input_as_field() ] = $normalized_value;
62
-        if (! $this->get_model()->exists($combined_query_params)) {
61
+        $combined_query_params[0][$this->treat_input_as_field()] = $normalized_value;
62
+        if ( ! $this->get_model()->exists($combined_query_params)) {
63 63
             throw new EE_Validation_Error($this->get_validation_error_message(), 'no_matching_model_object');
64 64
         }
65 65
     }
Please login to merge, or discard this patch.
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -13,86 +13,86 @@
 block discarded – undo
13 13
 class EE_Model_Matching_Query_Validation_Strategy extends EE_Validation_Strategy_Base
14 14
 {
15 15
 
16
-    /**
17
-     *
18
-     * @var EEM_Base
19
-     */
20
-    protected $_model;
21
-    protected $_query_params;
22
-    protected $_input_field_name;
16
+	/**
17
+	 *
18
+	 * @var EEM_Base
19
+	 */
20
+	protected $_model;
21
+	protected $_query_params;
22
+	protected $_input_field_name;
23 23
 
24 24
 
25 25
 
26
-    /**
27
-     * @param string $validation_error_message
28
-     * @param string $model_name  name of an EEM_Base model
29
-     * @param array  $query_params     @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
30
-     * @param string $input_field_name the input will be treated as this field's value
31
-     * @throws \EE_Error
32
-     */
33
-    public function __construct($validation_error_message = null, $model_name = '', $query_params = array(), $input_field_name = '')
34
-    {
35
-        if (! EE_Registry::instance()->is_model_name($model_name)) {
36
-            throw new EE_Error(sprintf(__('You must provide a valid model object ', 'event_espresso'), $model_name));
37
-        }
38
-        $this->_model = EE_Registry::instance()->load_model($model_name);
39
-        $this->_query_params = $query_params;
40
-        if (empty($input_field_name)) {
41
-            $input_field_name = $this->_model->primary_key_name();
42
-        }
43
-        $this->_input_field_name = $input_field_name;
44
-        parent::__construct($validation_error_message);
45
-    }
26
+	/**
27
+	 * @param string $validation_error_message
28
+	 * @param string $model_name  name of an EEM_Base model
29
+	 * @param array  $query_params     @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
30
+	 * @param string $input_field_name the input will be treated as this field's value
31
+	 * @throws \EE_Error
32
+	 */
33
+	public function __construct($validation_error_message = null, $model_name = '', $query_params = array(), $input_field_name = '')
34
+	{
35
+		if (! EE_Registry::instance()->is_model_name($model_name)) {
36
+			throw new EE_Error(sprintf(__('You must provide a valid model object ', 'event_espresso'), $model_name));
37
+		}
38
+		$this->_model = EE_Registry::instance()->load_model($model_name);
39
+		$this->_query_params = $query_params;
40
+		if (empty($input_field_name)) {
41
+			$input_field_name = $this->_model->primary_key_name();
42
+		}
43
+		$this->_input_field_name = $input_field_name;
44
+		parent::__construct($validation_error_message);
45
+	}
46 46
 
47 47
 
48 48
 
49
-    /**
50
-     * @param $normalized_value
51
-     * @return bool|void
52
-     * @throws \EE_Error
53
-     * @throws \EE_Validation_Error
54
-     */
55
-    public function validate($normalized_value)
56
-    {
57
-        if (empty($normalized_value)) {
58
-            return true;
59
-        }
60
-        $combined_query_params = $this->get_query_params();
61
-        $combined_query_params[0][ $this->treat_input_as_field() ] = $normalized_value;
62
-        if (! $this->get_model()->exists($combined_query_params)) {
63
-            throw new EE_Validation_Error($this->get_validation_error_message(), 'no_matching_model_object');
64
-        }
65
-    }
49
+	/**
50
+	 * @param $normalized_value
51
+	 * @return bool|void
52
+	 * @throws \EE_Error
53
+	 * @throws \EE_Validation_Error
54
+	 */
55
+	public function validate($normalized_value)
56
+	{
57
+		if (empty($normalized_value)) {
58
+			return true;
59
+		}
60
+		$combined_query_params = $this->get_query_params();
61
+		$combined_query_params[0][ $this->treat_input_as_field() ] = $normalized_value;
62
+		if (! $this->get_model()->exists($combined_query_params)) {
63
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'no_matching_model_object');
64
+		}
65
+	}
66 66
 
67
-    /**
68
-     * Gets the model used for querying
69
-     * @return EEM_Base
70
-     */
71
-    public function get_model()
72
-    {
73
-        return $this->_model;
74
-    }
67
+	/**
68
+	 * Gets the model used for querying
69
+	 * @return EEM_Base
70
+	 */
71
+	public function get_model()
72
+	{
73
+		return $this->_model;
74
+	}
75 75
 
76
-    /**
77
-     * Returns query params used for model query
78
-     * @return array
79
-     */
80
-    public function get_query_params()
81
-    {
82
-        return (array) $this->_query_params;
83
-    }
76
+	/**
77
+	 * Returns query params used for model query
78
+	 * @return array
79
+	 */
80
+	public function get_query_params()
81
+	{
82
+		return (array) $this->_query_params;
83
+	}
84 84
 
85
-    /**
86
-     * Gets the name of the field that will be used for lookup.
87
-     * eg it could be "EVT_name", meaning that if there is a model object in
88
-     * the database that has that event name, and matching the other query parameters
89
-     * on this strategy, the input will pass validation server-side
90
-     * @return string
91
-     */
92
-    public function treat_input_as_field()
93
-    {
94
-        return $this->_input_field_name;
95
-    }
85
+	/**
86
+	 * Gets the name of the field that will be used for lookup.
87
+	 * eg it could be "EVT_name", meaning that if there is a model object in
88
+	 * the database that has that event name, and matching the other query parameters
89
+	 * on this strategy, the input will pass validation server-side
90
+	 * @return string
91
+	 */
92
+	public function treat_input_as_field()
93
+	{
94
+		return $this->_input_field_name;
95
+	}
96 96
 }
97 97
 
98 98
 // End of file EE_FUll_HTML_Validation_Strategy.strategy.php
Please login to merge, or discard this patch.
strategies/validation/EE_Many_Valued_Validation_Strategy.strategy.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -13,58 +13,58 @@
 block discarded – undo
13 13
  */
14 14
 class EE_Many_Valued_Validation_Strategy extends EE_Validation_Strategy_Base
15 15
 {
16
-    protected $_individual_item_validation_strategies = array();
17
-    /**
18
-     *
19
-     * @param EE_Validation_Strategy_Base[] $individual_item_validation_strategies (or a single EE_Validation_Strategy_Base)
20
-     */
21
-    public function __construct($individual_item_validation_strategies)
22
-    {
23
-        if (! is_array($individual_item_validation_strategies)) {
24
-            $individual_item_validation_strategies = array($individual_item_validation_strategies);
25
-        }
26
-        $this->_individual_item_validation_strategies = $individual_item_validation_strategies;
27
-        parent::__construct();
28
-    }
16
+	protected $_individual_item_validation_strategies = array();
17
+	/**
18
+	 *
19
+	 * @param EE_Validation_Strategy_Base[] $individual_item_validation_strategies (or a single EE_Validation_Strategy_Base)
20
+	 */
21
+	public function __construct($individual_item_validation_strategies)
22
+	{
23
+		if (! is_array($individual_item_validation_strategies)) {
24
+			$individual_item_validation_strategies = array($individual_item_validation_strategies);
25
+		}
26
+		$this->_individual_item_validation_strategies = $individual_item_validation_strategies;
27
+		parent::__construct();
28
+	}
29 29
 
30 30
 
31 31
 
32
-    /**
33
-     * Applies all teh individual item validation strategies on each item in the array
34
-     * @param array $normalized_value
35
-     * @return boolean
36
-     */
37
-    public function validate($normalized_value)
38
-    {
39
-        if (is_array($normalized_value)) {
40
-            $items_to_validate = $normalized_value;
41
-        } else {
42
-            $items_to_validate = array($normalized_value);
43
-        }
44
-        foreach ($items_to_validate as $individual_item) {
45
-            foreach ($this->_individual_item_validation_strategies as $validation_strategy) {
46
-                if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
47
-                    $validation_strategy->validate($individual_item);
48
-                }
49
-            }
50
-        }
51
-        return true;
52
-    }
32
+	/**
33
+	 * Applies all teh individual item validation strategies on each item in the array
34
+	 * @param array $normalized_value
35
+	 * @return boolean
36
+	 */
37
+	public function validate($normalized_value)
38
+	{
39
+		if (is_array($normalized_value)) {
40
+			$items_to_validate = $normalized_value;
41
+		} else {
42
+			$items_to_validate = array($normalized_value);
43
+		}
44
+		foreach ($items_to_validate as $individual_item) {
45
+			foreach ($this->_individual_item_validation_strategies as $validation_strategy) {
46
+				if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
47
+					$validation_strategy->validate($individual_item);
48
+				}
49
+			}
50
+		}
51
+		return true;
52
+	}
53 53
 
54 54
 
55 55
 
56
-    /**
57
-     * Extends parent's _construct_finalize so we ALSO set the input
58
-     * on each sub-validation-strategy
59
-     * @param \EE_Form_Input_Base $form_input
60
-     */
61
-    public function _construct_finalize(\EE_Form_Input_Base $form_input)
62
-    {
63
-        parent::_construct_finalize($form_input);
64
-        foreach ($this->_individual_item_validation_strategies as $item_validation_strategy) {
65
-            if ($item_validation_strategy instanceof EE_Validation_Strategy_Base) {
66
-                $item_validation_strategy->_construct_finalize($form_input);
67
-            }
68
-        }
69
-    }
56
+	/**
57
+	 * Extends parent's _construct_finalize so we ALSO set the input
58
+	 * on each sub-validation-strategy
59
+	 * @param \EE_Form_Input_Base $form_input
60
+	 */
61
+	public function _construct_finalize(\EE_Form_Input_Base $form_input)
62
+	{
63
+		parent::_construct_finalize($form_input);
64
+		foreach ($this->_individual_item_validation_strategies as $item_validation_strategy) {
65
+			if ($item_validation_strategy instanceof EE_Validation_Strategy_Base) {
66
+				$item_validation_strategy->_construct_finalize($form_input);
67
+			}
68
+		}
69
+	}
70 70
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public function __construct($individual_item_validation_strategies)
22 22
     {
23
-        if (! is_array($individual_item_validation_strategies)) {
23
+        if ( ! is_array($individual_item_validation_strategies)) {
24 24
             $individual_item_validation_strategies = array($individual_item_validation_strategies);
25 25
         }
26 26
         $this->_individual_item_validation_strategies = $individual_item_validation_strategies;
Please login to merge, or discard this patch.