PHP Class Inpsyde\MultilingualPress\Factory\GenericFactory

Since: 3.0.0
Inheritance: implements Inpsyde\MultilingualPress\Common\Factory
Datei anzeigen Open project: inpsyde/multilingual-press Class Usage Examples

Public Methods

Method Description
__construct ( string $base, string $default_class = '' ) Constructor. Sets up the properties.
create ( array $args = [], string $class = '' ) : object Returns a new object of the given (or default) class, instantiated with the given arguments.
with_default_class ( string $base, string $default_class ) : static Returns a new factory object, instantiated with the given arguments.

Private Methods

Method Description
check_class ( string $class ) : void Checks if the class with the given name is valid with respect to the defined base.

Method Details

__construct() public method

Constructor. Sets up the properties.
Since: 3.0.0
public __construct ( string $base, string $default_class = '' )
$base string Fully qualified name of the base class or interface.
$default_class string Optional. Fully qualified name of the default class. Defaults to empty string.

create() public method

Returns a new object of the given (or default) class, instantiated with the given arguments.
Since: 3.0.0
public create ( array $args = [], string $class = '' ) : object
$args array Optional. Constructor arguments. Defaults to empty array.
$class string Optional. Fully qualified class name. Defaults to empty string.
return object Object of the given (or default) class, instantiated with the given arguments.

with_default_class() public static method

Returns a new factory object, instantiated with the given arguments.
Since: 3.0.0
public static with_default_class ( string $base, string $default_class ) : static
$base string Fully qualified name of the base class or interface.
$default_class string Fully qualified name of the default class.
return static Factory object.