Completed
Pull Request — staging (#840)
by
unknown
18:17
created

NoDefault   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A default_value() 0 9 1
1
<?php
2
/**
3
 * YIKES Inc. Easy Mailchimp Forms Plugin.
4
 *
5
 * @package   Yikes\EasyForms
6
 * @author    Freddie Mixell
7
 * @license   GPL2
8
 */
9
10
namespace YIKES\EasyForms\Exception;
11
12
/**
13
 * Class NoDefault
14
 *
15
 * @since   %VERSION%
16
 *
17
 * @package Yikes\EasyForms\Exception
18
 * @author  Freddie Mixell
19
 */
20
class NoDefault extends \LogicException implements Exception {
21
22
	/**
23
	 * Create a new exception when a field needs a default.
24
	 *
25
	 * @author Freddie Mixell
26
	 *
27
	 * @param string $slug The field slug that needs a default value.
28
	 *
29
	 * @return static
30
	 */
31
	public static function default_value( $slug ) {
32
		$message = sprintf(
33
			/* translators: %s refers to a field's slug */
34
			__( 'The field "%s" must have a default value.', 'yikes-inc-easy-mailchimp-extender' ),
35
			$slug
36
		);
37
38
		return new static( $message );
39
	}
40
}
41