Completed
Pull Request — staging (#840)
by
unknown
16:56
created

InvalidProperty::cannot_modify()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 6
rs 10
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 InvalidProperty
14
 *
15
 * @since   %VERSION%
16
 * @package YIKES\EasyForms
17
 */
18
class InvalidProperty extends \InvalidArgumentException implements Exception {
19
20
	/**
21
	 * Create a new instance of the class when a property cannot be modified.
22
	 *
23
	 * @since %VERSION%
24
	 *
25
	 * @param string $property The property that cannot be modified.
26
	 *
27
	 * @return static
28
	 */
29
	public static function cannot_modify( $property ) {
30
		return new static( sprintf(
31
			'The property "%s" cannot be modified.',
32
			$property
33
		) );
34
	}
35
36
	/**
37
	 * Create a new instance of the class when the property does not allow multiple values.
38
	 *
39
	 * @since %VERSION%
40
	 *
41
	 * @param string $property The property name.
42
	 *
43
	 * @return static
44
	 */
45
	public static function not_multiple( $property ) {
46
		return new static( sprintf(
47
			'The property "%s" does not allow multiple values.',
48
			$property
49
		) );
50
	}
51
}
52