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

MustExtend::default_slug()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
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 MustExtend
14
 *
15
 * @since   %VERSION%
16
 *
17
 * @package YIKES\EasyForms\Exception
18
 * @author  Freddie Mixell
19
 */
20
class MustExtend extends \LogicException implements Exception {
21
22
	/**
23
	 * Create a new exception when a slug needs extended.
24
	 *
25
	 * @author Freddie Mixell
26
	 *
27
	 * @param string $slug The default slug that needs extended.
28
	 *
29
	 * @return static
30
	 */
31
	public static function default_slug( $slug ) {
32
		$message = sprintf(
33
			/* translators: %s refers to the default slug */
34
			__( 'The default slug "%s" must be extended in a subclass.', 'yikes-inc-easy-mailchimp-extender' ),
35
			$slug
36
		);
37
38
		return new static( $message );
39
	}
40
41
	/**
42
	 * Create a new exception when a tag needs extended.
43
	 *
44
	 * @since %VERSION%
45
	 *
46
	 * @param string $tag The default tag that needs extended.
47
	 *
48
	 * @return static
49
	 */
50
	public static function default_tag( $tag ) {
51
		$message = sprintf(
52
			/* translators: %s refers to the default tag */
53
			__( 'The default tag "%s" must be extended in a subclass.', 'yikes-inc-easy-mailchimp-extender' ),
54
			$tag
55
		);
56
57
		return new static( $message );
58
	}
59
60
	/**
61
	 * Create a new exception when a view needs extended.
62
	 *
63
	 * @since %VERSION%
64
	 *
65
	 * @param string $view The default view that needs extended.
66
	 *
67
	 * @return static
68
	 */
69
	public static function default_view( $view ) {
70
		$message = sprintf(
71
			/* translators: %s refers to the default view */
72
			__( 'The default view "%s" must be extended in a subclass.', 'yikes-inc-easy-mailchimp-extender' ),
73
			$view
74
		);
75
76
		return new static( $message );
77
	}
78
79
	/**
80
	 * Create a new exception when a type needs extended.
81
	 *
82
	 * @since %VERSION%
83
	 *
84
	 * @param string $type The default type that needs extended.
85
	 *
86
	 * @return static
87
	 */
88
	public static function default_type( $type ) {
89
		$message = sprintf(
90
			/* translators: %s refers to the default type */
91
			__( 'The default type "%s" must be extended in a subclass.', 'yikes-inc-easy-mailchimp-extender' ),
92
			$type
93
		);
94
95
		return new static( $message );
96
	}
97
98
	/**
99
	 * Create a new exception when a name needs to be extended.
100
	 *
101
	 * @since %VERSION%
102
	 *
103
	 * @param string $name The default name.
104
	 *
105
	 * @return static
106
	 */
107
	public static function default_name( $name ) {
108
		$message = sprintf(
109
			/* translators: %s refers to the default name */
110
			__( 'The default name "%s" must be extended in a subclass.', 'yikes-inc-easy-mailchimp-extender' ),
111
			$name
112
		);
113
114
		return new static( $message );
115
	}
116
}
117