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

EmptyArray::from_function()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 5
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
use InvalidArgumentException;
13
14
/**
15
 * Class EmptyArray
16
 *
17
 * @since   %VERSION%
18
 * @package YIKES\EasyForms
19
 */
20
class EmptyArray extends InvalidArgumentException implements Exception {
21
22
	/**
23
	 * Create a new instance of an exception when an empty array is provided.
24
	 *
25
	 * @since %VERSION%
26
	 *
27
	 * @param string $function The function name.
28
	 *
29
	 * @return static
30
	 */
31
	public static function from_function( $function ) {
32
		$message = sprintf( 'Function %s cannot receive an empty array.', $function );
33
34
		return new static( $message );
35
	}
36
}
37