Code Duplication    Length = 11-16 lines in 6 locations

core/libraries/form_sections/form_handlers/SequentialStepForm.php 2 locations

@@ 149-160 (lines=12) @@
146
     * @throws InvalidDataTypeException
147
     * @throws InvalidArgumentException
148
     */
149
    public function setRedirectUrl($redirect_url)
150
    {
151
        if (! is_string($redirect_url)) {
152
            throw new InvalidDataTypeException('$redirect_url', $redirect_url, 'string');
153
        }
154
        if (empty($redirect_url)) {
155
            throw new InvalidArgumentException(
156
                esc_html__('The redirect URL can not be an empty string.', 'event_espresso')
157
            );
158
        }
159
        $this->redirect_url = $redirect_url;
160
    }
161
162
163
@@ 169-184 (lines=16) @@
166
     * @throws InvalidDataTypeException
167
     * @throws InvalidArgumentException
168
     */
169
    public function addRedirectArgs($redirect_args = array())
170
    {
171
        if (is_object($redirect_args)) {
172
            throw new InvalidDataTypeException(
173
                '$redirect_args',
174
                $redirect_args,
175
                'anything other than an object was expected.'
176
            );
177
        }
178
        if (empty($redirect_args)) {
179
            throw new InvalidArgumentException(
180
                esc_html__('The redirect argument can not be an empty array.', 'event_espresso')
181
            );
182
        }
183
        $this->redirect_args = array_merge($this->redirect_args, (array)$redirect_args);
184
    }
185
186
187

core/libraries/form_sections/form_handlers/SequentialStepFormManager.php 1 location

@@ 152-163 (lines=12) @@
149
     * @throws InvalidDataTypeException
150
     * @throws InvalidArgumentException
151
     */
152
    protected function setBaseUrl($base_url)
153
    {
154
        if (! is_string($base_url)) {
155
            throw new InvalidDataTypeException('$base_url', $base_url, 'string');
156
        }
157
        if (empty($base_url)) {
158
            throw new InvalidArgumentException(
159
                esc_html__('The base URL can not be an empty string.', 'event_espresso')
160
            );
161
        }
162
        $this->base_url = $base_url;
163
    }
164
165
166

core/libraries/form_sections/form_handlers/FormHandler.php 2 locations

@@ 367-378 (lines=12) @@
364
     * @throws InvalidDataTypeException
365
     * @throws InvalidArgumentException
366
     */
367
    public function setSubmitBtnText($submit_btn_text)
368
    {
369
        if (! is_string($submit_btn_text)) {
370
            throw new InvalidDataTypeException('$submit_btn_text', $submit_btn_text, 'string');
371
        }
372
        if (empty($submit_btn_text)) {
373
            throw new InvalidArgumentException(
374
                esc_html__('Can not set Submit button text because an empty string was provided.', 'event_espresso')
375
            );
376
        }
377
        $this->submit_btn_text = $submit_btn_text;
378
    }
379
380
381
@@ 413-428 (lines=16) @@
410
     * @throws InvalidDataTypeException
411
     * @throws InvalidArgumentException
412
     */
413
    public function addFormActionArgs($form_args = array())
414
    {
415
        if (is_object($form_args)) {
416
            throw new InvalidDataTypeException(
417
                '$form_args',
418
                $form_args,
419
                'anything other than an object was expected.'
420
            );
421
        }
422
        if (empty($form_args)) {
423
            throw new InvalidArgumentException(
424
                esc_html__('The redirect arguments can not be an empty array.', 'event_espresso')
425
            );
426
        }
427
        $this->form_args = array_merge($this->form_args, $form_args);
428
    }
429
430
431

core/services/notices/Notice.php 1 location

@@ 208-218 (lines=11) @@
205
     * @param string $message
206
     * @throws InvalidDataTypeException
207
     */
208
    private function setMessage($message)
209
    {
210
        if (empty($message) || ! is_string($message)) {
211
            throw new InvalidDataTypeException(
212
                '$message',
213
                $message,
214
                esc_html__('non empty string', 'event_espresso')
215
            );
216
        }
217
        $this->message = $message;
218
    }
219
220
221