Code Duplication    Length = 38-38 lines in 2 locations

core/Container.php 1 location

@@ 17-54 (lines=38) @@
14
 * @method static \Carbon_Fields\Container\Theme_Options_Container make_theme_options( string $id, string $name = null )
15
 * @method static \Carbon_Fields\Container\User_Meta_Container make_user_meta( string $id, string $name = null )
16
 */
17
class Container {
18
19
	/**
20
	 * A proxy for the abstract container factory method.
21
	 *
22
	 * @see    \Carbon_Fields\Container\Container::factory()
23
	 * @return \Carbon_Fields\Container\Container
24
	 */
25
	public static function factory() {
26
		return call_user_func_array( array( '\Carbon_Fields\Container\Container', 'factory' ), func_get_args() );
27
	}
28
29
	/**
30
	 * An alias of factory().
31
	 *
32
	 * @see    \Carbon_Fields\Container\Container::factory()
33
	 * @return \Carbon_Fields\Container\Container
34
	 */
35
	public static function make() {
36
		return call_user_func_array( array( get_class(), 'factory' ), func_get_args() );
37
	}
38
39
	/**
40
	 * @param string $method
41
	 * @param array $arguments
42
	 *
43
	 * @return mixed
44
	 */
45
	public static function __callStatic( $method, $arguments ) {
46
		if ( strpos( $method, 'make_' ) === 0 ) {
47
			$raw_type = substr_replace( $method, '', 0, 5 );
48
			array_unshift( $arguments, $raw_type );
49
			return call_user_func_array( array( get_class(), 'factory' ), $arguments );
50
		} else {
51
			trigger_error( sprintf( 'Call to undefined function: %s::%s().', get_class(), $method ), E_USER_ERROR );
52
		}
53
	}
54
}
55

core/Field.php 1 location

@@ 37-74 (lines=38) @@
34
 * @method static \Carbon_Fields\Field\Textarea_Field make_textarea( string $name, string $label = null )
35
 * @method static \Carbon_Fields\Field\Time_Field make_time( string $name, string $label = null )
36
 */
37
class Field {
38
39
	/**
40
	 * A proxy for the abstract field factory method.
41
	 *
42
	 * @see    \Carbon_Fields\Field\Field::factory()
43
	 * @return \Carbon_Fields\Field\Field
44
	 */
45
	public static function factory() {
46
		return call_user_func_array( array( '\Carbon_Fields\Field\Field', 'factory' ), func_get_args() );
47
	}
48
49
	/**
50
	 * An alias of factory().
51
	 *
52
	 * @see    \Carbon_Fields\Field\Field::factory()
53
	 * @return \Carbon_Fields\Field\Field
54
	 */
55
	public static function make() {
56
		return call_user_func_array( array( get_class(), 'factory' ), func_get_args() );
57
	}
58
59
	/**
60
	 * @param string $method
61
	 * @param array $arguments
62
	 *
63
	 * @return mixed
64
	 */
65
	public static function __callStatic( $method, $arguments ) {
66
		if ( strpos( $method, 'make_' ) === 0 ) {
67
			$raw_type = substr_replace( $method, '', 0, 5 );
68
			array_unshift( $arguments, $raw_type );
69
			return call_user_func_array( array( get_class(), 'factory' ), $arguments );
70
		} else {
71
			trigger_error( sprintf( 'Call to undefined function: %s::%s().', get_class(), $method ), E_USER_ERROR );
72
		}
73
	}
74
}
75