| 1 |
<?php |
| 2 |
|
| 3 |
namespace Carbon_Fields; |
| 4 |
|
| 5 |
/** |
| 6 |
* Container proxy factory class. |
| 7 |
* Used for shorter namespace access when creating a container. |
| 8 |
* |
| 9 |
* @method static \Carbon_Fields\Container\Comment_Meta_Container make_comment_meta( string $id, string $name = null ) |
| 10 |
* @method static \Carbon_Fields\Container\Nav_Menu_Item_Container make_nav_menu_item( string $id, string $name = null ) |
| 11 |
* @method static \Carbon_Fields\Container\Network_Container make_network( string $id, string $name = null ) |
| 12 |
* @method static \Carbon_Fields\Container\Post_Meta_Container make_post_meta( string $id, string $name = null ) |
| 13 |
* @method static \Carbon_Fields\Container\Term_Meta_Container make_term_meta( string $id, string $name = null ) |
| 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 |
|